Apply Upstream code (2021-03-15)
authorJihoon Jung <jh8801.jung@samsung.com>
Mon, 15 Mar 2021 04:24:07 +0000 (13:24 +0900)
committer정지훈/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jh8801.jung@samsung.com>
Mon, 15 Mar 2021 22:46:33 +0000 (07:46 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
680 files changed:
.gn
build/chip/python_gen_tags.py [deleted file]
build_overrides/esp32.gni [deleted file]
config/k32w/k32w061-app.mk [deleted file]
config/k32w/k32w061-chip.mk [deleted file]
config/nrfconnect/.gn [deleted file]
config/nrfconnect/.nrfconnect-recommended-revision [new file with mode: 0644]
config/nrfconnect/BUILD.gn [deleted file]
config/nrfconnect/Kconfig [deleted file]
config/nrfconnect/app/check-nrfconnect-version.cmake [moved from config/nrfconnect/overlay-usb_support.conf with 65% similarity]
config/nrfconnect/args.gni [deleted file]
config/nrfconnect/build [deleted symlink]
config/nrfconnect/build_overrides [deleted symlink]
config/nrfconnect/chip-lib.cmake [deleted file]
config/nrfconnect/chip-module/CMakeLists.txt
config/nrfconnect/lib/pw_rpc/BUILD.gn [deleted file]
config/nrfconnect/lib/pw_rpc/pw_rpc.gni [deleted file]
config/nrfconnect/nrfconnect-app.cmake [deleted file]
config/nrfconnect/release.conf [deleted file]
config/nrfconnect/sample-defaults.conf [deleted file]
config/nrfconnect/third_party/connectedhomeip [deleted symlink]
config/nrfconnect/toolchain/BUILD.gn [deleted file]
docs/BUILDING.md
docs/specs/chip-tlv-format.adoc [deleted file]
examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
examples/all-clusters-app/all-clusters-common/gen/CHIPClientCallbacks.cpp
examples/all-clusters-app/all-clusters-common/gen/CHIPClientCallbacks.h
examples/all-clusters-app/all-clusters-common/gen/CHIPClustersObjc.h
examples/all-clusters-app/all-clusters-common/gen/CHIPClustersObjc.mm
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.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/print-cluster.h
examples/all-clusters-app/linux/build [deleted symlink]
examples/bridge-app/bridge-common/bridge-app.zap
examples/bridge-app/bridge-common/gen/CHIPClientCallbacks.cpp
examples/bridge-app/bridge-common/gen/CHIPClientCallbacks.h
examples/bridge-app/bridge-common/gen/CHIPClustersObjc.h
examples/bridge-app/bridge-common/gen/CHIPClustersObjc.mm
examples/bridge-app/bridge-common/gen/IMClusterCommandHandler.cpp
examples/bridge-app/bridge-common/gen/attribute-id.h
examples/bridge-app/bridge-common/gen/call-command-handler.cpp
examples/bridge-app/bridge-common/gen/callback.h
examples/bridge-app/bridge-common/gen/client-command-macro.h
examples/bridge-app/bridge-common/gen/cluster-id.h
examples/bridge-app/bridge-common/gen/command-id.h
examples/bridge-app/bridge-common/gen/endpoint_config.h
examples/bridge-app/bridge-common/gen/gen_config.h
examples/bridge-app/bridge-common/gen/print-cluster.h
examples/bridge-app/linux/main.cpp
examples/chip-tool/build [deleted symlink]
examples/chip-tool/chip-tool.zap
examples/chip-tool/commands/clusters/Commands.h
examples/chip-tool/commands/clusters/ModelCommandResponse.h [deleted file]
examples/chip-tool/commands/common/Logging.cpp [deleted file]
examples/chip-tool/commands/common/Logging.h [deleted file]
examples/chip-tool/commands/common/NetworkCommand.cpp [deleted file]
examples/chip-tool/commands/common/NetworkCommand.h [deleted file]
examples/chip-tool/commands/echo/Commands.h [deleted file]
examples/chip-tool/commands/echo/EchoCommand.cpp [deleted file]
examples/chip-tool/commands/echo/EchoCommand.h [deleted file]
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/attribute-id.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/print-cluster.h
examples/chip-tool/templates/commands.zapt
examples/chip-tool/templates/helper.js
examples/common/chip-app-server/.gn [deleted file]
examples/common/chip-app-server/BUILD.gn [deleted file]
examples/common/chip-app-server/DataModelHandler.cpp [deleted file]
examples/common/chip-app-server/QRCodeUtil.cpp [deleted file]
examples/common/chip-app-server/RendezvousServer.cpp [deleted file]
examples/common/chip-app-server/Server.cpp [deleted file]
examples/common/chip-app-server/args.gni [deleted file]
examples/common/chip-app-server/build [deleted symlink]
examples/common/chip-app-server/include/AppDelegate.h [deleted file]
examples/common/chip-app-server/include/DataModelHandler.h [deleted file]
examples/common/chip-app-server/include/QRCodeUtil.h [deleted file]
examples/common/chip-app-server/include/RendezvousServer.h [deleted file]
examples/common/chip-app-server/include/Server.h [deleted file]
examples/common/chip-app-server/include/SessionManager.h [deleted file]
examples/lighting-app/efr32/build [deleted symlink]
examples/lighting-app/efr32/include/board_features.h [deleted file]
examples/lighting-app/efr32/include/hal-config-app-common.h [deleted file]
examples/lighting-app/lighting-common/gen/CHIPClientCallbacks.cpp
examples/lighting-app/lighting-common/gen/CHIPClientCallbacks.h
examples/lighting-app/lighting-common/gen/CHIPClustersObjc.h
examples/lighting-app/lighting-common/gen/CHIPClustersObjc.mm
examples/lighting-app/lighting-common/gen/attribute-id.h
examples/lighting-app/lighting-common/gen/call-command-handler.cpp
examples/lighting-app/lighting-common/gen/callback-stub.cpp
examples/lighting-app/lighting-common/gen/callback.h
examples/lighting-app/lighting-common/gen/client-command-macro.h
examples/lighting-app/lighting-common/gen/cluster-id.h
examples/lighting-app/lighting-common/gen/command-id.h
examples/lighting-app/lighting-common/gen/endpoint_config.h
examples/lighting-app/lighting-common/gen/gen_config.h
examples/lighting-app/lighting-common/gen/print-cluster.h
examples/lighting-app/lighting-common/lighting-app.zap
examples/lighting-app/linux/build [deleted symlink]
examples/lighting-app/linux/main.cpp
examples/lighting-app/nrfconnect/CMakeLists.txt
examples/lighting-app/nrfconnect/README.md
examples/lighting-app/nrfconnect/dts.overlay [deleted file]
examples/lock-app/efr32/build [deleted symlink]
examples/lock-app/efr32/include/ble-configuration.h [deleted file]
examples/lock-app/efr32/include/board_features.h [deleted file]
examples/lock-app/efr32/include/hal-config-app-common.h [deleted file]
examples/lock-app/k32w/Makefile [deleted file]
examples/lock-app/k32w/build [deleted symlink]
examples/lock-app/k32w/main/main.cpp
examples/lock-app/lock-common/gen/CHIPClientCallbacks.cpp
examples/lock-app/lock-common/gen/CHIPClientCallbacks.h
examples/lock-app/lock-common/gen/CHIPClustersObjc.h
examples/lock-app/lock-common/gen/CHIPClustersObjc.mm
examples/lock-app/lock-common/gen/attribute-id.h
examples/lock-app/lock-common/gen/call-command-handler.cpp
examples/lock-app/lock-common/gen/callback-stub.cpp
examples/lock-app/lock-common/gen/callback.h
examples/lock-app/lock-common/gen/client-command-macro.h
examples/lock-app/lock-common/gen/cluster-id.h
examples/lock-app/lock-common/gen/command-id.h
examples/lock-app/lock-common/gen/endpoint_config.h
examples/lock-app/lock-common/gen/gen_config.h
examples/lock-app/lock-common/gen/print-cluster.h
examples/lock-app/lock-common/lock-app.zap
examples/lock-app/nrfconnect/CMakeLists.txt
examples/lock-app/nrfconnect/README.md
examples/lock-app/nrfconnect/dts.overlay [deleted file]
examples/lock-app/qpg6100/build [deleted symlink]
examples/lock-app/qpg6100/src/main.cpp [deleted file]
examples/minimal-mdns/build [deleted symlink]
examples/pigweed-app/nrf5/README.md [deleted file]
examples/pigweed-app/nrfconnect/CMakeLists.txt
examples/pigweed-app/nrfconnect/README.md
examples/pigweed-app/nrfconnect/dts.overlay [deleted file]
examples/platform/efr32/efr32mg12/BRD4161A/init_board.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4161A/init_mcu.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4163A/init_board.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4163A/init_mcu.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4164A/init_board.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4164A/init_mcu.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4166A/init_board.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4166A/init_mcu.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4170A/init_board.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4170A/init_mcu.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4304A/init_board.c [deleted file]
examples/platform/efr32/efr32mg12/BRD4304A/init_mcu.c [deleted file]
examples/platform/efr32/efr32mg21/BRD4180A/init_board.c [deleted file]
examples/platform/efr32/efr32mg21/BRD4180A/init_mcu.c [deleted file]
examples/platform/efr32/init_board.h [deleted file]
examples/platform/efr32/init_mcu.h [deleted file]
examples/platform/efr32/init_otSystem.c [deleted file]
examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.c [deleted file]
examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.h [deleted file]
examples/platform/k32w/app/support/FreeRtosMbedtlsUtils.c
examples/platform/k32w/doc/images/debg-conf.JPG [deleted file]
examples/platform/nrfconnect/doc/images/nrf52840-dk.jpg [deleted file]
examples/platform/nrfconnect/pw_sys_io/include/pw_sys_io_nrfconnect/init.h [deleted file]
examples/platform/qpg6100/util/streamer/streamer_qpg6100.cpp [deleted file]
examples/shell/README.md
examples/shell/nrfconnect/CHIPProjectConfig.h
examples/shell/nrfconnect/CMakeLists.txt
examples/shell/qpg6100/.gn [deleted file]
examples/shell/qpg6100/BUILD.gn [deleted file]
examples/shell/qpg6100/README.md [deleted file]
examples/shell/qpg6100/args.gni [deleted file]
examples/shell/qpg6100/build [deleted symlink]
examples/shell/qpg6100/build_overrides [deleted symlink]
examples/shell/qpg6100/main.cpp [deleted file]
examples/shell/qpg6100/third_party/connectedhomeip [deleted symlink]
examples/shell/shell_common/BUILD.gn
examples/shell/shell_common/cmd_ping.cpp [new file with mode: 0644]
examples/shell/shell_common/include/ChipShellCollection.h
examples/shell/standalone/build [deleted symlink]
examples/shell/standalone/main.cpp
examples/temperature-measurement-app/esp32/main/gen/CHIPClientCallbacks.cpp
examples/temperature-measurement-app/esp32/main/gen/CHIPClientCallbacks.h
examples/temperature-measurement-app/esp32/main/gen/CHIPClustersObjc.h
examples/temperature-measurement-app/esp32/main/gen/CHIPClustersObjc.mm
examples/temperature-measurement-app/esp32/main/gen/IMClusterCommandHandler.cpp
examples/temperature-measurement-app/esp32/main/gen/attribute-id.h
examples/temperature-measurement-app/esp32/main/gen/call-command-handler.cpp
examples/temperature-measurement-app/esp32/main/gen/callback.h
examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h
examples/temperature-measurement-app/esp32/main/gen/cluster-id.h
examples/temperature-measurement-app/esp32/main/gen/command-id.h
examples/temperature-measurement-app/esp32/main/gen/endpoint_config.h
examples/temperature-measurement-app/esp32/main/gen/print-cluster.h
examples/temperature-measurement-app/esp32/main/temperature-measurement.zap
examples/tv-app/tv-common/gen/CHIPClientCallbacks.cpp
examples/tv-app/tv-common/gen/CHIPClientCallbacks.h
examples/tv-app/tv-common/gen/CHIPClustersObjc.h
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.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/print-cluster.h
examples/tv-app/tv-common/tv-app.zap
scripts/examples/esp_echo_app.sh [deleted file]
scripts/setup/install_packages.sh [deleted file]
scripts/setup/nrfconnect/update_ncs.py [new file with mode: 0755]
src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/EnterWifiNetworkFragment.kt [deleted file]
src/app/Command.cpp
src/app/Command.h
src/app/MessageDef.cpp [deleted file]
src/app/MessageDef.h [deleted file]
src/app/chip-zcl-zpro-codec-api.h
src/app/encoder.cpp
src/app/server/Mdns.cpp
src/app/server/Server.cpp
src/app/tests/integration/chip_im_initiator.cpp
src/app/tests/integration/chip_im_responder.cpp
src/app/util/ember-compatibility-functions.cpp
src/app/zap-templates/af-structs.zapt [deleted file]
src/app/zap-templates/att-storage.zapt [deleted file]
src/app/zap-templates/attribute-id.zapt [deleted file]
src/app/zap-templates/attribute-size.zapt [deleted file]
src/app/zap-templates/attribute-type.zapt [deleted file]
src/app/zap-templates/call-command-handler-src.zapt [deleted file]
src/app/zap-templates/call-command-handler.zapt [deleted file]
src/app/zap-templates/callback-stub-src.zapt [deleted file]
src/app/zap-templates/callback.zapt [deleted file]
src/app/zap-templates/client-command-macro.zapt [deleted file]
src/app/zap-templates/cluster-id.zapt [deleted file]
src/app/zap-templates/command-id.zapt [deleted file]
src/app/zap-templates/common/StringHelper.js
src/app/zap-templates/endpoint_config.zapt [deleted file]
src/app/zap-templates/enums.zapt [deleted file]
src/app/zap-templates/gen_config.zapt [deleted file]
src/app/zap-templates/helper-chip.js [deleted file]
src/app/zap-templates/print-cluster.zapt [deleted file]
src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt
src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt
src/app/zap-templates/templates/chip/CHIPClusters-src.zapt
src/app/zap-templates/templates/chip/CHIPClusters.zapt
src/app/zap-templates/templates/chip/CHIPClustersObjc-src.zapt
src/app/zap-templates/templates/chip/CHIPClustersObjc.zapt
src/app/zap-templates/templates/chip/chip-zcl-zpro-codec-api.zapt
src/app/zap-templates/templates/chip/encoder-src.zapt
src/app/zap-templates/templates/chip/helper.js
src/app/zap-templates/templates/chip/python-ChipDeviceController-ClusterCommands.zapt
src/app/zap-templates/templates/chip/python-chip-ChipCluster.zapt
src/app/zap-templates/zcl/application-basic-cluster.xml
src/app/zap-templates/zcl/clusters-extensions.xml
src/app/zap-templates/zcl/data-model/silabs/general.xml
src/app/zap-templates/zcl/data-model/silabs/ta.xml
src/ble/BLEEndPoint.cpp
src/ble/BLEEndPoint.h
src/ble/BtpEngine.cpp
src/ble/BtpEngine.h
src/controller/CHIPClusters.cpp
src/controller/CHIPClusters.h
src/controller/CHIPPersistentStorageDelegate.h [deleted file]
src/controller/OnOffCluster.cpp [deleted file]
src/controller/OnOffCluster.h [deleted file]
src/controller/controller-clusters.zap
src/controller/python/BUILD.gn
src/controller/python/ChipDeviceController-BleApplicationDelegate.cpp [deleted file]
src/controller/python/ChipDeviceController-BleApplicationDelegate.h [deleted file]
src/controller/python/ChipDeviceController-BlePlatformDelegate.cpp [deleted file]
src/controller/python/ChipDeviceController-BlePlatformDelegate.h [deleted file]
src/controller/python/ChipDeviceController-ClusterCommands.cpp
src/controller/python/build-chip-wheel.py
src/controller/python/chip/ChipCluster.py
src/controller/python/chip/ChipTLV.py [deleted file]
src/credentials/CHIPCert.cpp
src/credentials/CHIPCert.h
src/credentials/CHIPCertFromX509.cpp
src/credentials/CHIPCertToX509.cpp
src/credentials/tests/CHIPCert_test_vectors.cpp
src/credentials/tests/CHIPCert_test_vectors.h
src/credentials/tests/TestChipCert.cpp
src/darwin/Framework/CHIP/CHIPCallbackBridge.h [deleted file]
src/darwin/Framework/CHIP/CHIPCallbackBridge.mm [deleted file]
src/darwin/Framework/CHIP/CHIPDeviceCallback.h [deleted file]
src/darwin/Framework/CHIP/CHIPDeviceStatusDelegate.h [deleted file]
src/darwin/Framework/CHIP/CHIPDeviceStatusDelegateBridge.h [deleted file]
src/darwin/Framework/CHIP/CHIPDeviceStatusDelegateBridge.mm [deleted file]
src/darwin/Framework/CHIP/CHIPOnOff.h [deleted file]
src/darwin/Framework/CHIP/CHIPOnOff.mm [deleted file]
src/darwin/Framework/CHIP/chip-tool.zap
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/include/platform/ThreadStackManager.h
src/include/platform/internal/GenericConfigurationManagerImpl.cpp
src/include/platform/internal/GenericConfigurationManagerImpl.h
src/include/platform/internal/GenericConnectivityManagerImpl_Thread.cpp
src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h
src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h
src/inet/tests/TapAddrAutoconf.cpp [deleted file]
src/inet/tests/TestInetCommon.cpp [deleted file]
src/lib/asn1/ASN1.h [changed mode: 0755->0644]
src/lib/asn1/ASN1Config.h [changed mode: 0755->0644]
src/lib/asn1/ASN1Error.cpp [changed mode: 0755->0644]
src/lib/asn1/ASN1Error.h [changed mode: 0755->0644]
src/lib/asn1/ASN1OID.cpp [changed mode: 0755->0644]
src/lib/asn1/ASN1Writer.cpp [changed mode: 0755->0644]
src/lib/mdns/BUILD.gn
src/lib/mdns/DiscoveryManager.cpp [deleted file]
src/lib/mdns/DiscoveryManager.h [deleted file]
src/lib/mdns/Discovery_ImplPlatform.cpp
src/lib/mdns/Discovery_ImplPlatform.h
src/lib/mdns/minimal/BytesRange.h [deleted file]
src/lib/mdns/minimal/Constants.h [deleted file]
src/lib/mdns/minimal/DnsHeader.h [deleted file]
src/lib/mdns/minimal/IPResourceRecord.cpp [deleted file]
src/lib/mdns/minimal/IPResourceRecord.h [deleted file]
src/lib/mdns/minimal/QName.cpp [deleted file]
src/lib/mdns/minimal/QName.h [deleted file]
src/lib/mdns/minimal/ResourceRecord.cpp [deleted file]
src/lib/mdns/minimal/ResourceRecord.h [deleted file]
src/lib/mdns/minimal/format_test.py [deleted file]
src/lib/mdns/minimal/tests/TestIPResourceRecord.cpp [deleted file]
src/lib/mdns/minimal/tests/TestQName.cpp [deleted file]
src/lib/mdns/minimal/tests/TestResourceRecord.cpp [deleted file]
src/lib/mdns/platform/Mdns.h
src/lib/protocols/CHIPProtocols.h [deleted file]
src/lib/protocols/common/CHIPMessage.h [deleted file]
src/lib/protocols/common/CommonProtocol.h [deleted file]
src/lib/protocols/fabric-provisioning/FabricProvisioning.h [deleted file]
src/lib/protocols/security/CHIPApplicationKeys.h [deleted file]
src/lib/protocols/security/CHIPDummyGroupKeyStore.h [deleted file]
src/lib/protocols/security/CHIPSecurity.h [deleted file]
src/lib/protocols/status-report/StatusReportProtocol.h [deleted file]
src/lib/support/BitFlags.h
src/lib/support/BufBound.h [deleted file]
src/lib/support/BytesToHex.cpp
src/lib/support/BytesToHex.h
src/lib/support/logging/CHIPLoggingLogV.cpp [deleted file]
src/lib/support/tests/TestBufBound.cpp [deleted file]
src/lib/support/tests/TestBufBoundDriver.cpp [deleted file]
src/lib/support/tests/TestBufferReaderDriver.cpp [deleted file]
src/lib/support/tests/TestCHIPArgParserDriver.cpp [deleted file]
src/lib/support/tests/TestCHIPCounterDriver.cpp [deleted file]
src/lib/support/tests/TestCHIPMemDriver.cpp [deleted file]
src/lib/support/tests/TestErrorStrDriver.cpp [deleted file]
src/lib/support/tests/TestPersistedCounterDriver.cpp [deleted file]
src/lib/support/tests/TestSafeIntDriver.cpp [deleted file]
src/lib/support/tests/TestScopedBufferDriver.cpp [deleted file]
src/lib/support/tests/TestSerializableIntegerSetDriver.cpp [deleted file]
src/lib/support/tests/TestSupport.h [deleted file]
src/lib/support/tests/TestTimeUtilsDriver.cpp [deleted file]
src/messaging/ExchangeContext.h
src/messaging/Flags.h
src/messaging/ReliableMessageContext.cpp
src/messaging/ReliableMessageContext.h
src/messaging/ReliableMessageManager.cpp [deleted file]
src/messaging/ReliableMessageManager.h [deleted file]
src/messaging/tests/echo/echo_requester.cpp
src/platform/BUILD.gn
src/platform/EFR32/BLEManagerImpl.cpp
src/platform/EFR32/BLEManagerImpl.h
src/platform/ESP32/BLEManagerImpl.h
src/platform/ESP32/ConnectivityManagerImpl.cpp
src/platform/ESP32/ConnectivityManagerImpl.h
src/platform/ESP32/bluedroid/BLEManagerImpl.cpp
src/platform/ESP32/nimble/BLEManagerImpl.cpp
src/platform/K32W/BLEManagerImpl.cpp
src/platform/K32W/BLEManagerImpl.h
src/platform/K32W/BlePlatformConfig.h [changed mode: 0755->0644]
src/platform/K32W/CHIPDevicePlatformEvent.h [changed mode: 0755->0644]
src/platform/K32W/ThreadStackManagerImpl.cpp
src/platform/K32W/k32w-chip-mbedtls-config.h
src/platform/Linux/BLEManagerImpl.cpp
src/platform/Linux/BLEManagerImpl.h
src/platform/Linux/CHIPBluezHelper.cpp [deleted file]
src/platform/Linux/CHIPBluezHelper.h [deleted file]
src/platform/Linux/ConnectivityManagerImpl.cpp
src/platform/Linux/ConnectivityManagerImpl.h
src/platform/Linux/ThreadStackManagerImpl.cpp
src/platform/Linux/ThreadStackManagerImpl.h
src/platform/Linux/bluez/Helper.cpp
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h
src/platform/OpenThread/MdnsImpl.cpp [new file with mode: 0644]
src/platform/Zephyr/BLEManagerImpl.cpp
src/platform/Zephyr/BLEManagerImpl.h
src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp [deleted file]
src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.h [deleted file]
src/platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.cpp [deleted file]
src/platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.h [deleted file]
src/platform/cc13x2_26x2/BLEManagerImpl.cpp
src/platform/device.gni
src/platform/nrfconnect/BLEManagerImpl.cpp [deleted file]
src/platform/nrfconnect/ConfigurationManagerImpl.cpp [deleted file]
src/platform/nrfconnect/Logging.cpp [deleted file]
src/platform/nrfconnect/PlatformManagerImpl.cpp [deleted file]
src/platform/nrfconnect/ThreadStackManagerImpl.cpp [deleted file]
src/platform/nrfconnect/ZephyrConfig.cpp [deleted file]
src/platform/nrfconnect/ZephyrConfig.h [deleted file]
src/platform/qpg6100/BLEManagerImpl.cpp
src/platform/qpg6100/BLEManagerImpl.h
src/platform/qpg6100/Logging.cpp [changed mode: 0644->0755]
src/platform/tests/BUILD.gn
src/platform/tests/TestConfigurationMgr.h [deleted file]
src/platform/tests/TestConfigurationMgrDriver.cpp [deleted file]
src/platform/tests/TestMdns.h [deleted file]
src/platform/tests/TestMdnsDriver.cpp [deleted file]
src/platform/tests/TestPlatformMgr.h [deleted file]
src/platform/tests/TestPlatformMgrDriver.cpp [deleted file]
src/platform/tests/TestPlatformTime.h [deleted file]
src/platform/tests/TestPlatformTimeDriver.cpp [deleted file]
src/platform/tests/TestThreadStackMgr.h [deleted file]
src/platform/tests/TestThreadStackMgrDriver.cpp [deleted file]
src/protocols/bdx/BdxMessages.cpp
src/protocols/bdx/BdxMessages.h
src/protocols/bdx/BdxTransferSession.cpp
src/protocols/bdx/BdxTransferSession.h
src/protocols/bdx/tests/TestBdxMessages.cpp
src/protocols/bdx/tests/TestBdxTransferSession.cpp
src/protocols/echo/Echo.h
src/protocols/echo/EchoClient.cpp
src/setup_payload/AdditionalDataPayloadGenerator.cpp
src/setup_payload/AdditionalDataPayloadGenerator.h
src/setup_payload/tests/TestManualCode.h [deleted file]
src/setup_payload/tests/TestManualCodeDriver.cpp [deleted file]
src/setup_payload/tests/TestQRCode.h [deleted file]
src/setup_payload/tests/TestQRCodeDriver.cpp [deleted file]
src/setup_payload/tests/TestQRCodeTLV.h [deleted file]
src/setup_payload/tests/TestQRCodeTLVDriver.cpp [deleted file]
src/transport/SecurePairingSession.cpp [deleted file]
src/transport/SecurePairingSession.h [deleted file]
src/transport/SecureSessionMgr.cpp
src/transport/SecureSessionMgr.h
src/transport/TransportMgr.cpp [deleted file]
src/transport/raw/MessageHeader.cpp
src/transport/raw/MessageHeader.h
src/transport/tests/TestSecurePairingSession.cpp [deleted file]
third_party/bluez/repo/src/hcid.h [deleted file]
third_party/openthread/repo/examples/apps/ncp/ncp.cmake [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/Makefile.platform.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/README.md [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/alarm.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/brd4151a/board_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/brd4151a/hal-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/crypto/efr32-mbedtls-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/diag.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/efr32mg1.ld [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/entropy.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/fem-control.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/flash.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/logging.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/misc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/openthread-core-efr32-config-check.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/openthread-core-efr32-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/platform-band.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/platform-efr32.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/radio.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/rail_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/startup-gcc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/system.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg1/uart.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/Makefile.platform.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/README.md [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/alarm.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4161a/board_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4161a/hal-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4166a/board_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4166a/hal-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4170a/board_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4170a/hal-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4304a/board_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/brd4304a/hal-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/crypto/efr32-mbedtls-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/diag.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/efr32mg12.ld [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/entropy.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/fem-control.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/flash.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/logging.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/misc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/openthread-core-efr32-config-check.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/openthread-core-efr32-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/platform-band.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/platform-efr32.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/radio.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/rail_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/README.md [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/main.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/main.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/startup-gcc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/system.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg12/uart.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/Makefile.platform.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/README.md [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/alarm.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/brd4168a/board_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/brd4168a/hal-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/crypto/efr32-mbedtls-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/diag.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/efr32mg13.ld [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/entropy.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/fem-control.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/flash.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/logging.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/misc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/openthread-core-efr32-config-check.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/openthread-core-efr32-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/platform-band.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/platform-efr32.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/radio.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/rail_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/README.md [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/main.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/main.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/startup-gcc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/system.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg13/uart.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/Makefile.platform.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/README.md [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/alarm.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/brd4180a/board_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/brd4180a/hal-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/crypto/efr32-mbedtls-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/diag.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/efr32mg21.ld [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/entropy.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/fem-control.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/flash.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/logging.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/misc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/openthread-core-efr32-config-check.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/openthread-core-efr32-config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/platform-band.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/platform-efr32.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/radio.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/rail_config.h [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/README.md [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/main.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-mtd/Makefile.am [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-mtd/main.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/startup-gcc.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/system.c [deleted file]
third_party/openthread/repo/examples/platforms/efr32mg21/uart.c [deleted file]
third_party/openthread/repo/examples/platforms/gp712/uart-socket.c [deleted file]
third_party/openthread/repo/examples/platforms/qpg6095/qpg6095.ld [deleted file]
third_party/openthread/repo/include/openthread/platform/ble.h [deleted file]
third_party/openthread/repo/src/core/crypto/pbkdf2_cmac.h [deleted file]
third_party/openthread/repo/src/core/net/dns_headers.hpp [deleted file]
third_party/openthread/repo/src/posix/platform/max_power_table.hpp [deleted file]
third_party/openthread/repo/tests/scripts/thread-cert/Cert_5_3_06b_RouterIdMask.py [deleted file]
third_party/openthread/repo/tests/scripts/thread-cert/Cert_5_7_01_CoapDiagCommands_A.py [deleted file]
third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_02_REEDAttach_MED.py [deleted file]
third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_02_REEDAttach_SED.py [deleted file]
third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_06_REEDAttachLinkQuality_ED.py [deleted file]
third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_06_REEDAttachLinkQuality_SED.py [deleted file]
third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_09_EDSynchronization.py [deleted file]
third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/aes_alt.h [deleted file]
third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/cmac_alt.h [deleted file]
third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/dhm_alt.h [deleted file]
third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_abort_freertos.c [deleted file]
third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_abort_zephyr.c [deleted file]
third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_mutex_freertos.c [deleted file]
third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_mutex_zephyr.c [deleted file]
third_party/openthread/repo/third_party/Qorvo/LICENSE.txt [deleted file]
third_party/openthread/repo/third_party/Qorvo/README.md [deleted file]
third_party/ot-br-posix/repo/.travis.yml [deleted file]
third_party/ot-br-posix/repo/.travis/after_success.sh [deleted file]
third_party/ot-br-posix/repo/.travis/check-docker [deleted file]
third_party/ot-br-posix/repo/.travis/script.sh [deleted file]
third_party/pigweed/repo/pw_bloat/py/binary_diff.py [deleted file]
third_party/pigweed/repo/pw_bloat/py/bloat.py [deleted file]
third_party/pigweed/repo/pw_bloat/py/bloat_output.py [deleted file]
third_party/pigweed/repo/pw_bloat/py/no_bloaty.py [deleted file]
third_party/pigweed/repo/pw_bloat/py/no_toolchains.py [deleted file]
third_party/pigweed/repo/pw_build/python_script.gni [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/BUILD [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/BUILD.gn [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/CMakeLists.txt [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/cpu_state.cc [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/docs.rst [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/entry.cc [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/exception_entry_test.cc [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/proto_dump.cc [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/public/pw_cpu_exception_armv7m/cpu_state.h [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/public/pw_cpu_exception_armv7m/proto_dump.h [deleted file]
third_party/pigweed/repo/pw_cpu_exception_armv7m/pw_cpu_exception_armv7m_protos/cpu_state.proto [deleted file]
third_party/pigweed/repo/pw_docgen/py/docgen.py [deleted file]
third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/requirements.in [deleted file]
third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/requirements.txt [deleted file]
third_party/pigweed/repo/pw_fuzzer/examples/build_and_run_toy_fuzzer.sh [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/BUILD [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/BUILD.gn [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/decoder.cc [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/decoder_test.cc [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/docs.rst [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/encoder.cc [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/encoder_test.cc [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/decoder.h [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/encoder.h [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/rpc_channel.h [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/rpc_packets.h [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/sys_io_stream.h [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/pw_hdlc_lite_private/protocol.h [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/decode_test.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/encode_test.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/decode.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/encode.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/protocol.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/rpc.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/rpc_console.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/py/setup.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_channel_test.cc [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_example/BUILD [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_example/BUILD.gn [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_example/docs.rst [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_example/example_script.py [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_example/hdlc_rpc_server.cc [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_example/main.cc [deleted file]
third_party/pigweed/repo/pw_hdlc_lite/rpc_packets.cc [deleted file]
third_party/pigweed/repo/pw_log_rpc/log_queue.cc [deleted file]
third_party/pigweed/repo/pw_log_rpc/log_queue_test.cc [deleted file]
third_party/pigweed/repo/pw_log_rpc/public/pw_log_rpc/log_queue.h [deleted file]
third_party/pigweed/repo/pw_log_rpc/pw_log_rpc_proto/log.proto [deleted file]
third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/full_test.proto [deleted file]
third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/imported.proto [deleted file]
third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/importer.proto [deleted file]
third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/non_pw_package.proto [deleted file]
third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/proto2.proto [deleted file]
third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/repeated.proto [deleted file]
third_party/pigweed/repo/pw_protobuf_compiler/pw_protobuf_compiler_protos/nanopb_test.proto [deleted file]
third_party/pigweed/repo/pw_protobuf_compiler/py/pw_protobuf_compiler/generator_not_selected.py [deleted file]
third_party/pigweed/repo/pw_rpc/nanopb/public/pw_rpc/internal/service_method_traits.h [deleted file]
third_party/pigweed/repo/pw_rpc/nanopb/public/pw_rpc/test_method_context.h [deleted file]
third_party/pigweed/repo/pw_rpc/nanopb/service_method_traits_test.cc [deleted file]
third_party/pigweed/repo/pw_rpc/pw_rpc_protos/packet.proto [deleted file]
third_party/pigweed/repo/pw_rpc/py/codegen_test.py [deleted file]
third_party/pigweed/repo/pw_rpc/py/pw_rpc/packet_pb2.py [deleted file]
third_party/pigweed/repo/pw_rpc/py/pw_rpc/packet_pb2.pyi [deleted file]
third_party/pigweed/repo/pw_status/py/pw_status/update_style.py [deleted file]
third_party/pigweed/repo/pw_target_runner/pw_target_runner_protos/exec_server_config.proto [deleted file]
third_party/pigweed/repo/pw_tokenizer/public/pw_tokenizer/pw_tokenizer_65599_fixed_length_hash.h [deleted file]
third_party/pigweed/repo/pw_tokenizer/py/example_binary_with_tokenized_strings.elf [changed mode: 0644->0755]
third_party/pigweed/repo/pw_toolchain/dummy/bad_toolchain.py [deleted file]
third_party/pigweed/repo/targets/lm3s6965evb-qemu/vector_table.cc [deleted file]
third_party/pigweed/repo/targets/stm32f429i-disc1/vector_table.cc [deleted file]
third_party/qpg_sdk/repo/qpg6100/comps/libmbedtls/random_qorvo.h [deleted file]
tools/README.md [deleted file]

diff --git a/.gn b/.gn
index 19c0501..e3a67f1 100644 (file)
--- a/.gn
+++ b/.gn
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import("//build_overrides/build.gni")
+import("//build_overrides/pigweed.gni")
+
 # The location of the build configuration file.
-buildconfig = "//build/config/BUILDCONFIG.gn"
+buildconfig = "${build_root}/config/BUILDCONFIG.gn"
 
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-import("//build_overrides/pigweed.gni")
-
 script_executable = "python3"
 
 default_args = {
diff --git a/build/chip/python_gen_tags.py b/build/chip/python_gen_tags.py
deleted file mode 100644 (file)
index 7e2dd5e..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-# Utility script to genertae the python tag + the abi tag + platform tag for a Python
-
-try:
-  from setuptools import pep425tags
-except ImportError:
-  from wheel import pep425tags
-
-try:
-  platform_tag = pep425tags.get_platform(None)
-except TypeError:
-  platform_tag = pep425tags.get_platform()
-
-print(pep425tags.get_abbr_impl() + pep425tags.get_impl_ver() + "-" +
-      pep425tags.get_abi_tag() + "-" + platform_tag)
diff --git a/build_overrides/esp32.gni b/build_overrides/esp32.gni
deleted file mode 100644 (file)
index 3a2252c..0000000
+++ /dev/null
@@ -1,13 +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.
diff --git a/config/k32w/k32w061-app.mk b/config/k32w/k32w061-app.mk
deleted file mode 100755 (executable)
index 710f7f8..0000000
+++ /dev/null
@@ -1,400 +0,0 @@
-#
-#   Copyright (c) 2020 Project CHIP Authors
-#   Copyright (c) 2020 Google LLC.
-#   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.
-#
-
-#
-#   @file
-#         Common makefile definitions for building applications based
-#         on the NXP K32W061 SDK.
-#
-#
-#   This makefile is primarily intended to support building the
-#   CHIP example applications on NXP platforms.  However
-#   external developers should feel free to use it if they find
-#   it useful.
-#
-#   To build an application using this makefile, include the file
-#   in a project-specific Makefile, define make variables describing
-#   the application and how it should be built, and then call the
-#   GenerateBuildRules function.  E.g.:
-#
-#       PROJECT_ROOT = $(realpath .)
-#
-#       BUILD_SUPPORT_DIR = $(PROJECT_ROOT)/third_party/connectedhomeip/config/k32w061
-#
-#       include $(BUILD_SUPPORT_DIR)/k32w061-app.mk
-#
-#       APP := chip-k32w061-bringup
-#
-#       SRCS = \
-#           $(PROJECT_ROOT)/main.cpp \
-#           ...
-#
-#       INC_DIRS = \
-#           $(PROJECT_ROOT) \
-#           ...
-#
-#       LIBS = \
-#           ...
-#
-#       DEFINES = \
-#           ...
-#
-#       $(call GenerateBuildRules)
-#
-# ==================================================
-# Sanity Checks
-# ==================================================
-
-ifndef K32W061_SDK_ROOT
-$(error ENVIRONMENT ERROR: K32W061_SDK_ROOT not set)
-endif
-ifndef GNU_INSTALL_ROOT
-$(error ENVIRONMENT ERROR: GNU_INSTALL_ROOT not set)
-endif
-
-# ==================================================
-# General definitions
-# ==================================================
-
-.DEFAULT_GOAL := all
-
-APP_EXE = $(OUTPUT_DIR)/$(APP).out
-APP_ELF = $(OUTPUT_DIR)/$(APP).elf
-
-SRCS =
-ALL_SRCS = $(SRCS) $(EXTRA_SRCS)
-OBJS = $(foreach file,$(ALL_SRCS),$(call ObjFileName,$(file)))
-
-OUTPUT_DIR = $(PROJECT_ROOT)/build
-OBJS_DIR = $(OUTPUT_DIR)/objs
-DEPS_DIR = $(OUTPUT_DIR)/deps
-
-FLOAT_ABI = -mfloat-abi=soft
-
-STD_CFLAGS = \
-    -Wall \
-     $(FLOAT_ABI) \
-    -mcpu=cortex-m4 \
-    -mthumb \
-    -mabi=aapcs \
-    -ffunction-sections \
-    -fdata-sections \
-    -fno-strict-aliasing \
-    -fshort-enums \
-    --specs=nosys.specs
-
-STD_CXXFLAGS = \
-    -fno-rtti \
-    -fno-exceptions \
-    -fno-unwind-tables
-
-STD_ASFLAGS = \
-     $(FLOAT_ABI) \
-    -g3 \
-    -mcpu=cortex-m4 \
-    -mthumb \
-    -mabi=aapcs \
-    -x assembler-with-cpp
-
-STD_LDFLAGS = \
-     $(FLOAT_ABI) \
-    -mthumb \
-    -mabi=aapcs \
-    -mcpu=cortex-m4 \
-    -Wl,--gc-sections \
-    --specs=nosys.specs \
-    $(foreach dir,$(LINKER_SCRIPT_INC_DIRS),-L$(dir)) \
-    -T$(LINKER_SCRIPT)
-
-STD_LIBS = \
-    -lc \
-    -lstdc++ \
-    -lnosys \
-    -lm
-
-STD_INC_DIRS += \
-    $(K32W061_SDK_ROOT)/CMSIS/Include                                                       \
-    $(K32W061_SDK_ROOT)/devices/K32W061                                                     \
-    $(K32W061_SDK_ROOT)/devices/K32W061/drivers                                             \
-    $(K32W061_SDK_ROOT)/devices/K32W061/utilities                                           \
-    $(K32W061_SDK_ROOT)/devices/K32W061/utilities/debug_console                             \
-    $(K32W061_SDK_ROOT)/devices/K32W061/utilities/str                                       \
-    $(CHIP_ROOT)/src/platform/K32W
-
-STD_DEFINES = \
-    HAVE_CONFIG_H
-
-STD_COMPILE_PREREQUISITES = k32w061-sdk-check
-
-STD_LINK_PREREQUISITES = k32w061-sdk-check
-
-DEFINE_FLAGS = $(foreach def,$(STD_DEFINES) $(DEFINES),-D$(def))
-
-INC_FLAGS = $(foreach dir,$(INC_DIRS) $(STD_INC_DIRS),-I$(dir))
-
-LINKER_SCRIPT = $(realpath $(PROJECT_ROOT))/$(APP).ld
-
-LINKER_SCRIPT_INC_DIRS =
-
-K32W061_SDK_TITLE = K32W061 SDK for Thread
-
-# ==================================================
-# Toolchain and external utilities / files
-# ==================================================
-
-TARGET_TUPLE = arm-none-eabi
-
-CC      = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-gcc
-CXX     = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-c++
-CPP     = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-cpp
-AS      = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-as
-AR      = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-ar
-LD      = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-ld
-NM      = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-nm
-OBJDUMP = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-objdump
-OBJCOPY = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-objcopy
-SIZE    = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-size
-RANLIB  = $(GNU_INSTALL_ROOT)/$(TARGET_TUPLE)-ranlib
-
-INSTALL = /usr/bin/install
-INSTALLFLAGS = -C -v
-
-ifneq (, $(shell which ccache))
-CCACHE = ccache
-endif
-
-K32W061_PROG = $(K32W061_SDK_ROOT)/tools/imagetool/DK6Programmer.exe
-
-# ==================================================
-# Build options
-# ==================================================
-
-DEBUG ?= 1
-OPT ?= 1
-VERBOSE = 0
-
-ifeq ($(VERBOSE),1)
-  NO_ECHO :=
-  HDR_PREFIX := ====================
-else
-  NO_ECHO := @
-  HDR_PREFIX :=
-endif
-
-ifeq ($(DEBUG),1)
-DEBUG_FLAGS = -g3 -ggdb3
-else
-DEBUG_FLAGS = -g0
-endif
-
-ifeq ($(OPT),1)
-OPT_FLAGS = -Os
-else
-OPT_FLAGS = -Og
-endif
-
-K32W061_PROG_FLAGS ?= -P 1000000 -V 0
-
-# ==================================================
-# Utility definitions
-# ==================================================
-
-# Convert source file name to object file name
-define ObjFileName
-$(OBJS_DIR)/$(notdir $1).o
-endef
-
-# Convert source file name to dependency file name
-define DepFileName
-$(DEPS_DIR)/$(notdir $1).d
-endef
-
-# Newline
-define NL
-
-endef
-# ==================================================
-# General build rules
-# ==================================================
-.PHONY : $(APP) flash flash-app flash_app erase clean help k32w061-sdk-check
-
-%.elf : %.out
-       $(K32W061_SDK_ROOT)/tools/imagetool/sign_images.sh $(OUTPUT_DIR)
-       $(NO_ECHO)mv $< $@
-       rm -rf $<.bin
-       rm -rf $@.bin
-
-# Flash the SoftDevice
-flash-softdevice flash_softdevice :
-       @echo "FLASH $$(APP_ELF)"
-       $(NO_ECHO)$(K32W061_PROG) -l
-       $(NO_ECHO)read -p "Please type a COM from the above list:" COM; \
-       $(K32W061_PROG) $(K32W061_PROG_FLAGS) -s $COM -p $(APP_ELF) || true
-
-# Erase device
-erase :
-       @echo "ERASE DEVICE"
-       $(NO_ECHO)$(K32W061_PROG) -l
-       $(NO_ECHO)read -p "Please type a COM from the above list:" COM; \
-       $(K32W061_PROG) -s $COM -e || true
-
-# Clean build output
-clean ::
-       @echo "RM $(OUTPUT_DIR)"
-       $(NO_ECHO)rm -rf $(OUTPUT_DIR)
-
-# Print help
-export HelpText
-help :
-       @echo "$${HelpText}"
-
-# Verify the K32W061 SDK is found
-k32w061-sdk-check :
-       @test -d $(K32W061_SDK_ROOT) || { \
-           echo "ENVIRONMENT ERROR: ${K32W061_SDK_TITLE} not found at $(K32W061_SDK_ROOT)"; \
-           exit 1; \
-       };
-# ==================================================
-# Late-bound rules for building the application
-# ==================================================
-
-define AppBuildRules
-
-# Default all rule
-all : $(APP)
-
-# General target for building the application
-$(APP) : $(APP_ELF)
-
-# Rule to link the application executable
-$(APP_EXE) : $(OBJS) $(STD_LINK_PREREQUISITES) | $(OUTPUT_DIR)
-       @echo "$$(HDR_PREFIX)LD $$@"
-       $(NO_ECHO)$$(CC) $$(STD_LDFLAGS) $$(LDFLAGS) $$(DEBUG_FLAGS) $$(OPT_FLAGS) -Wl,-Map=$$(@:.out=.map) $$(OBJS) -Wl,--start-group $$(LIBS) $$(STD_LIBS) -Wl,--end-group -o $$@
-       $(NO_ECHO)$$(SIZE) $$@
-
-# Individual build rules for each application source file
-$(foreach file,$(filter %.c,$(ALL_SRCS)),$(call CCRule,$(file)))
-$(foreach file,$(filter %.cpp,$(ALL_SRCS)),$(call CXXRule,$(file)))
-$(foreach file,$(filter %.S,$(ALL_SRCS)),$(call ASRule,$(file)))
-$(foreach file,$(filter %.s,$(ALL_SRCS)),$(call ASRule,$(file)))
-
-# Rule to build and flash the application
-flash : $(APP_ELF)
-       @echo "FLASH $$(APP_ELF)"
-       $(NO_ECHO)$(K32W061_PROG) -l
-       $(NO_ECHO)read -p "Please type a COM from the above list:" COM; \
-       $(K32W061_PROG) $(K32W061_PROG_FLAGS) -s $COM -p $(APP_ELF) || true
-
-# Rule to flash a pre-built application
-flash-app flash_app :
-       @echo "FLASH $$(APP_ELF)"
-       $(NO_ECHO)$(K32W061_PROG) -l
-       $(NO_ECHO)read -p "Please type a COM from the above list:" COM; \
-       $(K32W061_PROG) $(K32W061_PROG_FLAGS) -s $COM -p $(APP_ELF) || true
-
-# Rule to create the output directory / subdirectories
-$(OUTPUT_DIR) $(OBJS_DIR) $(DEPS_DIR) :
-       @echo "MKDIR $$@"
-       $(NO_ECHO)mkdir -p "$$@"
-
-# Include generated dependency files
-include $$(wildcard $(DEPS_DIR)/*.d)
-
-endef
-
-# Generates late-bound rule for building an object file from a C file
-define CCRule
-$(call DepFileName,$1) : ;
-$(call ObjFileName,$1): $1 $(call DepFileName,$1) | $(OBJS_DIR) $(DEPS_DIR) $(STD_COMPILE_PREREQUISITES)
-       @echo "$$(HDR_PREFIX)CC $1"
-       $(NO_ECHO) $$(CCACHE) $$(CC) -c $$(STD_CFLAGS) $$(CFLAGS) $$(DEBUG_FLAGS) $$(OPT_FLAGS) $$(DEFINE_FLAGS) $$(INC_FLAGS) -MT $$@ -MMD -MP -MF $(call DepFileName,$1).tmp -o $$@ $1
-       $(NO_ECHO)mv $(call DepFileName,$1).tmp $(call DepFileName,$1)
-$(NL)
-endef
-
-# Generates late-bound rule for building an object file from a C++ file
-define CXXRule
-$(call DepFileName,$1) : ;
-$(call ObjFileName,$1): $1 $(call DepFileName,$1) | $(OBJS_DIR) $(DEPS_DIR) $(STD_COMPILE_PREREQUISITES)
-       @echo "$$(HDR_PREFIX)CXX $1"
-       $(NO_ECHO) $$(CCACHE) $$(CXX) -c $$(AUTODEP_FLAGS) $$(STD_CFLAGS) $$(STD_CXXFLAGS) $$(CFLAGS) $$(CXXFLAGS) $$(DEBUG_FLAGS) $$(OPT_FLAGS) $$(DEFINE_FLAGS) $$(INC_FLAGS) -MT $$@ -MMD -MP -MF $(call DepFileName,$1).tmp -o $$@ $1
-       $(NO_ECHO)mv $(call DepFileName,$1).tmp $(call DepFileName,$1)
-$(NL)
-endef
-
-# Generates late-bound rule for building an object file from an assembly file
-define ASRule
-$(call ObjFileName,$1): $1 | $(OBJS_DIR) $(STD_COMPILE_PREREQUISITES)
-       @echo "$$(HDR_PREFIX)AS $1"
-       $(NO_ECHO)$$(CC) -c -x assembler-with-cpp $$(STD_ASFLAGS) $$(ASFLAGS) $$(DEBUG_FLAGS) $$(OPT_FLAGS) $$(DEFINE_FLAGS) $$(INC_FLAGS) -o $$@ $1
-$(NL)
-endef
-# ==================================================
-# Function for generating all late-bound rules
-# ==================================================
-
-# List of variables containing late-bound rules that should
-# be evaluated when GenerateBuildRules is called.
-LATE_BOUND_RULES = AppBuildRules
-
-define GenerateBuildRules
-$(foreach rule,$(LATE_BOUND_RULES),$(eval $($(rule))))
-endef
-# ==================================================
-# Help Definitions
-# ==================================================
-
-# Desciptions of make targets
-define TargetHelp
-  all                   Build the $(APP) application.
-
-  clean                 Clean all build outputs.
-
-  flash                 Build and flash the application onto the device.
-
-  flash-app             Flash the application onto the device without building
-                        it first.
-
-  flash-softdevice      Flash the NXP image onto the device.
-
-  erase                 Wipe the device's flash memory.
-
-  help                  Print this help message.
-endef
-
-# Desciptions of build options
-define OptionHelp
-  DEBUG=[1|0]           Build the application and all libraries with symbol
-                        information.
-
-  VERBOSE=[1|0]         Show commands as they are being executed.
-endef
-
-# Overall help text
-define HelpText
-Makefile for building the $(APP) application.
-
-Available targets:
-
-$(TargetHelp)
-
-Build options:
-
-$(OptionHelp)
-
-endef
diff --git a/config/k32w/k32w061-chip.mk b/config/k32w/k32w061-chip.mk
deleted file mode 100755 (executable)
index 16cd1cc..0000000
+++ /dev/null
@@ -1,252 +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.
-#
-
-#
-#   @file
-#         Component makefile for incorporating CHIP into a k32w061
-#         application.
-#
-#   This makefile is intended to work in conjunction with the k32w061-app.mk
-#   makefile to build the CHIP example applications on NXP platforms.
-#   k32w061 applications should include this file in their top level Makefile
-#   after including k32w061-app.mk.  E.g.:
-#
-#       PROJECT_ROOT = $(realpath .)
-#
-#       BUILD_SUPPORT_DIR = $(PROJECT_ROOT)/third_party/connectedhomeip/config/k32w
-#
-#       include $(BUILD_SUPPORT_DIR)/k32w061-app.mk
-#       include $(BUILD_SUPPORT_DIR)/k32w061-chip.mk
-#
-#       PROJECT_ROOT := $(realpath .)
-#
-#       APP := chip-k32w061-bringup
-#
-#       SRCS = \
-#           $(PROJECT_ROOT)/main.cpp \
-#           ...
-#
-#       $(call GenerateBuildRules)
-#
-# ==================================================
-# General settings
-# ==================================================
-
-# Location of CHIP source tree
-CHIP_ROOT ?= $(PROJECT_ROOT)/third_party/connectedhomeip
-
-# Archtecture for which CHIP will be built.
-CHIP_HOST_ARCH := armv7-unknown-linux-gnu
-
-# Directory into which the CHIP build system will place its output.
-CHIP_OUTPUT_DIR = $(OUTPUT_DIR)/chip
-
-# An optional file containing application-specific configuration overrides.
-CHIP_PROJECT_CONFIG = $(wildcard $(PROJECT_ROOT)/include/CHIPProjectConfig.h)
-
-# Architcture on which CHIP is being built.
-CHIP_BUILD_ARCH = $(shell $(CHIP_ROOT)/third_party/nlbuild-autotools/repo/third_party/autoconf/config.guess | sed -e 's/[[:digit:].]*$$//g')
-
-# ==================================================
-# Compilation flags specific to building CHIP
-# ==================================================
-
-CHIP_DEFINES +=                                                                                                                    \
-    MBEDTLS_CONFIG_FILE=\<$(CHIP_ROOT)/third_party/openthread/repo/third_party/mbedtls/mbedtls-config.h\>                          \
-    MBEDTLS_USER_CONFIG_FILE=\<$(CHIP_ROOT)/third_party/openthread/repo/examples/platforms/k32w/k32w061/k32w061-mbedtls-config.h\> \
-    MBEDTLS_THREADING_C=1                                                                                                          \
-    MBEDTLS_THREADING_ALT=1                                                                                                        \
-    MBEDTLS_X509_CSR_WRITE_C                                                                                                       \
-    MBEDTLS_X509_CREATE_C                                                                                                          \
-    MBEDTLS_PK_WRITE_C                                                                                                             \
-    MBEDTLS_OID_C                                                                                                                  \
-    MBEDTLS_PEM_WRITE_C                                                                                                            \
-    MBEDTLS_BASE64_C                                                                                                               \
-    MBEDTLS_SSL_COOKIE_C                                                                                                           \
-    MBEDTLS_HKDF_C                                                                                                                 \
-    MBEDTLS_SSL_SRV_C                                                                                                              \
-    MBEDTLS_ERROR_C
-
-CHIP_DEFINE_FLAGS = $(foreach def,$(CHIP_DEFINES),-D$(def))
-CHIP_CPPFLAGS = $(STD_CFLAGS) $(CFLAGS) $(DEBUG_FLAGS) $(OPT_FLAGS) $(DEFINE_FLAGS) $(CHIP_DEFINE_FLAGS) $(INC_FLAGS)
-CHIP_CXXFLAGS = $(STD_CXXFLAGS) $(CXXFLAGS)
-
-# ==================================================
-# CHIP configuration options
-# ==================================================
-
-CHIP_CONFIGURE_OPTIONS = \
-    -C AR="$(AR)" AS="$(AS)" CC="$(CCACHE) $(CC)" CXX="$(CCACHE) $(CXX)"                                                               \
-    LD="$(LD)" OBJCOPY="$(OBJCOPY)" RANLIB="$(RANLIB)" INSTALL="$(INSTALL) $(INSTALLFLAGS)"                                            \
-    CPPFLAGS="$(CHIP_CPPFLAGS) -imacros $(CHIP_ROOT)/third_party/openthread/repo/examples/platforms/k32w/k32w061/k32w061-sdk-config.h" \
-    CXXFLAGS="$(CHIP_CXXFLAGS)"                                                                                                        \
-    --prefix=$(CHIP_OUTPUT_DIR)                                                                                                        \
-    --exec-prefix=$(CHIP_OUTPUT_DIR)                                                                                                   \
-    --host=$(CHIP_HOST_ARCH)                                                                                                           \
-    --build=$(CHIP_BUILD_ARCH)                                                                                                         \
-    --with-target-style=embedded                                                                                                       \
-    --with-device-layer=k32w                                                                                                           \
-    --with-network-layer=all                                                                                                           \
-    --with-target-network=lwip                                                                                                         \
-    --with-lwip=internal                                                                                                               \
-    --with-lwip-target=k32w                                                                                                            \
-    --with-inet-endpoint="tcp udp"                                                                                                     \
-    --with-openssl=no                                                                                                                  \
-    --with-openthread=internal                                                                                                         \
-    --with-logging-style=external                                                                                                      \
-    --with-chip-project-includes=$(CHIP_PROJECT_CONFIG)                                                                                \
-    --with-chip-system-project-includes=$(CHIP_PROJECT_CONFIG)                                                                         \
-    --with-chip-inet-project-includes=$(CHIP_PROJECT_CONFIG)                                                                           \
-    --with-chip-ble-project-includes=$(CHIP_PROJECT_CONFIG)                                                                            \
-    --with-chip-warm-project-includes=$(CHIP_PROJECT_CONFIG)                                                                           \
-    --with-chip-device-project-includes=$(CHIP_PROJECT_CONFIG)                                                                         \
-    --disable-ipv4                                                                                                                     \
-    --disable-tests                                                                                                                    \
-    --disable-tools                                                                                                                    \
-    --disable-docs                                                                                                                     \
-    --disable-java                                                                                                                     \
-    --disable-device-manager                                                                                                           \
-    --with-crypto=mbedtls
-
-# Enable / disable optimization.
-ifeq ($(OPT),1)
-CHIP_CONFIGURE_OPTIONS += --enable-optimization=yes
-else
-CHIP_CONFIGURE_OPTIONS += --enable-optimization=no
-endif
-
-ifeq ($(DEBUG),1)
-CHIP_CONFIGURE_OPTIONS += --enable-debug
-endif
-# ==================================================
-# Adjustments to standard build settings to
-#   incorporate CHIP
-# ==================================================
-
-# Add CHIP-specific paths to the standard include directories.
-STD_INC_DIRS +=                                                                                      \
-    $(CHIP_OUTPUT_DIR)/include                                                                       \
-    $(CHIP_OUTPUT_DIR)/src/include                                                                   \
-    $(CHIP_OUTPUT_DIR)/third_party/openthread/include                                                \
-    $(CHIP_ROOT)/third_party/lwip/repo/lwip/src/include                                              \
-    $(CHIP_ROOT)/third_party/openthread/repo/third_party/nxp/K32W061DK6/middleware/mbedtls/port/ksdk \
-    $(CHIP_ROOT)/src/lwip                                                                            \
-    $(CHIP_ROOT)/src/lwip/k32w                                                                       \
-    $(CHIP_ROOT)/src/lwip/freertos                                                                   \
-    $(K32W061_SDK_ROOT)/CMSIS/Include                                                                \
-    $(K32W061_SDK_ROOT)/devices/K32W061                                                              \
-    $(K32W061_SDK_ROOT)/devices/K32W061/drivers                                                      \
-    $(K32W061_SDK_ROOT)/devices/K32W061/utilities                                                    \
-    $(K32W061_SDK_ROOT)/devices/K32W061/utilities/debug_console                                      \
-    $(K32W061_SDK_ROOT)/devices/K32W061/utilities/str                                                \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Common                                         \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Lists                                          \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/PDM/Include                                    \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/MemManager/Interface                           \
-    $(CHIP_ROOT)/third_party/openthread/repo/examples/platforms
-
-# Add the location of CHIP libraries to application link action.
-STD_LDFLAGS += -L$(CHIP_OUTPUT_DIR)/lib
-
-# Add CHIP libraries to standard libraries list.
-STD_LIBS +=       \
-    -lDeviceLayer \
-    -lCHIP        \
-    -lInetLayer   \
-    -lSystemLayer \
-    -llwip        \
-    -lmbedtls
-
-# Add the appropriate CHIP target as a prerequisite to all application
-# compilation targets to ensure that CHIP gets built and its header
-# files installed prior to compiling any dependent source files.
-STD_COMPILE_PREREQUISITES += install-chip
-
-# Add the CHIP libraries as prerequisites for linking the application.
-STD_LINK_PREREQUISITES +=                   \
-    $(CHIP_OUTPUT_DIR)/lib/libDeviceLayer.a \
-    $(CHIP_OUTPUT_DIR)/lib/libCHIP.a        \
-    $(CHIP_OUTPUT_DIR)/lib/libInetLayer.a   \
-    $(CHIP_OUTPUT_DIR)/lib/libSystemLayer.a \
-    $(CHIP_OUTPUT_DIR)/lib/liblwip.a        \
-    $(CHIP_OUTPUT_DIR)/lib/libmbedtls.a
-
-# ==================================================
-# Late-bound build rules for CHIP
-# ==================================================
-
-# Add CHIPBuildRules to the list of late-bound build rules that
-# will be evaluated when GenerateBuildRules is called.
-LATE_BOUND_RULES += CHIPBuildRules
-
-# Rules for configuring, building and installing CHIP.
-define CHIPBuildRules
-
-.PHONY : config-chip .check-config-chip build-chip install-chip clean-chip
-
-.check-config-chip : | $(CHIP_OUTPUT_DIR)
-       $(NO_ECHO)echo $(CHIP_ROOT)/configure $(CHIP_CONFIGURE_OPTIONS) > $(CHIP_OUTPUT_DIR)/config.args.tmp; \
-       (test -r $(CHIP_OUTPUT_DIR)/config.args && cmp -s $(CHIP_OUTPUT_DIR)/config.args.tmp $(CHIP_OUTPUT_DIR)/config.args) || \
-           mv $(CHIP_OUTPUT_DIR)/config.args.tmp $(CHIP_OUTPUT_DIR)/config.args; \
-        rm -f $(CHIP_OUTPUT_DIR)/config.args.tmp;
-
-$(CHIP_OUTPUT_DIR)/config.args : .check-config-chip
-       @: # Null action required to work around make's crazy timestamp caching behavior.
-
-$(CHIP_ROOT)/configure : $(CHIP_ROOT)/configure.ac
-       @echo "$(HDR_PREFIX)BOOTSTRAP CHIP..."
-       $(NO_ECHO)(cd $(CHIP_ROOT) && ./bootstrap)
-
-$(CHIP_OUTPUT_DIR)/config.status : $(CHIP_ROOT)/configure $(CHIP_OUTPUT_DIR)/config.args
-       @echo "$(HDR_PREFIX)CONFIGURE CHIP..."
-       $(NO_ECHO)(cd $(CHIP_OUTPUT_DIR) && $(CHIP_ROOT)/configure $(CHIP_CONFIGURE_OPTIONS))
-
-config-chip : $(CHIP_OUTPUT_DIR)/config.status | $(OPENTHREAD_PREREQUISITE)
-
-build-chip : config-chip
-       @echo "$(HDR_PREFIX)BUILD CHIP..."
-       $(NO_ECHO)MAKEFLAGS= make -C $(CHIP_OUTPUT_DIR) --no-print-directory all V=$(VERBOSE)
-
-install-chip : | build-chip
-       @echo "$(HDR_PREFIX)INSTALL CHIP..."
-       $(NO_ECHO)MAKEFLAGS= make -C $(CHIP_OUTPUT_DIR) --no-print-directory install V=$(VERBOSE)
-
-clean-chip:
-       @echo "$(HDR_PREFIX)RM $(CHIP_OUTPUT_DIR)"
-       $(NO_ECHO)rm -rf $(CHIP_OUTPUT_DIR)
-
-$(CHIP_OUTPUT_DIR) :
-       @echo "$(HDR_PREFIX)MKDIR $$@"
-       $(NO_ECHO)mkdir -p "$$@"
-
-endef
-# ==================================================
-# CHIP-specific help definitions
-# ==================================================
-
-define TargetHelp +=
-
-
-  config-chip          Run the CHIP configure script.
-
-  build-chip           Build the CHIP libraries.
-
-  install-chip         Install CHIP libraries and headers in
-                        build output directory for use by application.
-
-  clean-chip           Clean all build outputs produced by the CHIP
-                        build process.
-endef
diff --git a/config/nrfconnect/.gn b/config/nrfconnect/.gn
deleted file mode 100644 (file)
index cafc14f..0000000
+++ /dev/null
@@ -1,26 +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.
-
-# The location of the build configuration file.
-buildconfig = "//build/config/BUILDCONFIG.gn"
-
-# CHIP uses angle bracket includes.
-check_system_includes = true
-
-default_args = {
-  target_cpu = "arm"
-  target_os = "zephyr"
-
-  import("//args.gni")
-}
diff --git a/config/nrfconnect/.nrfconnect-recommended-revision b/config/nrfconnect/.nrfconnect-recommended-revision
new file mode 100644 (file)
index 0000000..56e6871
--- /dev/null
@@ -0,0 +1 @@
+8e8c60897eac40f61db9f578ce521970fff8e4d2
diff --git a/config/nrfconnect/BUILD.gn b/config/nrfconnect/BUILD.gn
deleted file mode 100644 (file)
index 08db147..0000000
+++ /dev/null
@@ -1,49 +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.
-
-import("//build_overrides/chip.gni")
-
-import("//${chip_root}/build/chip/tests.gni")
-
-assert(current_os == "zephyr")
-
-declare_args() {
-  chip_build_libshell = false
-  chip_build_pw_rpc_lib = false
-}
-
-group("dummy") {
-}
-
-group("nrfconnect") {
-  deps = [ "${chip_root}/src/lib" ]
-
-  if (chip_build_libshell) {
-    deps += [ "${chip_root}/src/lib/shell" ]
-  }
-
-  # Building PW_RPC lib with GN may go obsolete after getting full CMake
-  # support in Pigweed.
-  if (chip_build_pw_rpc_lib) {
-    deps += [ "${chip_root}/config/nrfconnect/lib/pw_rpc" ]
-  }
-}
-
-group("default") {
-  deps = [ ":nrfconnect" ]
-
-  if (chip_build_tests) {
-    deps += [ "${chip_root}/src:tests" ]
-  }
-}
diff --git a/config/nrfconnect/Kconfig b/config/nrfconnect/Kconfig
deleted file mode 100644 (file)
index ed96994..0000000
+++ /dev/null
@@ -1,75 +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.
-#
-
-mainmenu "CHIP application"
-
-source "Kconfig.zephyr"
-
-config CHIP
-       bool "Enable CHIP"
-       default n
-       select CPLUSPLUS
-       imply LIB_CPLUSPLUS
-       imply REBOOT
-       select ENTROPY_GENERATOR
-       imply NET_UDP
-       imply NET_IPV6
-       imply NET_CONFIG_NEED_IPV6
-       imply NET_SOCKETS
-       imply MULTIPROTOCOL
-       help
-         Use the CHIP protocol.
-
-config CHIP_LIB_SHELL
-       bool "Enable CHIP's shell library"
-       help
-         Link the application with the library containing CHIP shell commands
-
-config CHIP_PW_RPC
-       bool "Enable Pigweed RPC library"
-       help
-         Link the application with the library containing Pigweed RPC functionalities
-
-config MULTIPROTOCOL
-       bool "Enable multiprotocol support"
-       select NRF_802154_MULTIPROTOCOL_SUPPORT
-       depends on BT && NET_L2_OPENTHREAD
-       help
-         Enable multiprotocol in the nRF 802.15.4 radio driver
-
-config CHIP_DISABLE_CHIPOBLE_ADVERTISING_WHEN_PROVISIONED
-       bool "Disable CHIPoBLE advertising when device is fully provisioned"
-       default y
-       help
-         Enables CHIPoBLE advertising disabling when the device achieves a fully provisioned state.
-
-config CHIP_ENABLE_CHIPOBLE_ADVERTISING_AUTOSTART
-       bool "Enable CHIPoBLE advertising autostart"
-       default n
-       help
-         Enables starting CHIPoBLE advertising automatically after application boot.
-
-config CHIP_NFC_COMMISSIONING
-       bool "Enable NFC commissioning support"
-       default n
-       imply NFC_T2T_NRFXLIB
-       imply NFC_NDEF
-       imply NFC_NDEF_MSG
-       imply NFC_NDEF_RECORD
-       imply NFC_NDEF_URI_REC
-       imply NFC_NDEF_URI_MSG
-       help
-         Enables NFC commissioning by sharing onboarding payload in NFC tag.
@@ -1,5 +1,5 @@
 #
-#   Copyright (c) 2020 Project CHIP Authors
+#   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.
 #   limitations under the License.
 #
 
-CONFIG_GPIO=y
-
-CONFIG_USB=y
-CONFIG_USB_DEVICE_STACK=y
-CONFIG_USB_UART_CONSOLE=y
-
-CONFIG_UART_INTERRUPT_DRIVEN=y
-CONFIG_UART_LINE_CTRL=y
-CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0"
+find_package(Python3 REQUIRED)
+add_custom_target(check-nrfconnect-version ALL
+    WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../..
+    COMMAND ${Python3_EXECUTABLE} scripts/setup/nrfconnect/update_ncs.py --check --quiet || (exit 0)
+    USES_TERMINAL)
diff --git a/config/nrfconnect/args.gni b/config/nrfconnect/args.gni
deleted file mode 100644 (file)
index e19a218..0000000
+++ /dev/null
@@ -1,31 +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.
-
-import("//build_overrides/chip.gni")
-import("//lib/pw_rpc/pw_rpc.gni")
-
-nrfconnect_target = get_label_info(":nrfconnect", "label_no_toolchain")
-
-chip_device_platform = "nrfconnect"
-chip_logging_style = "external"
-
-chip_config_network_layer_ble = true
-
-chip_build_tests = false
-
-chip_project_config_include = ""
-chip_system_project_config_include = ""
-
-custom_toolchain = "//toolchain:zephyr"
-mbedtls_target = "//:dummy"
diff --git a/config/nrfconnect/build b/config/nrfconnect/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/config/nrfconnect/build_overrides b/config/nrfconnect/build_overrides
deleted file mode 120000 (symlink)
index aea3e8d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../examples/build_overrides
\ No newline at end of file
diff --git a/config/nrfconnect/chip-lib.cmake b/config/nrfconnect/chip-lib.cmake
deleted file mode 100644 (file)
index 8d04bee..0000000
+++ /dev/null
@@ -1,210 +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.
-#
-
-#
-#   @file
-#         CMake module for configuring and building CHIP libraries to be used
-#         in Zephyr applications.
-#
-#   It is assumed that at this point:
-#    - CHIP_ROOT is defined
-#    - find_package(Zephyr) has been called
-#
-
-# ==================================================
-# Helpers & settings
-# ==================================================
-
-include(ExternalProject)
-
-# Directory for CHIP build artifacts
-set(CHIP_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/chip")
-
-# Define Zephyr C/C++ compiler flags which should not be forwarded to CHIP
-# build system (e.g. because CHIP configures them on its own).
-set(CHIP_CFLAG_EXCLUDES 
-    "-fno-asynchronous-unwind-tables"
-    "-fno-common"
-    "-fno-defer-pop"
-    "-fno-reorder-functions"
-    "-ffunction-sections"
-    "-fdata-sections"
-    "-g*"
-    "-O*"
-    "-W*"
-)
-
-macro(chip_gn_arg_bool_if CONDITION ARGSTRING GN_VARNAME)
-    if (${CONDITION})
-        string(APPEND ${ARGSTRING} "${GN_VARNAME} = true\n")
-    else ()
-        string(APPEND ${ARGSTRING} "${GN_VARNAME} = false\n")
-    endif()
-endmacro()
-
-macro(chip_gn_arg_string ARGSTRING GN_STRING)
-    string(APPEND ${ARGSTRING} "${GN_STRING}\n")
-endmacro()
-
-macro(chip_gn_arg_cflags ARGSTRING ARG CFLAGS)
-    set(CFLAG_EXCLUDES "[")
-    foreach(cflag ${CHIP_CFLAG_EXCLUDES})
-        string(APPEND CFLAG_EXCLUDES "\"${cflag}\", ")
-    endforeach()
-    string(APPEND CFLAG_EXCLUDES "]")
-    string(APPEND ${ARGSTRING} "${ARG} = filter_exclude(string_split(\"${CFLAGS}\"), ${CFLAG_EXCLUDES})\n")
-endmacro()
-
-# Function to retrieve Zephyr compilation flags for the given language (C or CXX)
-function(zephyr_get_compile_flags VAR LANG)
-    # We want to treat all zephyr-provided headers as system headers, so
-    # warnings in them don't trigger -Werror.  That means that for the headers
-    # zephyr returns as "non-system" headers (the ones from
-    # zephyr_get_include_directories_for_lang) we need to manually replace "-I"
-    # with "-isystem" before adding them to INCLUDES.
-    set(temp_includes "")
-    zephyr_get_include_directories_for_lang(${LANG} temp_includes)
-    foreach(include ${temp_includes})
-      string(REPLACE "-I" "-isystem" include ${include})
-      list(APPEND INCLUDES ${include})
-    endforeach()
-
-    zephyr_get_system_include_directories_for_lang(${LANG} SYSTEM_INCLUDES)
-    zephyr_get_compile_definitions_for_lang(${LANG} DEFINES)
-    zephyr_get_compile_options_for_lang(${LANG} FLAGS)
-    set(${VAR} ${INCLUDES} ${SYSTEM_INCLUDES} ${DEFINES} ${FLAGS} ${${VAR}} PARENT_SCOPE)
-endfunction()
-
-function(chip_select_cpp_standard VAR)
-    if (CONFIG_STD_CPP11)
-        set(${VAR} -std=gnu++11 PARENT_SCOPE)
-    elseif (CONFIG_STD_CPP14)
-        set(${VAR} -std=gnu++14 PARENT_SCOPE)
-    elseif (CONFIG_STD_CPP17)
-        set(${VAR} -std=gnu++17 PARENT_SCOPE)
-    elseif (CONFIG_STD_CPP2A)
-        set(${VAR} -std=gnu++20 PARENT_SCOPE)
-    else()
-        message(FATAL_ERROR "Building with unsupported C++ standard")
-    endif()
-endfunction()
-
-# ==================================================
-# Define chip configuration target
-# ==================================================
-
-function(chip_configure TARGET_NAME)
-    cmake_parse_arguments(CHIP
-                          "BUILD_TESTS"
-                          "PROJECT_CONFIG"
-                          "CFLAGS;CXXFLAGS"
-                          ${ARGN})
-
-    # Prepare CFLAGS & CXXFLAGS
-    zephyr_get_compile_flags(CHIP_CFLAGS C)
-    convert_list_of_flags_to_string_of_flags(CHIP_CFLAGS CHIP_CFLAGS)
-
-    zephyr_get_compile_flags(CHIP_CXXFLAGS CXX)
-    list(FILTER CHIP_CXXFLAGS EXCLUDE REGEX -std.*)
-    chip_select_cpp_standard(CHIP_CXX_STANDARD)
-    list(APPEND CHIP_CXXFLAGS ${CHIP_CXX_STANDARD})
-    convert_list_of_flags_to_string_of_flags(CHIP_CXXFLAGS CHIP_CXXFLAGS)
-
-    set(GN_ARGS "")
-    chip_gn_arg_cflags(GN_ARGS "target_cflags_c" ${CHIP_CFLAGS})
-    chip_gn_arg_cflags(GN_ARGS "target_cflags_cc" ${CHIP_CXXFLAGS})
-    chip_gn_arg_string(GN_ARGS "zephyr_ar = \"${CMAKE_AR}\"")
-    chip_gn_arg_string(GN_ARGS "zephyr_cc = \"${CMAKE_C_COMPILER}\"")
-    chip_gn_arg_string(GN_ARGS "zephyr_cxx = \"${CMAKE_CXX_COMPILER}\"")
-
-    if (CHIP_PROJECT_CONFIG)
-        chip_gn_arg_string(GN_ARGS "chip_project_config_include = \"<${CHIP_PROJECT_CONFIG}>\"")
-        chip_gn_arg_string(GN_ARGS "chip_system_project_config_include = \"<${CHIP_PROJECT_CONFIG}>\"")
-    endif ()
-
-    if (BOARD STREQUAL "native_posix")
-        chip_gn_arg_string(GN_ARGS "target_cpu = \"x86\"")
-    elseif (BOARD STREQUAL "native_posix_64")
-        chip_gn_arg_string(GN_ARGS "target_cpu = \"x64\"")
-    endif ()
-
-    chip_gn_arg_bool_if(CONFIG_NET_L2_OPENTHREAD GN_ARGS "chip_enable_openthread")
-    chip_gn_arg_bool_if(CONFIG_NET_IPV4          GN_ARGS "chip_inet_config_enable_ipv4")
-    chip_gn_arg_bool_if(CHIP_BUILD_TESTS         GN_ARGS "chip_build_tests")
-    chip_gn_arg_bool_if(CONFIG_DEBUG             GN_ARGS "is_debug")
-    chip_gn_arg_bool_if(CHIP_BUILD_TESTS         GN_ARGS "chip_inet_config_enable_raw_endpoint")
-    chip_gn_arg_bool_if(CHIP_BUILD_TESTS         GN_ARGS "chip_inet_config_enable_tcp_endpoint")
-    chip_gn_arg_bool_if(CHIP_BUILD_TESTS         GN_ARGS "chip_inet_config_enable_dns_resolver")
-    chip_gn_arg_bool_if(CONFIG_CHIP_LIB_SHELL    GN_ARGS "chip_build_libshell")
-    chip_gn_arg_bool_if(CONFIG_CHIP_PW_RPC       GN_ARGS "chip_build_pw_rpc_lib")
-
-    file(GENERATE OUTPUT ${CHIP_OUTPUT_DIR}/args.gn CONTENT "${GN_ARGS}")
-
-    # Define target
-    ExternalProject_Add(
-        ${TARGET_NAME}
-        PREFIX                  ${CHIP_OUTPUT_DIR}
-        SOURCE_DIR              ${CHIP_ROOT}
-        BINARY_DIR              ${CHIP_OUTPUT_DIR}
-        CONFIGURE_COMMAND       gn --root=${CHIP_ROOT}/config/nrfconnect gen --check --fail-on-unused-args ${CHIP_OUTPUT_DIR}
-        BUILD_COMMAND           ""
-        INSTALL_COMMAND         ""
-        BUILD_ALWAYS            TRUE
-        USES_TERMINAL_CONFIGURE TRUE
-    )
-endfunction()
-
-# ==================================================
-# Define chip build target
-# ==================================================
-
-function(chip_build TARGET_NAME BASE_TARGET_NAME)
-    cmake_parse_arguments(CHIP "" "" "BUILD_COMMAND;BUILD_ARTIFACTS" ${ARGN})
-
-    # Define build target
-    ExternalProject_Add(
-        ${TARGET_NAME}Build
-        PREFIX              ${CHIP_OUTPUT_DIR}
-        SOURCE_DIR          ${CHIP_ROOT}
-        BINARY_DIR          ${CHIP_OUTPUT_DIR}
-        CONFIGURE_COMMAND   ""
-        BUILD_COMMAND       ${CHIP_BUILD_COMMAND}
-        INSTALL_COMMAND     ""
-        BUILD_BYPRODUCTS    ${CHIP_BUILD_ARTIFACTS}
-        BUILD_ALWAYS        TRUE
-        USES_TERMINAL_BUILD TRUE
-    )
-
-    # Define interface library containing desired CHIP byproducts
-    add_library(${TARGET_NAME} INTERFACE)
-    target_include_directories(${TARGET_NAME} INTERFACE
-        ${CHIP_ROOT}/src
-        ${CHIP_ROOT}/src/app/util
-        ${CHIP_ROOT}/src/lib
-        ${CHIP_ROOT}/src/lib/core
-        ${CHIP_ROOT}/src/include
-        ${CHIP_ROOT}/third_party/nlassert/repo/include
-        ${CHIP_OUTPUT_DIR}/gen/include
-        ${CHIP_OUTPUT_DIR}/gen/third_party/connectedhomeip/src/lib/support/include
-        ${CHIP_OUTPUT_DIR}/gen/third_party/connectedhomeip/src/app/include
-    )
-    target_link_directories(${TARGET_NAME} INTERFACE ${CHIP_OUTPUT_DIR}/lib)
-    target_link_libraries(${TARGET_NAME} INTERFACE -Wl,--start-group ${CHIP_BUILD_ARTIFACTS} -Wl,--end-group)
-
-    add_dependencies(${TARGET_NAME}Build ${BASE_TARGET_NAME})
-    add_dependencies(${TARGET_NAME} ${TARGET_NAME}Build)
-    add_dependencies(${TARGET_NAME}Build kernel)
-endfunction()
index 84be44e..3feee96 100644 (file)
@@ -202,6 +202,10 @@ chip_gn_arg_bool  ("chip_inet_config_enable_dns_resolver"   CONFIG_CHIP_BUILD_TE
 chip_gn_arg_bool  ("chip_build_libshell"                    CONFIG_CHIP_LIB_SHELL)
 chip_gn_arg_bool  ("chip_build_pw_rpc_lib"                  CONFIG_CHIP_PW_RPC)
 
+if (CONFIG_CHIP_ENABLE_DNSSD_SRP)
+    chip_gn_arg_string("chip_mdns" "platform")
+endif()
+
 if (CHIP_PROJECT_CONFIG)
     chip_gn_arg_string("chip_project_config_include"        ${CHIP_PROJECT_CONFIG})
     chip_gn_arg_string("chip_system_project_config_include" ${CHIP_PROJECT_CONFIG})
diff --git a/config/nrfconnect/lib/pw_rpc/BUILD.gn b/config/nrfconnect/lib/pw_rpc/BUILD.gn
deleted file mode 100644 (file)
index b9870de..0000000
+++ /dev/null
@@ -1,37 +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.
-
-import("//build_overrides/chip.gni")
-import("//build_overrides/pigweed.gni")
-import("$dir_pw_build/target_types.gni")
-
-static_library("pw_rpc") {
-  output_name = "libPwRpc"
-
-  public_configs = [ "${dir_pigweed}/pw_hdlc_lite:default_config" ]
-  sources = [ "${dir_pigweed}/pw_hdlc_lite/rpc_example/hdlc_rpc_server.cc" ]
-  deps = [
-    "$dir_pw_rpc:server",
-    "$dir_pw_rpc/nanopb:echo_service",
-    "${chip_root}/examples/platform/nrfconnect/pw_sys_io:pw_sys_io_nrfconnect",
-    "${dir_pigweed}/pw_hdlc_lite:pw_rpc",
-    dir_pw_assert,
-    dir_pw_hdlc_lite,
-    dir_pw_log,
-  ]
-
-  output_dir = "${root_out_dir}/lib"
-
-  complete_static_lib = true
-}
diff --git a/config/nrfconnect/lib/pw_rpc/pw_rpc.gni b/config/nrfconnect/lib/pw_rpc/pw_rpc.gni
deleted file mode 100644 (file)
index ce3a908..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-import("//build_overrides/chip.gni")
-import("//build_overrides/pigweed.gni")
-
-pw_log_BACKEND = "$dir_pw_log_basic"
-pw_assert_BACKEND = "$dir_pw_assert_log"
-pw_sys_io_BACKEND =
-    "${chip_root}/examples/platform/nrfconnect/pw_sys_io:pw_sys_io_nrfconnect"
-
-dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo"
-pw_protobuf_GENERATORS = [
-  "pwpb",
-  "nanopb_rpc",
-]
diff --git a/config/nrfconnect/nrfconnect-app.cmake b/config/nrfconnect/nrfconnect-app.cmake
deleted file mode 100644 (file)
index 9f3f1d0..0000000
+++ /dev/null
@@ -1,143 +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.
-#
-
-#
-#   @file
-#         CMake module for incorporating CHIP into an nRF Connect SDK
-#         application for Nordic platforms.
-#
-
-#
-#   The top-level CMakeLists.txt of an application should define CHIP_ROOT variable,
-#   include this module and configure `app` build target properly. E.g.:
-#
-#   cmake_minimum_required(VERSION 3.13.1)
-#
-#   set(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip)
-#   get_filename_component(CHIP_ROOT ${CHIP_ROOT} REALPATH)
-#   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CHIP_ROOT}/config/nrfconnect/)
-#
-#   include(nrfconnect-app)
-#
-#   project(chip-nrf52840-lock-example)
-#   target_sources(app PRIVATE main/main.cpp ...)
-#
-
-# Set DTC overlay before finding the Zephyr package.
-if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/dts.overlay")
-    set(DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dts.overlay")
-endif()
-
-# Set Kconfig root
-if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Kconfig)
-    set(KCONFIG_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/Kconfig)
-else()
-    set(KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/Kconfig)
-endif()
-
-# ==================================================
-# Load NCS/Zephyr build system
-# ==================================================
-find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
-
-# TODO: temporary fix forcing time_t size to be equal long size - remove it after merging fix from Zephyr project.
-zephyr_compile_definitions(_USE_LONG_TIME_T)
-
-# ==================================================
-# General settings
-# ==================================================
-
-include(chip-lib)
-
-set(CHIP_COMMON_FLAGS
-    -D_SYS__PTHREADTYPES_H_
-    -DMBEDTLS_CONFIG_FILE=<nrf-config.h>
-    -DMBEDTLS_PK_WRITE_C
-    -DMBEDTLS_X509_CREATE_C
-    -DMBEDTLS_X509_CSR_WRITE_C
-    -isystem${ZEPHYR_BASE}/include/posix
-    -isystem${ZEPHYR_BASE}/../mbedtls/include
-    -I${CMAKE_CURRENT_SOURCE_DIR}
-    -I${CMAKE_CURRENT_SOURCE_DIR}/main/include
-)
-
-set(CHIP_LIBRARIES ${CHIP_OUTPUT_DIR}/lib/libCHIP.a)
-if (CONFIG_CHIP_LIB_SHELL)
-    list(APPEND CHIP_LIBRARIES ${CHIP_OUTPUT_DIR}/obj/third_party/connectedhomeip/src/lib/shell/lib/libCHIPShell.a)
-endif()
-if (CONFIG_CHIP_PW_RPC)
-    list(APPEND CHIP_LIBRARIES ${CHIP_OUTPUT_DIR}/lib/libPwRpc.a)
-endif()
-
-find_file(CHIP_PROJECT_CONFIG 
-    CHIPProjectConfig.h
-    PATHS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/main/include
-    NO_DEFAULT_PATH
-)
-
-# ==================================================
-# Configure Zephyr
-# ==================================================
-
-function(set_openthread_config OT_DIR CONFIG_FILE)
-    get_property(DEFINES DIRECTORY ${OT_DIR} PROPERTY COMPILE_DEFINITIONS)
-    get_property(SUBDIRS DIRECTORY ${OT_DIR} PROPERTY SUBDIRECTORIES)
-
-    list(TRANSFORM DEFINES REPLACE 
-         OPENTHREAD_PROJECT_CORE_CONFIG_FILE=.*
-         OPENTHREAD_PROJECT_CORE_CONFIG_FILE="${CONFIG_FILE}")
-
-    set_property(DIRECTORY ${OT_DIR} PROPERTY COMPILE_DEFINITIONS ${DEFINES})
-
-    foreach(SUBDIR ${SUBDIRS})
-        set_openthread_config(${SUBDIR} ${CONFIG_FILE})
-    endforeach()
-endfunction()
-
-# Add dependency on nRF crypto library.
-# This is temporary solution and should be removed after fixing it in nRF Connect SDK.
-zephyr_include_directories(${ZEPHYR_BASE}/../nrfxlib/crypto/nrf_cc310_platform/include)
-
-# Override Zephyr-supplied OpenThread configuration
-if (CHIP_OPENTHREAD_CONFIG)
-    get_filename_component(CONFIG_DIR ${CHIP_OPENTHREAD_CONFIG} DIRECTORY)
-    get_filename_component(CONFIG_FILE ${CHIP_OPENTHREAD_CONFIG} NAME)
-    target_include_directories(ot-config INTERFACE ${CONFIG_DIR})
-    set_openthread_config(${ZEPHYR_BASE}/../modules/lib/openthread ${CONFIG_FILE})
-endif()
-
-# ==================================================
-# Setup CHIP build
-# ==================================================
-
-chip_configure(ChipConfig
-    ARCH arm-none-eabi
-    CFLAGS ${CHIP_COMMON_FLAGS} --specs=nosys.specs
-    CXXFLAGS ${CHIP_COMMON_FLAGS}
-    PROJECT_CONFIG ${CHIP_PROJECT_CONFIG}
-)
-
-chip_build(ChipLib ChipConfig
-    BUILD_COMMAND ninja
-    BUILD_ARTIFACTS ${CHIP_LIBRARIES}
-)
-
-# ==================================================
-# Configure application
-# ==================================================
-
-target_link_libraries(app PUBLIC ChipLib)
-target_compile_definitions(app PRIVATE CHIP_HAVE_CONFIG_H)
diff --git a/config/nrfconnect/release.conf b/config/nrfconnect/release.conf
deleted file mode 100644 (file)
index b0d3b32..0000000
+++ /dev/null
@@ -1,37 +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.
-#
-
-#   This file contains settings which are not suitable for development phase of
-#   a project (in which debugging facilities should be enabled by default), but
-#   are perfectly valid for release builds which aim to generate binaries with
-#   minimal memory footprint.
-
-# Disable assertions
-CONFIG_ASSERT=n
-
-# Disable shell/console
-CONFIG_SHELL=n
-CONFIG_OPENTHREAD_SHELL=n
-CONFIG_CONSOLE=n
-CONFIG_UART_CONSOLE=n
-CONFIG_SERIAL=n
-
-# Disable logs
-CONFIG_LOG=n
-CONFIG_LOG_MINIMAL=n
-
-# Disable other debugging features
-CONFIG_THREAD_NAME=n
diff --git a/config/nrfconnect/sample-defaults.conf b/config/nrfconnect/sample-defaults.conf
deleted file mode 100644 (file)
index 9e90bae..0000000
+++ /dev/null
@@ -1,101 +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.
-#
-
-CONFIG_CHIP=y
-
-CONFIG_NEWLIB_LIBC=y
-
-# Export POSIX names for functions implementing a subset of POSIX standard in Zephyr
-CONFIG_POSIX_API=y
-CONFIG_PTHREAD_IPC=y
-CONFIG_EVENTFD=y
-
-CONFIG_LOG=y
-CONFIG_LOG_MINIMAL=y
-CONFIG_ASSERT=y
-CONFIG_HW_STACK_PROTECTION=y
-
-# Generic networking options
-CONFIG_NETWORKING=y
-CONFIG_NET_SOCKETS=y
-CONFIG_NET_SOCKETS_POSIX_NAMES=n
-
-# Application stack size
-CONFIG_MAIN_STACK_SIZE=8192
-CONFIG_INIT_STACKS=y
-
-# Disable certain parts of Zephyr IPv6 stack
-CONFIG_NET_IPV6_NBR_CACHE=n
-CONFIG_NET_IPV6_MLD=n
-
-# Network buffers
-CONFIG_NET_PKT_RX_COUNT=16
-CONFIG_NET_PKT_TX_COUNT=16
-CONFIG_NET_BUF_RX_COUNT=80
-CONFIG_NET_BUF_TX_COUNT=80
-
-# Bluetooth Low Energy configs
-CONFIG_BT=y
-CONFIG_BT_PERIPHERAL=y
-CONFIG_BT_DEVICE_APPEARANCE=0
-CONFIG_BT_DEVICE_NAME_DYNAMIC=y
-CONFIG_BT_DEVICE_NAME_MAX=15
-CONFIG_BT_MAX_CONN=1
-CONFIG_BT_PHY_UPDATE=n
-CONFIG_BT_CTLR_PHY_2M=n
-
-# Enable NFC support
-CONFIG_CHIP_NFC_COMMISSIONING=y
-
-# L2 OpenThread enabling
-CONFIG_NET_L2_OPENTHREAD=y
-
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_OPENTHREAD_FTD=n
-CONFIG_OPENTHREAD_SLAAC=y
-CONFIG_OPENTHREAD_DHCP6_CLIENT=y
-CONFIG_OPENTHREAD_SNTP_CLIENT=y
-CONFIG_OPENTHREAD_DNS_CLIENT=y
-CONFIG_OPENTHREAD_MTD_NETDIAG=y
-CONFIG_OPENTHREAD_ENABLE_SERVICE=y
-CONFIG_OPENTHREAD_MANUAL_START=y
-CONFIG_OPENTHREAD_THREAD_STACK_SIZE=6144
-
-# Use mbedTLS from nrf_security library
-CONFIG_NORDIC_SECURITY_BACKEND=y
-CONFIG_OPENTHREAD_MBEDTLS=n
-
-CONFIG_MBEDTLS_ENABLE_HEAP=y
-CONFIG_MBEDTLS_HEAP_SIZE=15360
-CONFIG_MBEDTLS_TLS_LIBRARY=y
-CONFIG_NRF_SECURITY_ADVANCED=y
-
-CONFIG_MBEDTLS_AES_C=y
-CONFIG_MBEDTLS_RSA_C=y
-CONFIG_MBEDTLS_ECP_C=y
-CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
-CONFIG_MBEDTLS_CTR_DRBG_C=y
-CONFIG_MBEDTLS_CIPHER_MODE_CTR=y
-CONFIG_MBEDTLS_ECJPAKE_C=y
-
-# Disable unneeded crypto operations
-CONFIG_MBEDTLS_SHA512_C=n
-CONFIG_MBEDTLS_CIPHER_MODE_XTS=n
-CONFIG_MBEDTLS_CHACHA20_C=n
-CONFIG_MBEDTLS_POLY1305_C=n
-CONFIG_MBEDTLS_CHACHAPOLY_C=n
-CONFIG_MBEDTLS_GCM_C=n
diff --git a/config/nrfconnect/third_party/connectedhomeip b/config/nrfconnect/third_party/connectedhomeip
deleted file mode 120000 (symlink)
index a8a4f8c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../..
\ No newline at end of file
diff --git a/config/nrfconnect/toolchain/BUILD.gn b/config/nrfconnect/toolchain/BUILD.gn
deleted file mode 100644 (file)
index f68c283..0000000
+++ /dev/null
@@ -1,34 +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.
-
-import("//build_overrides/chip.gni")
-
-import("//build/toolchain/arm_gcc/arm_toolchain.gni")
-
-declare_args() {
-  zephyr_ar = ""
-  zephyr_cc = ""
-  zephyr_cxx = ""
-}
-
-gcc_toolchain("zephyr") {
-  ar = zephyr_ar
-  cc = zephyr_cc
-  cxx = zephyr_cxx
-
-  toolchain_args = {
-    current_os = "zephyr"
-    is_clang = false
-  }
-}
index 3ccc65e..f44a18f 100644 (file)
@@ -43,7 +43,7 @@ On Debian-based Linux distributions such as Ubuntu, these dependencies can be
 satisfied with the following:
 
 ```
-sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev unzip
+sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev python3-pip unzip
 ```
 
 #### How to install prerequisites on macOS
diff --git a/docs/specs/chip-tlv-format.adoc b/docs/specs/chip-tlv-format.adoc
deleted file mode 100644 (file)
index aa9e3c1..0000000
+++ /dev/null
@@ -1,509 +0,0 @@
-= Project Connected Home over IP
-:toc: macro
-:toclevels: 7
-
-[discrete]
-[.text-center]
-== TLV Format
-
-[.text-center]
-_Revision 6_ +
-_2020-05-08_
-
-[.text-center]
-*Status:* [red]*Final* / [red]*Active*
-
-toc::[]
-
-== Introduction
-
-This document describes the CHIP TLV (_Tag-Length-Value_) format. CHIP
-TLV is a generalized encoding method for simple structured data. It
-shares many properties with the commonly used JSON serialization format
-while being considerably more compact over the wire.
-
-== TLV Elements and Encodings
-
-Values in the CHIP TLV format are encoded as _TLV elements_. Each TLV
-element has a type. Element types fall into two categories: _primitive
-types_ and _container types_. Primitive types convey fundamental data
-values such as integers and strings. Container types convey collections
-of elements that themselves are either primitives or containers. The
-CHIP TLV format supports three different container types: structures,
-arrays and lists.
-
-All valid _TLV encodings_ consist of a single top-level element. This
-value can be either a primitive type or a container type.
-
-== Tags
-
-A TLV element includes an optional numeric tag that identifies its
-purpose. Two categories of tags are defined: _profile-specific _and
-_context-specific_. A TLV element without a tag is called an _anonymous_
-element.
-
-=== Profile-Specific Tags
-
-Profile-specific tags identify elements globally. A profile-specific tag
-is a 64-bit number composed of the following fields:
-
-* 16-bit vendor id
-* 16-bit profile number
-* 32-bit tag number
-
-Profile-specific tags are defined either by CHIP or by external vendors.
-Additionally the CHIP Common Profile includes a set of predefined
-profile-specific tags that can be used across organizations.
-
-=== Context-Specific Tags
-
-Context-specific tags identify elements within the context of a
-containing structure element. A context-specific tag consists of a
-single 8-bit tag number. The meaning of a context specific tag derives
-from the structure it resides in, implying that the same tag number may
-have different meanings in the context of different structures.
-Effectively, the interpretation of a context specific tag depends on the
-tag attached to the containing element. Because structures themselves
-can be assigned context-specific tags, the interpretation of a
-context-specific tag may ultimately depend on a nested chain of such
-tags.
-
-Context-specific tags can only be assigned to elements that are
-immediately within a structure. This implies that an element with a
-context-specific tag cannot appear as the outermost element of a TLV
-encoding.
-
-=== Anonymous Tags
-
-A special anonymous tag is used to denote TLV elements that lack a tag
-value. Such a TLV element is referred to as an anonymous element.  
-
-=== Canonical Ordering of Tags
-
-Where a distinguished ordering of tags is required (e.g. for the purposes
-of generating a hash or cryptographic signature of elements within a
-structure), the following ordering rules shall be used:
-
-* Anonymous tags shall be ordered before all other tags.
-* Context specific tags shall be ordered before profile specific tags.
-* Context specific tags with numerically lesser tag values shall be ordered
-before those with higher tag values.
-* Profile specific tags with numerically lesser vendor ids shall be ordered
-before those with higher vendor ids.
-* Profile specific tags with the same vendor id, but numerically lesser
-profile numbers shall be ordered before those with higher numbers.
-
-== Lengths
-
-Depending on its type, a TLV element may contain a length field that
-gives the length, in bytes, of the element’s value field. A length field
-is only present for string types (character and byte strings). Other
-element types either have a predetermined length or are encoded with a
-marker that identifies their end.
-
-== Primitive Types
-
-The CHIP TLV format supports the following primitive types:
-
-* Signed integers
-* Unsigned integers
-* UTF-8 Strings
-* Byte Strings
-* Single or double-precision floating point numbers (IEEE 754-1985
-format)
-* Booleans
-* Nulls
-
-Of the primitive types, integers, floating point numbers, booleans and
-nulls have a predetermined length specified by their type. Byte strings
-and UTF-8 strings include a length field that gives their lengths in
-bytes.
-
-== Container Types
-
-The CHIP TLV format supports the following container types:
-
-* Structures
-* Arrays
-* Lists
-
-Each of the container types is a form of element collection that can
-contain primitive types and/or other container types. The elements
-appearing immediately within a container type are called its _members_.
-A container type can contain any number of member elements, including
-none. Container types can be nested to any depth and in any combination.
-The end of a container type is denoted by a special element called the
-‘end-of-container’ element. Although encoded as a member, conceptually
-the end-of-container element is not included in the members of the
-containing type.
-
-=== Structures
-
-A structure is a collection of member elements that each have a distinct
-meaning. All member elements within a structure must have a unique tag
-as compared to the other members of the structure. Member elements
-without tags (anonymous elements) are not allowed in structures. The
-encoded ordering of members in a structure may or may not be important
-depending on the intent of the sender or the expectations of the
-receiver. For example, in some situations, senders and receivers may
-agree on a particular ordering of elements to make encoding and decoding
-easier.
-
-Where a distinguished ordering of members is required (for example, for
-the purposes of generating a hash or cryptographic signature of the
-structure), the members of the structure shall be encoded in order of
-their tag values, according to the rules for the canonical ordering of tags.
-
-=== Arrays
-
-An array is an ordered collection of member elements that either do not
-have distinct meanings, or whose meanings are implied by their encoded
-positions in the array. An array can contain any type of element,
-including other arrays. All member elements of an array must be anonymous
-elements–that is, they must be encoded with an anonymous tag.
-
-=== Lists
-
-A list is an ordered collection of member elements, each of which may be
-encoded with a tag. The meanings of member elements in a list are denoted
-by their position within the list in conjunction with any associated tag
-value they may have.
-
-A list can contain any type of element, including other lists. The members
-of a list may be encoded with any form of tag, including an anonymous tag.
-The tags within a list needn’t be unique with respect to other members of
-the list.
-
-|===
-**Note:** In a previous version of this specification, the list type was
-referred to as a “path”. It was subsequently renamed to better reflect its
-use in practice.
-|===
-
-== Element Encoding
-
-A TLV element is encoded a single control byte, followed by a sequence
-of tag, length and value bytes. Depending on the nature of the element,
-any of the tag, length or value fields may be omitted.
-
-[options="header"]
-|===
-|Control Byte|Tag|Length|Value
-|1 byte|0 to 8 bytes|0 to 8 bytes|Variable
-|===
-
-== Control Byte Encoding
-
-The control byte specifies the type of a TLV element and how its tag,
-length and value fields are encoded. The control byte consists of two
-subfields: an _element type field_ which occupies the lower 5 bits, and
-a _tag control field_ which occupies the upper 3 bits.
-
-=== Element Type Field
-
-The element type field encodes the element’s type as well as how the
-corresponding length and value fields are encoded. In the case of
-Booleans and the null value, the element type field also encodes the
-value itself.
-
-[cols="^1,^1,^1,^1,^1,^1,^1,^1,<8",options="header"]
-|===
-8+h|Control Byte
-.3+h|Description
-3+h|Tag Control
-5+h|Element Type
-h|7
-h|6
-h|5
-h|4
-h|3
-h|2
-h|1
-h|0
-|x|x|x|0|0|0|0|0|Signed Integer, 1-byte value
-|x|x|x|0|0|0|0|1|Signed Integer, 2-byte value
-|x|x|x|0|0|0|1|0|Signed Integer, 4-byte value
-|x|x|x|0|0|0|1|1|Signed Integer, 8-byte value
-|x|x|x|0|0|1|0|0|Unsigned Integer, 1-byte value
-|x|x|x|0|0|1|0|1|Unsigned Integer, 2-byte value
-|x|x|x|0|0|1|1|0|Unsigned Integer, 4-byte value
-|x|x|x|0|0|1|1|1|Unsigned Integer, 8-byte value
-|x|x|x|0|1|0|0|0|Boolean False
-|x|x|x|0|1|0|0|1|Boolean True
-|x|x|x|0|1|0|1|0|Floating Point Number, 4-byte value
-|x|x|x|0|1|0|1|1|Floating Point Number, 8-byte value
-|x|x|x|0|1|1|0|0|UTF-8 String, 1-byte length
-|x|x|x|0|1|1|0|1|UTF-8 String, 2-byte length
-|x|x|x|0|1|1|1|0|UTF-8 String, 4-byte length
-|x|x|x|0|1|1|1|1|UTF-8 String, 8-byte length
-|x|x|x|1|0|0|0|0|Byte String, 1-byte length
-|x|x|x|1|0|0|0|1|Byte String, 2-byte length
-|x|x|x|1|0|0|1|0|Byte String, 4-byte length
-|x|x|x|1|0|0|1|1|Byte String, 8-byte length
-|x|x|x|1|0|1|0|0|Null
-|x|x|x|1|0|1|0|1|Structure
-|x|x|x|1|0|1|1|0|Array
-|x|x|x|1|0|1|1|1|List
-|x|x|x|1|1|0|0|0|End of Container
-|x|x|x|1|1|0|0|1|Reserved
-|x|x|x|1|1|0|1|0|Reserved
-|x|x|x|1|1|0|1|1|Reserved
-|x|x|x|1|1|1|0|0|Reserved
-|x|x|x|1|1|1|0|1|Reserved
-|x|x|x|1|1|1|1|0|Reserved
-|x|x|x|1|1|1|1|1|Reserved
-|===
-
-For types that have varying length or value fields, the bottom two bits
-of the element type field signal the width of the corresponding field as
-follows:
-
-* 00 -- 1 byte
-* 01 -- 2 bytes
-* 10 -- 4 bytes
-* 11 -- 8 bytes
-
-=== Tag Control Field
-
-The tag control field identifies the form of tag assigned to the element
-(including none) as well as the encoding of the tag bytes.
-
-[cols="^1,^1,^1,^1,^1,^1,^1,^1,<8",options="header"]
-|===
-8+h|Control Byte
-.3+h|Description
-3+h|Tag Control
-5+h|Element Type
-h|7
-h|6
-h|5
-h|4
-h|3
-h|2
-h|1
-h|0
-|0|0|0|x|x|x|x|x|Anonymous, 0 bytes
-|0|0|1|x|x|x|x|x|Context-specific Tag, 1 byte
-|0|1|0|x|x|x|x|x|Common Profile Tag, 2 bytes
-|0|1|1|x|x|x|x|x|Common Profile Tag, 4 bytes
-|1|0|0|x|x|x|x|x|Implicit Profile Tag, 2 bytes
-|1|0|1|x|x|x|x|x|Implicit Profile Tag, 4 bytes
-|1|1|0|x|x|x|x|x|Fully-qualified Tag, 6 bytes
-|1|1|1|x|x|x|x|x|Fully-qualified Tag, 8 bytes
-|===
-
-== Tag Encoding
-
-Tags are encoded in 0, 1, 2, 4, 6 or 8 byte widths as specified by the
-tag control field. Tags consist of up to three numeric fields: a _vendor
-id field_, a _profile number field_, and a _tag number field_. All
-fields are encoded in little-endian order.
-
-=== Fully-Qualified Form
-
-A profile-specific tag can be encoded in _fully-qualified form_, where
-the encoding includes all three tag components (vendor id, profile
-number and tag number). Two variants of this form are supported, one
-with a 16-bit tag number and one with a 32-bit tag number. The 16-bit
-variant must be used with tag numbers < 65536, while the 32-bit variant
-must be used with tag numbers >= 65536.
-
-[options="header"]
-|===
-|Tag Control|Vendor Id Size|Profile Number Size|Tag Number Size|
-|C0h|2 bytes|2 bytes|2 bytes|For tag numbers < 65536
-|E0h|2 bytes|2 bytes|4 bytes|For tag numbers >= 65535
-|===
-
-=== Implicit Form
-
-A profile-specific tag can also be encoded in _implicit form_, where the
-encoding includes only the tag number, and the vendor id and profile
-number are inferred from the protocol context in which the TLV encoding
-is communicated. This form also has two variants based on the magnitude
-of the tag number.
-
-[options="header"]
-|===
-|Tag Control|Tag Number Size|
-|80h|2 bytes|For tag numbers < 65536
-|A0h|4 bytes|For tag numbers >= 65535
-|===
-
-=== Common Profile Form
-
-A special encoding exists for profile-specific tags that are defined by
-the CHIP Common Profile. These are encoded in the same manner as
-implicit tags except that they are identified as common profile tags,
-rather than implicit profile tags in the tag control field.
-
-[options="header"]
-|===
-|Tag Control|Tag Number Size|
-|40h|2 bytes|For tag numbers < 65536
-|60h|4 bytes|For tag numbers >= 65535
-|===
-
-=== Context-Specific Form
-
-Context-specific tags are encoded as a single byte conveying the tag
-number.
-
-[options="header"]
-|===
-|Tag Control|Tag Number Size|
-|20h|1 bytes|All tag numbers 0 - 255
-|===
-
-=== Anonymous
-
-Anonymous elements do not encode any tag bytes.
-
-[options="header"]
-|===
-|Tag Control|Tag Size|
-|00h|0 bytes|No data encoded.
-|===
-
-== Length Encoding
-
-Length fields are encoded in 0, 1, 2 or 4 byte widths, as specified by
-the element type field. Length fields of more than one byte are encoded
-in little-endian order. The choice of width for the length field is up
-to the discretion of the sender, implying that a sender can choose to
-send more length bytes than strictly necessary to encode the value.
-
-== End of Container Encoding
-
-The end of a container type is marked with a special element called the
-end-of-container element. The end-of-container element is encoded as a
-single control byte with the value 18h. The tag control bits within the
-control byte must be set to zero, implying that end-of-container element
-can never have a tag.
-
-[options="header"]
-|===
-|Control Byte
-|1 byte
-|===
-
-== Value Encodings
-
-=== Integers
-
-An integer element is encoded as follows:
-
-[options="header"]
-|===
-|Control Byte|Tag|Value
-|1 byte|0 to 8 bytes|1, 2, 4 or 8 bytes
-|===
-
-The number of bytes in the value field is indicated by the element type
-field within the control byte. The choice of value byte count is at the
-sender’s discretion, implying that a sender is free to send more bytes
-than strictly necessary to encode the value. Within the value bytes, the
-integer value is encoded in little-endian two’s complement format.
-
-=== UTF-8 and Byte Strings
-
-UTF-8 and byte strings are encoded as follows:
-
-[options="header"]
-|===
-|Control Byte|Tag|Length|Value
-|1 byte|0 to 8 bytes|1 to 4 bytes|0 to 2^32^-1 bytes
-|===
-
-The length field of a UTF-8 or byte string encodes the number of bytes
-(not characters) present in the value field. The number of bytes in the
-length field is implied by the type specified in the element type field
-(within the control byte).
-
-For UTF-8 strings, the value bytes must encode a valid UTF-8 character
-sequence. Senders *should not* include a terminating null character to
-mark the end of a string. For byte strings, the value can be any
-arbitrary sequence of bytes.
-
-=== Booleans
-
-Boolean elements are encoded as follows:
-
-[options="header"]
-|===
-|Control Byte|Tag
-|1 byte|0 to 8 bytes
-|===
-
-The value of a Boolean element (true or false) is implied by the type
-indicated in the element type field.
-
-=== Arrays, Structures and Lists
-
-Array, structure and list elements are encoded as follows:
-
-[options="header"]
-|===
-|Control Byte|Tag|Value|End-of-Container
-|1 byte|0 to 8 bytes|_Variable_|1-byte
-|===
-
-The value field of an array/structure/list element is a sequence of
-encoded TLV elements that constitute the members of the element,
-followed by an end-of-container element. The end-of-container element
-must always be present, even in cases where the end of the
-array/structure/list element could be inferred by other means (e.g. the
-length of the packet containing the TLV encoding).
-
-=== Floating Point Numbers
-
-A floating point number is encoded as follows:
-
-[options="header"]
-|===
-|Control Byte|Tag|Value
-|1 byte|0 to 8 bytes|4 or 8 bytes
-|===
-
-The value field of a floating point element contains an IEEE 754-1985
-single or double precision floating point number encoded in
-little-endian format (specifically, the reverse of the order described
-in External Data Representation, RFC 4506). The choice of precision is
-implied by the type specified in the element type field (within the
-control byte). The sender is free to choose either precision at their
-discretion.
-
-=== Nulls
-
-A null value is encoded as follows:
-
-[options="header"]
-|===
-|Control Byte|Tag
-|1 byte|0 to 8 bytes
-|===
-
-[discrete]
-== Revision History
-
-[cols="^1,^1,<1,<4",options="header"]
-|===
-|Revision |Date |Modified By |Description
-|6|2020-05-08|Jay Logue|Renamed path type to list and clarified text in corresponding section.
-
-Added section on canonical ordering of tags.
-
-Added section describing anonymous tags.
-
-Clarified descriptions of structure and array types.
-
-Clarified encoding of floating point values with reference to RFC-4506.
-|5|2020-04-23|Grant Erickson|Import into Project Connected Home over IP.
-|4|2013-05-20|Jay Logue|Fixed incorrect control byte value for end of container encoding.
-|3|2013-04-22|Jay Logue|Renamed dictionary to structure.
-|2|2013-04-17|Jay Logue|Normalized the naming for ‘container’ types.
-|1|2013-04-15|Jay Logue|Initial revision.
-|===
-
-[.text-center]
-_Project Connect Home over IP Public Information_
index 49f08bd..1bf6846 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "writeTime": "Mon Mar 08 2021 19:19:42 GMT+0100 (Central European Standard Time)",
+  "writeTime": "Thu Mar 11 2021 17:27:52 GMT+0100 (Central European Standard Time)",
   "featureLevel": 11,
   "creator": "zap",
   "keyValuePairs": [
       "deviceTypeProfileId": null,
       "clusters": [
         {
-          "name": "Basic",
-          "code": 0,
+          "name": "Identify",
+          "code": 3,
           "mfgCode": null,
-          "define": "BASIC_CLUSTER",
+          "define": "IDENTIFY_CLUSTER",
           "side": "client",
           "enabled": 0,
           "commands": [
             {
-              "name": "ResetToFactoryDefaults",
+              "name": "Identify",
               "code": 0,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
-            }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "ZCL version",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x08",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
             },
             {
-              "name": "power source",
-              "code": 7,
+              "name": "IdentifyQuery",
+              "code": 1,
               "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
             }
           ],
-          "commands": []
-        },
-        {
-          "name": "Identify",
-          "code": 3,
-          "mfgCode": null,
-          "define": "IDENTIFY_CLUSTER",
-          "side": "client",
-          "enabled": 0,
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "Identify",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "IdentifyQuery",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "GROUPS_CLUSTER",
           "side": "client",
           "enabled": 0,
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ],
           "commands": [
             {
               "name": "AddGroup",
               "incoming": 1,
               "outgoing": 1
             }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
           ]
         },
         {
           "define": "GROUPS_CLUSTER",
           "side": "server",
           "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "name support",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "AddGroupResponse",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "name support",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
           "define": "SCENES_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [
+            {
+              "name": "AddSceneResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ViewSceneResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "RemoveSceneResponse",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "RemoveAllScenesResponse",
+              "code": 3,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "StoreSceneResponse",
+              "code": 4,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "GetSceneMembershipResponse",
+              "code": 6,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "AddSceneResponse",
-              "code": 0,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "ViewSceneResponse",
-              "code": 1,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "RemoveSceneResponse",
-              "code": 2,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "RemoveAllScenesResponse",
-              "code": 3,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "StoreSceneResponse",
-              "code": 4,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "GetSceneMembershipResponse",
-              "code": 6,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "LEVEL_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "MoveToLevel",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
           "commands": [],
           "attributes": [
             {
-              "name": "cluster revision",
-              "code": 65533,
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "current level",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "client",
+          "enabled": 0,
+          "commands": [],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "InteractionModelVersion",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "3",
+              "defaultValue": "0x00",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "current level",
-              "code": 0,
+              "name": "SoftwareVersionString",
+              "code": 10,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 1,
+              "defaultValue": "",
+              "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
           "define": "DOOR_LOCK_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "LockDoor",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
           "define": "DOOR_LOCK_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [
+            {
+              "name": "LockDoorResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "UnlockDoorResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
+          ]
+        },
+        {
+          "name": "Barrier Control",
+          "code": 259,
+          "mfgCode": null,
+          "define": "BARRIER_CONTROL_CLUSTER",
+          "side": "client",
+          "enabled": 0,
           "commands": [
             {
-              "name": "LockDoorResponse",
+              "name": "BarrierControlGoToPercent",
               "code": 0,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "UnlockDoorResponse",
+              "name": "BarrierControlStop",
               "code": 1,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             }
-          ]
-        },
-        {
-          "name": "Barrier Control",
-          "code": 259,
-          "mfgCode": null,
-          "define": "BARRIER_CONTROL_CLUSTER",
-          "side": "client",
-          "enabled": 0,
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "BarrierControlGoToPercent",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "BarrierControlStop",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "COLOR_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "MoveToHue",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
       "deviceTypeProfileId": 259,
       "clusters": [
         {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "client",
-          "enabled": 0,
-          "commands": [
-            {
-              "name": "ResetToFactoryDefaults",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "MfgSpecificPing",
-              "code": 0,
-              "mfgCode": "4098",
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 0
-            }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "commands": [],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "ZCL version",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x08",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "power source",
-              "code": 7,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
           "name": "Identify",
           "code": 3,
           "mfgCode": null,
           ]
         },
         {
-          "name": "Identify",
-          "code": 3,
-          "mfgCode": null,
-          "define": "IDENTIFY_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "commands": [
-            {
-              "name": "IdentifyQueryResponse",
-              "code": 0,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            }
-          ],
+          "name": "Identify",
+          "code": 3,
+          "mfgCode": null,
+          "define": "IDENTIFY_CLUSTER",
+          "side": "server",
+          "enabled": 1,
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
+          ],
+          "commands": [
+            {
+              "name": "IdentifyQueryResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
           ]
         },
         {
           "define": "GROUPS_CLUSTER",
           "side": "client",
           "enabled": 0,
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ],
           "commands": [
             {
               "name": "AddGroup",
               "incoming": 1,
               "outgoing": 1
             }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
           ]
         },
         {
               "outgoing": 1
             },
             {
-              "name": "Stop",
+              "name": "Stop",
+              "code": 3,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "MoveToLevelWithOnOff",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "MoveWithOnOff",
+              "code": 5,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "StepWithOnOff",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "StopWithOnOff",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Level Control",
+          "code": 8,
+          "mfgCode": null,
+          "define": "LEVEL_CONTROL_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "current level",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "client",
+          "enabled": 0,
+          "commands": [
+            {
+              "name": "MfgSpecificPing",
+              "code": 0,
+              "mfgCode": "4098",
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 0
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "InteractionModelVersion",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
               "code": 3,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "MoveToLevelWithOnOff",
+              "name": "ProductID",
               "code": 4,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "MoveWithOnOff",
+              "name": "UserLabel",
               "code": 5,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "StepWithOnOff",
+              "name": "Location",
               "code": 6,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "StopWithOnOff",
+              "name": "HardwareVersion",
               "code": 7,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
-          ],
-          "attributes": [
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
             {
-              "name": "cluster revision",
-              "code": 65533,
+              "name": "HardwareVersionString",
+              "code": 8,
               "mfgCode": null,
-              "side": "client",
+              "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "3",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Level Control",
-          "code": 8,
-          "mfgCode": null,
-          "define": "LEVEL_CONTROL_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "attributes": [
+            },
             {
-              "name": "cluster revision",
-              "code": 65533,
+              "name": "SoftwareVersion",
+              "code": 9,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "3",
+              "defaultValue": "0x00",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "current level",
-              "code": 0,
+              "name": "SoftwareVersionString",
+              "code": 10,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 1,
+              "defaultValue": "",
+              "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": []
+          ]
         },
         {
           "name": "General Commissioning",
           "define": "DOOR_LOCK_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "LockDoor",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
           "define": "COLOR_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "MoveToHue",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
           "define": "TEMP_MEASUREMENT_CLUSTER",
           "side": "client",
           "enabled": 0,
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": []
+          ]
         },
         {
           "name": "Temperature Measurement",
           "define": "IAS_ZONE_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "commands": [
+            {
+              "name": "ZoneStatusChangeNotification",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ZoneEnrollRequest",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "ZoneStatusChangeNotification",
-              "code": 0,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "ZoneEnrollRequest",
-              "code": 1,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "CONTENT_LAUNCH_CLUSTER",
           "side": "server",
           "enabled": 1,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x0001",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "LaunchContentResponse",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         }
       ]
index f5f88af..fc5ea3b 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -696,10 +734,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -710,6 +744,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index 14a3742..d028079 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,6 +34,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
index 2060cb3..f518ac9 100644 (file)
@@ -83,10 +83,20 @@ NS_ASSUME_NONNULL_BEGIN
 @interface CHIPBasic : CHIPCluster
 
 - (void)mfgSpecificPing:(ResponseHandler)completionHandler;
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler;
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler;
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler;
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
 
 @end
@@ -323,7 +333,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 - (void)setHolidaySchedule:(uint8_t)scheduleId
                 localStartTime:(uint32_t)localStartTime
                   localEndTime:(uint32_t)localEndTime
@@ -332,12 +342,12 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler;
 - (void)setWeekdaySchedule:(uint8_t)scheduleId
@@ -353,8 +363,8 @@ NS_ASSUME_NONNULL_BEGIN
             localStartTime:(uint32_t)localStartTime
               localEndTime:(uint32_t)localEndTime
          completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 
 - (void)readAttributeLockState:(ResponseHandler)completionHandler;
 - (void)configureAttributeLockState:(uint16_t)minInterval
@@ -397,8 +407,10 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @interface CHIPGroups : CHIPCluster
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroupIfIdentifying:(uint16_t)groupId
+                    groupName:(NSString *)groupName
+            completionHandler:(ResponseHandler)completionHandler;
 - (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler;
 - (void)removeAllGroups:(ResponseHandler)completionHandler;
 - (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler;
@@ -545,7 +557,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
index 4651649..48568b1 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -321,8 +367,8 @@ private:
 
 - (void)readAttributeVendorName:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -368,8 +414,8 @@ private:
 
 - (void)readAttributeApplicationName:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -415,8 +461,8 @@ private:
 
 - (void)readAttributeApplicationId:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -714,7 +760,149 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
+
+- (void)readAttributeInteractionModelVersion:(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.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorID:(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.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductID:(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.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -729,7 +917,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -737,9 +927,10 @@ private:
     }
 }
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -752,7 +943,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -760,9 +951,105 @@ private:
     }
 }
 
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersion:(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.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
+{
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(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.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -775,7 +1062,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1603,8 +1890,8 @@ private:
 
 - (void)readAttributeCompensationText:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3382,7 +3669,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -3398,7 +3685,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3435,7 +3724,7 @@ private:
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
@@ -3451,7 +3740,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, pin);
+    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3461,7 +3752,7 @@ private:
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
@@ -3477,7 +3768,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, id);
+    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3563,7 +3856,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -3579,14 +3872,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3601,7 +3896,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds, pin);
+    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3838,8 +4135,8 @@ private:
 
 - (void)readAttributeFabricId:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3942,7 +4239,7 @@ private:
     return &_cppCluster;
 }
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
 {
     CHIPGroupsClusterAddGroupResponseCallbackBridge * onSuccess
         = new CHIPGroupsClusterAddGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -3958,14 +4255,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3980,7 +4279,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -5248,7 +5549,7 @@ private:
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
@@ -5268,8 +5569,10 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddScene(
-        onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, sceneName, clusterId, length, value);
+    CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime,
+        chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]),
+        clusterId, length, value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
index 419f6f9..fd7bc57 100644 (file)
@@ -96,11 +96,6 @@ void DispatchServerCommand(app::Command * command, CommandId commandId, Endpoint
     {
         switch (commandId)
         {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfBasicClusterResetToFactoryDefaultsCallback();
-            break;
-        }
         default: {
             // Unrecognized command ID, error status will apply.
             // TODO: Encode response for command not found
index 3ab0310..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index 36af820..f34585d 100644 (file)
@@ -196,10 +196,6 @@ EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd)
     {
         switch (cmd->commandId)
         {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            wasHandled = emberAfBasicClusterResetToFactoryDefaultsCallback();
-            break;
-        }
         default: {
             // Unrecognized command ID, error status will apply.
             break;
index 9865389..d585784 100644 (file)
@@ -1387,12 +1387,6 @@ bool emberAfBarrierControlClusterBarrierControlStopCallback();
 bool emberAfBasicClusterMfgSpecificPingCallback();
 
 /**
- * @brief Basic Cluster ResetToFactoryDefaults Command callback
- */
-
-bool emberAfBasicClusterResetToFactoryDefaultsCallback();
-
-/**
  * @brief Binding Cluster Bind Command callback
  * @param nodeId
  * @param groupId
index c4f2f0a..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
index 2069290..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
index 655425d..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
index 3775b35..202d80c 100644 (file)
 #if BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
-        /* 0 */ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                        \
-            /* Default for cluster: "General Commissioning", attribute: "FabricId". side: server, big-endian */ /* 8 */            \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 32 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                  \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 64 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 96 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 112 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 176 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 180 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                                    \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ /* 244 */ 1, 'o',     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                                    \
+            /* Default for cluster: "General Commissioning", attribute: "FabricId". side: server, big-endian */ /* 252 */          \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                        \
-            /* Default for cluster: "General Commissioning", attribute: "Breadcrumb". side: server, big-endian */ /* 16 */         \
+            /* Default for cluster: "General Commissioning", attribute: "Breadcrumb". side: server, big-endian */ /* 260 */        \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                              \
-            /* Default for cluster: "Color Control", attribute: "compensation text". side: server, big-endian */ /* 270 */         \
+            /* Default for cluster: "Color Control", attribute: "compensation text". side: server, big-endian */ /* 514 */         \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                        \
-            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, big-endian */ /* 278 */ 0x00, 0x00,    \
+            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, big-endian */ /* 522 */ 0x00, 0x00,    \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                      \
-            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, big-endian */ /* 310 */           \
+            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, big-endian */ /* 554 */           \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
             0x00, /* Default for cluster: "Application Basic", attribute: "application name". side: server, big-endian */          \
-            /* 342 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            /* 586 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                    \
+            /* Default for cluster: "Application Basic", attribute: "application id". side: server, big-endian */ /* 618 */        \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
-            0x00, /* Default for cluster: "Application Basic", attribute: "application id". side: server, big-endian */            \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 650 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 682 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 714 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 730 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 794 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 798 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */                 \
     }
 
 #else // !BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
-        /* 0 */ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                        \
-            /* Default for cluster: "General Commissioning", attribute: "FabricId". side: server, little-endian */ /* 8 */         \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 32 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 64 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 96 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 112 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 176 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 180 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ /* 244 */ 1, 'o',  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                                    \
+            /* Default for cluster: "General Commissioning", attribute: "FabricId". side: server, little-endian */ /* 252 */       \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                              \
             0x00, /* Default for cluster: "General Commissioning", attribute: "Breadcrumb". side: server, little-endian */         \
-            /* 16 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   \
+            /* 260 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                              \
             0x00, /* Default for cluster: "Color Control", attribute: "compensation text". side: server, little-endian */          \
-            /* 270 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                              \
-            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, little-endian */ /* 278 */ 0x00, 0x00, \
+            /* 514 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                              \
+            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, little-endian */ /* 522 */ 0x00, 0x00, \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                      \
-            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, little-endian */ /* 310 */        \
+            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, little-endian */ /* 554 */        \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
             0x00, /* Default for cluster: "Application Basic", attribute: "application name". side: server, little-endian */       \
-            /* 342 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            /* 586 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
             0x00, /* Default for cluster: "Application Basic", attribute: "application id". side: server, little-endian */         \
+            /* 618 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                    \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 650 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 682 */ 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 714 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 730 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 794 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 798 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */              \
     }
 
 #endif // BIGENDIAN_CPU
 
-#define GENERATED_DEFAULTS_COUNT (7)
+#define GENERATED_DEFAULTS_COUNT (21)
 
 #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
 #define ZAP_LONG_DEFAULTS_INDEX(index)                                                                                             \
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 108
+#define GENERATED_ATTRIBUTE_COUNT 126
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
-        { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },       /* Basic (server): cluster revision */                        \
-            { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x08 } }, /* Basic (server): ZCL version */                             \
-            { 0x0007, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0x00 } }, /* Basic (server): power source */                            \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },   /* Identify (server): cluster revision */                     \
+        { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } }, /* Identify (server): cluster revision */                           \
             {                                                                                                                      \
                 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) 0x0000 }                                  \
             },                                                          /* Identify (server): identify time */                     \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },      /* Level Control (server): cluster revision */             \
             { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x00 } },    /* Level Control (server): current level */                \
             {                                                                                                                      \
-                0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }                                   \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }                                      \
+            }, /* Basic (server): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }       \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(32) }      \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(64) } }, /* Basic (server): UserLabel */                                       \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(96) } }, /* Basic (server): Location */                                        \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(112) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(176) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(180) }     \
+            },                                                          /* Basic (server): SoftwareVersionString */                \
+            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* General Commissioning (server): cluster revision */     \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(244) }                                 \
             }, /* General Commissioning (server): FabricId */                                                                      \
             {                                                                                                                      \
-                0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(8) }              \
+                0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(252) }            \
             },                                                          /* General Commissioning (server): Breadcrumb */           \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* General Commissioning (server): cluster revision */     \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },      /* Door Lock (server): cluster revision */                 \
             { 0x0000, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 2 } },       /* Door Lock (server): lock state */                       \
             { 0x0001, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0 } },       /* Door Lock (server): lock type */                        \
             { 0x0004, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x607D } }, /* Color Control (server): current y */                    \
             { 0x0005, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0 } },       /* Color Control (server): drift compensation */           \
             {                                                                                                                      \
-                0x0006, ZAP_TYPE(CHAR_STRING), 254, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(16) }                                 \
+                0x0006, ZAP_TYPE(CHAR_STRING), 254, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(260) }                                \
             },                                                          /* Color Control (server): compensation text */            \
             { 0x0007, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x00FA } }, /* Color Control (server): color temperature */            \
             { 0x0008, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0x01 } },    /* Color Control (server): color mode */                   \
             { 0x0001, ZAP_TYPE(ENUM16), 2, 0, { (uint8_t *) 0 } },      /* IAS Zone (server): zone type */                         \
             { 0x0002, ZAP_TYPE(BITMAP16), 2, 0, { (uint8_t *) 0x0000 } }, /* IAS Zone (server): zone status */                     \
             {                                                                                                                      \
-                0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(270) }      \
+                0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(514) }      \
             },                                                          /* IAS Zone (server): IAS CIE address */                   \
             { 0x0011, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0xff } },    /* IAS Zone (server): Zone ID */                           \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Low Power (server): cluster revision */                 \
+            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Application Basic (server): cluster revision */         \
             {                                                                                                                      \
-                0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(278) }                                \
+                0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(522) }                                \
             },                                                     /* Application Basic (server): vendor name */                   \
             { 0x0001, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } }, /* Application Basic (server): vendor id */                     \
             {                                                                                                                      \
-                0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(310) }                                \
-            },                                                          /* Application Basic (server): application name */         \
-            { 0x0003, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Application Basic (server): product id */               \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Application Basic (server): cluster revision */         \
+                0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(554) }                                \
+            },                                                     /* Application Basic (server): application name */              \
+            { 0x0003, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } }, /* Application Basic (server): product id */                    \
             {                                                                                                                      \
-                0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(342) }                                \
+                0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(586) }                                \
             },                                                          /* Application Basic (server): application id */           \
             { 0x0006, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Application Basic (server): catalog vendor id */        \
             { 0x0007, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0x01 } },    /* Application Basic (server): application satus */        \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Binding (server): cluster revision */                   \
-            { 0x0000, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Media Playback (server): current state */               \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Media Playback (server): cluster revision */            \
+            { 0x0000, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Media Playback (server): current state */               \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Content Launch (server): cluster revision */            \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },      /* Basic (server): cluster revision */                     \
-            { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x08 } },    /* Basic (server): ZCL version */                          \
-            { 0x0007, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0x00 } },    /* Basic (server): power source */                         \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },      /* On/off (server): cluster revision */                    \
             { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, { (uint8_t *) 0x00 } },  /* On/off (server): on/off */                              \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }                                      \
+            }, /* Basic (server): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(618) }     \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(650) }     \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(682) } }, /* Basic (server): UserLabel */                                      \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(714) } }, /* Basic (server): Location */                                       \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(730) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(794) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(798) }     \
+            }, /* Basic (server): SoftwareVersionString */                                                                         \
     }
 
 // This is an array of EmberAfCluster structures.
 #define GENERATED_CLUSTER_COUNT 19
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, ZAP_ATTRIBUTE_INDEX(0), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 1, Cluster: Basic (server) */       \
-            { 0x0003,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(3),                                                                                              \
-              2,                                                                                                                   \
-              4,                                                                                                                   \
-              ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION),           \
-              chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */                                         \
+        { 0x0003,                                                                                                                  \
+          ZAP_ATTRIBUTE_INDEX(0),                                                                                                  \
+          2,                                                                                                                       \
+          4,                                                                                                                       \
+          ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION),               \
+          chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */                                             \
             { 0x0004,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(5),                                                                                              \
+              ZAP_ATTRIBUTE_INDEX(2),                                                                                              \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayGroupsServer }, /* Endpoint: 1, Cluster: Groups (server) */                                             \
             { 0x0005,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(7),                                                                                              \
+              ZAP_ATTRIBUTE_INDEX(4),                                                                                              \
               6,                                                                                                                   \
               8,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayScenesServer }, /* Endpoint: 1, Cluster: Scenes (server) */                                             \
             { 0x0006,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(13),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(10),                                                                                             \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/off (server) */                                              \
             { 0x0008,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(15),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(12),                                                                                             \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */                                \
             {                                                                                                                      \
-                0x0030, ZAP_ATTRIBUTE_INDEX(17), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
+                0x0028, ZAP_ATTRIBUTE_INDEX(14), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
+            }, /* Endpoint: 1, Cluster: Basic (server) */                                                                          \
+            {                                                                                                                      \
+                0x0030, ZAP_ATTRIBUTE_INDEX(26), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
             }, /* Endpoint: 1, Cluster: General Commissioning (server) */                                                          \
             { 0x0101,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(20),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(29),                                                                                             \
               4,                                                                                                                   \
               5,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION),                                             \
               chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */                                        \
             {                                                                                                                      \
-                0x0103, ZAP_ATTRIBUTE_INDEX(24), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0x0103, ZAP_ATTRIBUTE_INDEX(33), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Barrier Control (server) */                                                                \
             { 0x0300,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(29),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(38),                                                                                             \
               51,                                                                                                                  \
               336,                                                                                                                 \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */                                \
             {                                                                                                                      \
-                0x0402, ZAP_ATTRIBUTE_INDEX(80), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0x0402, ZAP_ATTRIBUTE_INDEX(89), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */                                                        \
             { 0x0500,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(84),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(93),                                                                                             \
               6,                                                                                                                   \
               16,                                                                                                                  \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) |      \
                   ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION),                                                                         \
               chipFuncArrayIasZoneServer }, /* Endpoint: 1, Cluster: IAS Zone (server) */                                          \
             {                                                                                                                      \
-                0x0508, ZAP_ATTRIBUTE_INDEX(90), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0x0508, ZAP_ATTRIBUTE_INDEX(99), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Low Power (server) */                                                                      \
             {                                                                                                                      \
-                0x050D, ZAP_ATTRIBUTE_INDEX(91), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL                                            \
+                0x050D, ZAP_ATTRIBUTE_INDEX(100), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
             }, /* Endpoint: 1, Cluster: Application Basic (server) */                                                              \
             {                                                                                                                      \
-                0xF000, ZAP_ATTRIBUTE_INDEX(99), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0xF000, ZAP_ATTRIBUTE_INDEX(108), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
             }, /* Endpoint: 1, Cluster: Binding (server) */                                                                        \
             {                                                                                                                      \
-                0xF001, ZAP_ATTRIBUTE_INDEX(100), 2, 4, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
+                0xF001, ZAP_ATTRIBUTE_INDEX(109), 2, 4, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
             }, /* Endpoint: 1, Cluster: Media Playback (server) */                                                                 \
             {                                                                                                                      \
-                0xF002, ZAP_ATTRIBUTE_INDEX(102), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
+                0xF002, ZAP_ATTRIBUTE_INDEX(111), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
             }, /* Endpoint: 1, Cluster: Content Launch (server) */                                                                 \
-            { 0x0000, ZAP_ATTRIBUTE_INDEX(103), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 2, Cluster: Basic (server) */ \
             { 0x0006,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(106),                                                                                            \
+              ZAP_ATTRIBUTE_INDEX(112),                                                                                            \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */                                              \
+            {                                                                                                                      \
+                0x0028, ZAP_ATTRIBUTE_INDEX(114), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                          \
+            }, /* Endpoint: 2, Cluster: Basic (server) */                                                                          \
     }
 
 #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 17, 530 }, { ZAP_CLUSTER_INDEX(17), 2, 7 },                                                        \
+        { ZAP_CLUSTER_INDEX(0), 17, 780 }, { ZAP_CLUSTER_INDEX(17), 2, 257 },                                                      \
     }
 
 // Largest attribute size is needed for various buffers
 #define ATTRIBUTE_LARGEST (254)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (0)
+#define ATTRIBUTE_SINGLETONS_SIZE (508)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (537)
+#define ATTRIBUTE_MAX_SIZE (1037)
 
 // 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 (111)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (115)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Basic (server): MfgSpecificPing */                                 \
-            {                                                                                                                      \
-                0x0000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) | ZAP_COMMAND_MASK(OUTGOING_SERVER)                                \
-            }, /* Basic (server): ResetToFactoryDefaults */                                                                        \
-            {                                                                                                                      \
-                0x0000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) | ZAP_COMMAND_MASK(OUTGOING_SERVER)                                \
-            },                                                   /* Basic (server): ResetToFactoryDefaults */                      \
-            { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (server): Identify */                                 \
+        { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (server): Identify */                                 \
             { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Identify (server): IdentifyQueryResponse */                    \
             { 0x0003, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (server): IdentifyQuery */                            \
             { 0x0004, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Groups (server): AddGroup */                                   \
             { 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): MoveWithOnOff */                       \
             { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StepWithOnOff */                       \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StopWithOnOff */                       \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Basic (server): MfgSpecificPing */                             \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
             { 0x0030, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (server): SetFabric */                   \
             { 0x0030, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* General Commissioning (server): SetFabricResponse */           \
             { 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (server): ArmFailSafe */                 \
 #define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT (1)
 #define GENERATED_COMMAND_MANUFACTURER_CODES                                                                                       \
     {                                                                                                                              \
-        { 0, 4098 },                                                                                                               \
+        { 40, 4098 },                                                                                                              \
     }
 
 // This is an array of EmberAfManufacturerCodeEntry structures for clusters.
index 1ea3151..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
diff --git a/examples/all-clusters-app/linux/build b/examples/all-clusters-app/linux/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
index 96ea807..405d0aa 100644 (file)
@@ -39,7 +39,7 @@
       "clusters": [
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "client",
@@ -53,7 +53,7 @@
               "side": "client",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "3",
               "reportable": 0,
         },
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "server",
-          "enabled": 0,
-          "commands": [],
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "3",
               "reportable": 0,
               "reportableChange": 0
             },
             {
-              "name": "ZCL version",
+              "name": "InteractionModelVersion",
               "code": 0,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x08",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "power source",
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
               "code": 7,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "0x00",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             }
           ]
         },
       "clusters": [
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "client",
         },
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "server",
-          "enabled": 0,
-          "commands": [],
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "reportableChange": 0
             },
             {
-              "name": "ZCL version",
+              "name": "InteractionModelVersion",
               "code": 0,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x08",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "application version",
+              "name": "VendorName",
               "code": 1,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x00",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "stack version",
+              "name": "VendorID",
               "code": 2,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x00",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "hardware version",
+              "name": "ProductName",
               "code": 3,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x00",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "manufacturer name",
+              "name": "ProductID",
               "code": 4,
               "mfgCode": null,
               "side": "server",
               "reportableChange": 0
             },
             {
-              "name": "model identifier",
+              "name": "UserLabel",
               "code": 5,
               "mfgCode": null,
               "side": "server",
               "reportableChange": 0
             },
             {
-              "name": "date code",
+              "name": "Location",
               "code": 6,
               "mfgCode": null,
               "side": "server",
               "reportableChange": 0
             },
             {
-              "name": "power source",
+              "name": "HardwareVersion",
               "code": 7,
               "mfgCode": null,
               "side": "server",
               "reportableChange": 0
             },
             {
-              "name": "generic device class",
+              "name": "HardwareVersionString",
               "code": 8,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0xFF",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "generic device type",
+              "name": "SoftwareVersion",
               "code": 9,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0xFF",
+              "defaultValue": "0x00",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "product code",
+              "name": "SoftwareVersionString",
               "code": 10,
               "mfgCode": null,
               "side": "server",
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
-            },
-            {
-              "name": "product url",
-              "code": 11,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 1,
-              "bounded": 0,
-              "defaultValue": "",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "sw build id",
-              "code": 16384,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 1,
-              "bounded": 0,
-              "defaultValue": "",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
             }
           ]
         },
index f5f88af..fc5ea3b 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -696,10 +734,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -710,6 +744,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index 14a3742..d028079 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,6 +34,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
index 6321b00..e41b61b 100644 (file)
@@ -48,21 +48,19 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @interface CHIPBasic : CHIPCluster
 
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler;
-
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler;
-- (void)readAttributeApplicationVersion:(ResponseHandler)completionHandler;
-- (void)readAttributeStackVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
 - (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
-- (void)readAttributeManufacturerName:(ResponseHandler)completionHandler;
-- (void)readAttributeModelIdentifier:(ResponseHandler)completionHandler;
-- (void)readAttributeDateCode:(ResponseHandler)completionHandler;
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler;
-- (void)readAttributeGenericDeviceClass:(ResponseHandler)completionHandler;
-- (void)readAttributeGenericDeviceType:(ResponseHandler)completionHandler;
-- (void)readAttributeProductCode:(ResponseHandler)completionHandler;
-- (void)readAttributeProductUrl:(ResponseHandler)completionHandler;
-- (void)readAttributeSwBuildId:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
 
 @end
index 98ddbec..f583357 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -319,32 +365,9 @@ private:
     return &_cppCluster;
 }
 
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
+- (void)readAttributeInteractionModelVersion:(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.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler
-{
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -357,7 +380,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -365,9 +388,10 @@ private:
     }
 }
 
-- (void)readAttributeApplicationVersion:(ResponseHandler)completionHandler
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -380,7 +404,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -388,9 +412,9 @@ private:
     }
 }
 
-- (void)readAttributeStackVersion:(ResponseHandler)completionHandler
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -403,7 +427,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeStackVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -411,9 +435,10 @@ private:
     }
 }
 
-- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -426,7 +451,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -434,10 +459,9 @@ private:
     }
 }
 
-- (void)readAttributeManufacturerName:(ResponseHandler)completionHandler
+- (void)readAttributeProductID:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -450,7 +474,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeManufacturerName(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -458,10 +482,10 @@ private:
     }
 }
 
-- (void)readAttributeModelIdentifier:(ResponseHandler)completionHandler
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -474,7 +498,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeModelIdentifier(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -482,10 +506,9 @@ private:
     }
 }
 
-- (void)readAttributeDateCode:(ResponseHandler)completionHandler
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -498,7 +521,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeDateCode(onSuccess->Cancel(), onFailure->Cancel());
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -506,9 +531,10 @@ private:
     }
 }
 
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -521,7 +547,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -529,9 +555,9 @@ private:
     }
 }
 
-- (void)readAttributeGenericDeviceClass:(ResponseHandler)completionHandler
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -544,7 +570,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeGenericDeviceClass(onSuccess->Cancel(), onFailure->Cancel());
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -552,9 +580,9 @@ private:
     }
 }
 
-- (void)readAttributeGenericDeviceType:(ResponseHandler)completionHandler
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -567,7 +595,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeGenericDeviceType(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -575,10 +603,10 @@ private:
     }
 }
 
-- (void)readAttributeProductCode:(ResponseHandler)completionHandler
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -591,7 +619,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeProductCode(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -599,10 +627,9 @@ private:
     }
 }
 
-- (void)readAttributeProductUrl:(ResponseHandler)completionHandler
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -615,7 +642,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeProductUrl(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -623,10 +650,10 @@ private:
     }
 }
 
-- (void)readAttributeSwBuildId:(ResponseHandler)completionHandler
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -639,7 +666,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeSwBuildId(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
index b08b0bc..e5c62ee 100644 (file)
@@ -39,30 +39,6 @@ namespace app {
 
 namespace clusters {
 
-namespace Basic {
-
-void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfBasicClusterResetToFactoryDefaultsCallback();
-            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_BASIC_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace Basic
-
 namespace LevelControl {
 
 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -373,9 +349,6 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
     Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
     switch (aClusterId)
     {
-    case ZCL_BASIC_CLUSTER_ID:
-        clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
-        break;
     case ZCL_LEVEL_CONTROL_CLUSTER_ID:
         clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
index 8802797..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Low Power
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index d1a86ac..8a3306f 100644 (file)
@@ -72,7 +72,8 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
         switch (cmd->apsFrame->clusterId)
         {
         case ZCL_BASIC_CLUSTER_ID:
-            result = emberAfBasicClusterServerCommandParse(cmd);
+            // No commands are enabled for cluster Basic
+            result = status(false, true, cmd->mfgSpecific);
             break;
         case ZCL_LEVEL_CONTROL_CLUSTER_ID:
             result = emberAfLevelControlClusterServerCommandParse(cmd);
@@ -90,26 +91,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
 
 // Cluster specific command parsing
 
-EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            wasHandled = emberAfBasicClusterResetToFactoryDefaultsCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
index 6b284ee..26742ee 100644 (file)
@@ -272,12 +272,6 @@ void emberAfOnOffClusterServerTickCallback(chip::EndpointId endpoint);
 // Cluster Commands Callback
 
 /**
- * @brief Basic Cluster ResetToFactoryDefaults Command callback
- */
-
-bool emberAfBasicClusterResetToFactoryDefaultsCallback();
-
-/**
  * @brief Level Control Cluster Move Command callback
  * @param moveMode
  * @param rate
index 97de7f6..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for Sleep
+ *
+ * Command: Sleep
+ */
+#define emberAfFillCommandLow                                                                                                      \
+    PowerClusterSleep() emberAfFillExternalBuffer(mask,                                                                            \
+                                                                                                                                   \
+                                                  ZCL_SLEEP_COMMAND_ID, "", );
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
index 99de14e..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Low Power
+#define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
index d31a267..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Low Power
+#define ZCL_SLEEP_COMMAND_ID (0x00)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
index 9a45679..b186045 100644 (file)
 #if BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 32 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                  \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 64 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 96 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 112 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 176 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 180 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                                    \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ /* 244 */ 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                      \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 276 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 308 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 340 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 356 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 420 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 424 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */                 \
     }
 
 #else // !BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 32 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 64 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 96 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 112 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 176 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 180 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ /* 244 */          \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 276 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 308 */ 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 340 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 356 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 420 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 424 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */              \
     }
 
 #endif // BIGENDIAN_CPU
 
-#define GENERATED_DEFAULTS_COUNT (0)
+#define GENERATED_DEFAULTS_COUNT (14)
 
 #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
 #define ZAP_LONG_DEFAULTS_INDEX(index)                                                                                             \
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 29
+#define GENERATED_ATTRIBUTE_COUNT 50
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
-        { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 } }, /* Basic (server): cluster revision */  \
-            { 0x0000, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x08 } }, /* Basic (server): ZCL version */ \
-            {                                                                                                                      \
-                0x0007, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                    \
-            },                                                         /* Basic (server): power source */                          \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },     /* On/off (server): cluster revision */                     \
+        { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },         /* On/off (server): cluster revision */                     \
             { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, { (uint8_t *) 0x00 } }, /* On/off (server): on/off */                               \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },     /* Level Control (server): cluster revision */              \
             { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x00 } },   /* Level Control (server): current level */                 \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }                                      \
+            }, /* Basic (server): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }       \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(32) }      \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(64) } }, /* Basic (server): UserLabel */                                       \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(96) } }, /* Basic (server): Location */                                        \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(112) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(176) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(180) }     \
+            },                                                         /* Basic (server): SoftwareVersionString */                 \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },     /* On/off (server): cluster revision */                     \
             { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, { (uint8_t *) 0x00 } }, /* On/off (server): on/off */                               \
             {                                                                                                                      \
             }, /* Level Control (server): options */                                                                               \
             {                                                                                                                      \
                 0x4000, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) 0 }                                        \
-            },                                                         /* Level Control (server): start up current level */        \
+            }, /* Level Control (server): start up current level */                                                                \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }                                      \
+            }, /* Basic (server): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(244) }     \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(276) }     \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(308) } }, /* Basic (server): UserLabel */                                      \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(340) } }, /* Basic (server): Location */                                       \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(356) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(420) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(424) }     \
+            },                                                         /* Basic (server): SoftwareVersionString */                 \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },     /* On/off (server): cluster revision */                     \
             { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, { (uint8_t *) 0x00 } }, /* On/off (server): on/off */                               \
             {                                                                                                                      \
     };
 
 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
-#define GENERATED_CLUSTER_COUNT 7
+#define GENERATED_CLUSTER_COUNT 8
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, ZAP_ATTRIBUTE_INDEX(0), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 0, Cluster: Basic (server) */       \
-            { 0x0006,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(3),                                                                                              \
-              2,                                                                                                                   \
-              3,                                                                                                                   \
-              ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
-              chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/off (server) */                                              \
+        {                                                                                                                          \
+            0x0006,                                                                                                                \
+            ZAP_ATTRIBUTE_INDEX(0),                                                                                                \
+            2,                                                                                                                     \
+            3,                                                                                                                     \
+            ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                            \
+            chipFuncArrayOnOffServer                                                                                               \
+        }, /* Endpoint: 1, Cluster: On/off (server) */                                                                             \
             { 0x0008,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(5),                                                                                              \
+              ZAP_ATTRIBUTE_INDEX(2),                                                                                              \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */                                \
+            {                                                                                                                      \
+                0x0028, ZAP_ATTRIBUTE_INDEX(4), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                            \
+            }, /* Endpoint: 1, Cluster: Basic (server) */                                                                          \
             { 0x0006,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(7),                                                                                              \
+              ZAP_ATTRIBUTE_INDEX(16),                                                                                             \
               6,                                                                                                                   \
               9,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */                                              \
             { 0x0008,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(13),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(22),                                                                                             \
               5,                                                                                                                   \
               7,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayLevelControlServer }, /* Endpoint: 2, Cluster: Level Control (server) */                                \
+            {                                                                                                                      \
+                0x0028, ZAP_ATTRIBUTE_INDEX(27), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
+            }, /* Endpoint: 2, Cluster: Basic (server) */                                                                          \
             { 0x0006,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(18),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(39),                                                                                             \
               6,                                                                                                                   \
               9,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayOnOffServer }, /* Endpoint: 3, Cluster: On/off (server) */                                              \
             { 0x0008,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(24),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(45),                                                                                             \
               5,                                                                                                                   \
               7,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 1, 4 }, { ZAP_CLUSTER_INDEX(1), 2, 6 }, { ZAP_CLUSTER_INDEX(3), 2, 16 },                           \
-            { ZAP_CLUSTER_INDEX(5), 2, 16 },                                                                                       \
+        { ZAP_CLUSTER_INDEX(0), 0, 0 }, { ZAP_CLUSTER_INDEX(0), 3, 260 }, { ZAP_CLUSTER_INDEX(3), 3, 270 },                        \
+            { ZAP_CLUSTER_INDEX(6), 2, 16 },                                                                                       \
     }
 
 // Largest attribute size is needed for various buffers
-#define ATTRIBUTE_LARGEST (3)
+#define ATTRIBUTE_LARGEST (64)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (4)
+#define ATTRIBUTE_SINGLETONS_SIZE (508)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (42)
+#define ATTRIBUTE_MAX_SIZE (546)
 
 // Number of fixed endpoints
 #define FIXED_ENDPOINT_COUNT (4)
 
 // Array of EmberAfCommandMetadata structs.
 #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
-#define EMBER_AF_GENERATED_COMMAND_COUNT (40)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (45)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Basic (server): ResetToFactoryDefaults */                      \
-            { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): Off */                                        \
+        { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* On/off (server): Off */                                        \
             { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): Off */                                        \
             { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): Off */                                        \
             { 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): On */                                         \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StopWithOnOff */                       \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StopWithOnOff */                       \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StopWithOnOff */                       \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
     }
 
 // Array of EmberAfManufacturerCodeEntry structures for commands.
index 5aa3207..3f145a5 100644 (file)
@@ -29,7 +29,7 @@
 #define EMBER_APS_UNICAST_MESSAGE_COUNT 10
 
 /**** Cluster endpoint counts ****/
-#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)
+#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (2)
 #define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (3)
 #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (3)
 
index 86a2a27..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #define CHIP_PRINTCLUSTER_IAS_WD_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_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
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
index fc5d18a..7857436 100644 (file)
@@ -168,7 +168,7 @@ int main(int argc, char * argv[])
 
     chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName(nullptr); // Use default device name (CHIP-XXXX)
 
-#ifdef CONFIG_NETWORK_BLE
+#if CONFIG_NETWORK_LAYER_BLE
     chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureBle(LinuxDeviceOptions::GetInstance().mBleDevice, false);
 #endif
 
diff --git a/examples/chip-tool/build b/examples/chip-tool/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
index 251ee0f..55a9cdb 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "writeTime": "Mon Mar 08 2021 19:20:08 GMT+0100 (Central European Standard Time)",
+  "writeTime": "Thu Mar 11 2021 18:15:06 GMT+0100 (Central European Standard Time)",
   "featureLevel": 11,
   "creator": "zap",
   "keyValuePairs": [
       "deviceTypeProfileId": 259,
       "clusters": [
         {
-          "name": "Basic",
-          "code": 0,
+          "name": "Identify",
+          "code": 3,
           "mfgCode": null,
-          "define": "BASIC_CLUSTER",
+          "define": "IDENTIFY_CLUSTER",
           "side": "client",
           "enabled": 1,
           "commands": [
             {
-              "name": "ResetToFactoryDefaults",
+              "name": "Identify",
               "code": 0,
               "mfgCode": null,
               "source": "client",
               "outgoing": 1
             },
             {
-              "name": "MfgSpecificPing",
-              "code": 0,
-              "mfgCode": "4098",
+              "name": "IdentifyQuery",
+              "code": 1,
+              "mfgCode": null,
               "source": "client",
-              "incoming": 0,
+              "incoming": 1,
               "outgoing": 1
             }
           ],
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "server",
-          "enabled": 0,
-          "commands": [],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "ZCL version",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x08",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "power source",
-              "code": 7,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Identify",
-          "code": 3,
-          "mfgCode": null,
-          "define": "IDENTIFY_CLUSTER",
-          "side": "client",
-          "enabled": 1,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
               "defaultValue": "2",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "Identify",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "IdentifyQuery",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           ]
         },
         {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "client",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "MfgSpecificPing",
+              "code": 0,
+              "mfgCode": "4098",
+              "source": "client",
+              "incoming": 0,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "server",
+          "enabled": 0,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 0,
+              "outgoing": 0
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 0,
+              "outgoing": 0
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 0,
+              "outgoing": 0
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "InteractionModelVersion",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
           "name": "General Commissioning",
           "code": 48,
           "mfgCode": null,
           "define": "GENERAL_COMMISSIONING_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [
+            {
+              "name": "SetFabricResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ArmFailSafeResponse",
+              "code": 3,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "CommissioningCompleteResponse",
+              "code": 7,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "SetFabricResponse",
-              "code": 1,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "ArmFailSafeResponse",
-              "code": 3,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "CommissioningCompleteResponse",
-              "code": 7,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "BARRIER_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 1,
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ],
           "commands": [
             {
               "name": "BarrierControlGoToPercent",
               "incoming": 1,
               "outgoing": 1
             }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x0001",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
           ]
         },
         {
           "define": "COLOR_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 1,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "MoveToHue",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
           "define": "MEDIA_PLAYBACK_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [
+            {
+              "name": "Playback",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "Playback",
-              "code": 0,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "CONTENT_LAUNCH_CLUSTER",
           "side": "client",
           "enabled": 1,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x0001",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "LaunchContent",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
index d13563c..4f407a3 100644 (file)
@@ -25,7 +25,6 @@
 #include "gen/CHIPClientCallbacks.h"
 #include <controller/CHIPClusters.h>
 #include <lib/core/CHIPSafeCasts.h>
-#include <lib/support/Span.h>
 
 static void OnDefaultSuccessResponse(void * context)
 {
@@ -43,12 +42,6 @@ static void OnDefaultFailureResponse(void * context, uint8_t status)
     command->SetCommandExitStatus(false);
 }
 
-typedef void (*UnsupportedAttributeCallback)(void * context);
-static void OnUnsupportedAttributeResponse(void * context)
-{
-    ChipLogError(chipTool, "Unsupported attribute Response. This should never happen !");
-}
-
 static void OnBooleanAttributeResponse(void * context, bool value)
 {
     ChipLogProgress(chipTool, "Boolean attribute Response: %d", value);
@@ -73,9 +66,9 @@ static void OnInt16uAttributeResponse(void * context, uint16_t value)
     command->SetCommandExitStatus(true);
 }
 
-static void OnInt16sAttributeResponse(void * context, int16_t value)
+static void OnInt32uAttributeResponse(void * context, uint32_t value)
 {
-    ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value);
+    ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value);
 
     ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
     command->SetCommandExitStatus(true);
@@ -89,6 +82,27 @@ static void OnInt64uAttributeResponse(void * context, uint64_t value)
     command->SetCommandExitStatus(true);
 }
 
+static void OnInt16sAttributeResponse(void * context, int16_t value)
+{
+    ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value);
+
+    ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
+    command->SetCommandExitStatus(true);
+}
+
+static void OnStringAttributeResponse(void * context, const chip::ByteSpan value)
+{
+    char * str = (char *) malloc(value.size() * sizeof(char));
+    memmove(str, value.data(), value.size());
+    str[value.size()] = '\0';
+    free(str);
+
+    ChipLogProgress(chipTool, "String attribute Response: %s (%" PRIu16 ")", str, strlen(str));
+
+    ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
+    command->SetCommandExitStatus(true);
+}
+
 static void OnContentLaunchClusterLaunchContentResponse(void * context, uint8_t contentLaunchStatus)
 {
     ChipLogProgress(chipTool, "ContentLaunchClusterLaunchContentResponse");
@@ -414,7 +428,7 @@ static void OnScenesClusterViewSceneResponse(void * context, uint16_t groupId, u
 |---------------------------------------------------------------------+--------|
 | ApplicationBasic                                                    | 0x050D |
 | BarrierControl                                                      | 0x0103 |
-| Basic                                                               | 0x0000 |
+| Basic                                                               | 0x0028 |
 | Binding                                                             | 0xF000 |
 | ColorControl                                                        | 0x0300 |
 | ContentLaunch                                                       | 0xF002 |
@@ -432,7 +446,7 @@ static void OnScenesClusterViewSceneResponse(void * context, uint16_t groupId, u
 
 constexpr chip::ClusterId kApplicationBasicClusterId       = 0x050D;
 constexpr chip::ClusterId kBarrierControlClusterId         = 0x0103;
-constexpr chip::ClusterId kBasicClusterId                  = 0x0000;
+constexpr chip::ClusterId kBasicClusterId                  = 0x0028;
 constexpr chip::ClusterId kBindingClusterId                = 0xF000;
 constexpr chip::ClusterId kColorControlClusterId           = 0x0300;
 constexpr chip::ClusterId kContentLaunchClusterId          = 0xF002;
@@ -509,8 +523,8 @@ public:
     }
 
 private:
-    chip::Callback::Callback<UnsupportedAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<UnsupportedAttributeCallback>(OnUnsupportedAttributeResponse, this);
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
 };
@@ -565,8 +579,8 @@ public:
     }
 
 private:
-    chip::Callback::Callback<UnsupportedAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<UnsupportedAttributeCallback>(OnUnsupportedAttributeResponse, this);
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
 };
@@ -621,8 +635,8 @@ public:
     }
 
 private:
-    chip::Callback::Callback<UnsupportedAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<UnsupportedAttributeCallback>(OnUnsupportedAttributeResponse, this);
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
 };
@@ -944,15 +958,23 @@ private:
 };
 
 /*----------------------------------------------------------------------------*\
-| Cluster Basic                                                       | 0x0000 |
+| Cluster Basic                                                       | 0x0028 |
 |------------------------------------------------------------------------------|
 | Commands:                                                           |        |
 | * MfgSpecificPing                                                   |   0x00 |
-| * ResetToFactoryDefaults                                            |   0x00 |
 |------------------------------------------------------------------------------|
 | Attributes:                                                         |        |
-| * ZclVersion                                                        | 0x0000 |
-| * PowerSource                                                       | 0x0007 |
+| * InteractionModelVersion                                           | 0x0000 |
+| * VendorName                                                        | 0x0001 |
+| * VendorID                                                          | 0x0002 |
+| * ProductName                                                       | 0x0003 |
+| * ProductID                                                         | 0x0004 |
+| * UserLabel                                                         | 0x0005 |
+| * Location                                                          | 0x0006 |
+| * HardwareVersion                                                   | 0x0007 |
+| * HardwareVersionString                                             | 0x0008 |
+| * SoftwareVersion                                                   | 0x0009 |
+| * SoftwareVersionString                                             | 0x000A |
 | * ClusterRevision                                                   | 0xFFFD |
 \*----------------------------------------------------------------------------*/
 
@@ -966,7 +988,7 @@ public:
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x00) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
 
         chip::Controller::BasicCluster cluster;
         cluster.Associate(device, endpointId);
@@ -981,20 +1003,20 @@ private:
 };
 
 /*
- * Command ResetToFactoryDefaults
+ * Discover Attributes
  */
-class BasicResetToFactoryDefaults : public ModelCommand
+class DiscoverBasicAttributes : public ModelCommand
 {
 public:
-    BasicResetToFactoryDefaults() : ModelCommand("reset-to-factory-defaults") { ModelCommand::AddArguments(); }
+    DiscoverBasicAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x00) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
 
         chip::Controller::BasicCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.ResetToFactoryDefaults(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+        return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
     }
 
 private:
@@ -1005,20 +1027,191 @@ private:
 };
 
 /*
- * Discover Attributes
+ * Attribute InteractionModelVersion
  */
-class DiscoverBasicAttributes : public ModelCommand
+class ReadBasicInteractionModelVersion : public ModelCommand
 {
 public:
-    DiscoverBasicAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
+    ReadBasicInteractionModelVersion() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "interaction-model-version");
+        ModelCommand::AddArguments();
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
 
         chip::Controller::BasicCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+        return cluster.ReadAttributeInteractionModelVersion(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 VendorName
+ */
+class ReadBasicVendorName : public ModelCommand
+{
+public:
+    ReadBasicVendorName() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "vendor-name");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeVendorName(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+    }
+
+private:
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
+    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
+        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
+};
+
+/*
+ * Attribute VendorID
+ */
+class ReadBasicVendorID : public ModelCommand
+{
+public:
+    ReadBasicVendorID() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "vendor-id");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeVendorID(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 ProductName
+ */
+class ReadBasicProductName : public ModelCommand
+{
+public:
+    ReadBasicProductName() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "product-name");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeProductName(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+    }
+
+private:
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
+    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
+        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
+};
+
+/*
+ * Attribute ProductID
+ */
+class ReadBasicProductID : public ModelCommand
+{
+public:
+    ReadBasicProductID() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "product-id");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeProductID(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 UserLabel
+ */
+class ReadBasicUserLabel : public ModelCommand
+{
+public:
+    ReadBasicUserLabel() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "user-label");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeUserLabel(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+    }
+
+private:
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
+    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
+        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
+};
+
+class WriteBasicUserLabel : public ModelCommand
+{
+public:
+    WriteBasicUserLabel() : ModelCommand("write")
+    {
+        AddArgument("attr-name", "user-label");
+        AddArgument("attr-value", &mValue);
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x01) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.WriteAttributeUserLabel(onSuccessCallback->Cancel(), onFailureCallback->Cancel(),
+                                               chip::ByteSpan(chip::Uint8::from_char(mValue), strlen(mValue)));
     }
 
 private:
@@ -1026,60 +1219,173 @@ private:
         new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
+    char * mValue;
 };
 
 /*
- * Attribute ZclVersion
+ * Attribute Location
  */
-class ReadBasicZclVersion : public ModelCommand
+class ReadBasicLocation : public ModelCommand
 {
 public:
-    ReadBasicZclVersion() : ModelCommand("read")
+    ReadBasicLocation() : ModelCommand("read")
     {
-        AddArgument("attr-name", "zcl-version");
+        AddArgument("attr-name", "location");
         ModelCommand::AddArguments();
     }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x00) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
 
         chip::Controller::BasicCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.ReadAttributeZclVersion(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+        return cluster.ReadAttributeLocation(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
     }
 
 private:
-    chip::Callback::Callback<Int8uAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<Int8uAttributeCallback>(OnInt8uAttributeResponse, this);
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
 };
 
+class WriteBasicLocation : public ModelCommand
+{
+public:
+    WriteBasicLocation() : ModelCommand("write")
+    {
+        AddArgument("attr-name", "location");
+        AddArgument("attr-value", &mValue);
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x01) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.WriteAttributeLocation(onSuccessCallback->Cancel(), onFailureCallback->Cancel(),
+                                              chip::ByteSpan(chip::Uint8::from_char(mValue), strlen(mValue)));
+    }
+
+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);
+    char * mValue;
+};
+
 /*
- * Attribute PowerSource
+ * Attribute HardwareVersion
  */
-class ReadBasicPowerSource : public ModelCommand
+class ReadBasicHardwareVersion : public ModelCommand
 {
 public:
-    ReadBasicPowerSource() : ModelCommand("read")
+    ReadBasicHardwareVersion() : ModelCommand("read")
     {
-        AddArgument("attr-name", "power-source");
+        AddArgument("attr-name", "hardware-version");
         ModelCommand::AddArguments();
     }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x00) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
 
         chip::Controller::BasicCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.ReadAttributePowerSource(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+        return cluster.ReadAttributeHardwareVersion(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
     }
 
 private:
-    chip::Callback::Callback<Int8uAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<Int8uAttributeCallback>(OnInt8uAttributeResponse, this);
+    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 HardwareVersionString
+ */
+class ReadBasicHardwareVersionString : public ModelCommand
+{
+public:
+    ReadBasicHardwareVersionString() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "hardware-version-string");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeHardwareVersionString(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+    }
+
+private:
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
+    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
+        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
+};
+
+/*
+ * Attribute SoftwareVersion
+ */
+class ReadBasicSoftwareVersion : public ModelCommand
+{
+public:
+    ReadBasicSoftwareVersion() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "software-version");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeSoftwareVersion(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+    }
+
+private:
+    chip::Callback::Callback<Int32uAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<Int32uAttributeCallback>(OnInt32uAttributeResponse, this);
+    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
+        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
+};
+
+/*
+ * Attribute SoftwareVersionString
+ */
+class ReadBasicSoftwareVersionString : public ModelCommand
+{
+public:
+    ReadBasicSoftwareVersionString() : ModelCommand("read")
+    {
+        AddArgument("attr-name", "software-version-string");
+        ModelCommand::AddArguments();
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
+
+        chip::Controller::BasicCluster cluster;
+        cluster.Associate(device, endpointId);
+        return cluster.ReadAttributeSoftwareVersionString(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+    }
+
+private:
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
 };
@@ -1098,7 +1404,7 @@ public:
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x00) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
 
         chip::Controller::BasicCluster cluster;
         cluster.Associate(device, endpointId);
@@ -2218,8 +2524,8 @@ public:
     }
 
 private:
-    chip::Callback::Callback<UnsupportedAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<UnsupportedAttributeCallback>(OnUnsupportedAttributeResponse, this);
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
 };
@@ -4424,7 +4730,8 @@ public:
 
         chip::Controller::DoorLockCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.LockDoor(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mPin);
+        return cluster.LockDoor(onSuccessCallback->Cancel(), onFailureCallback->Cancel(),
+                                chip::ByteSpan(chip::Uint8::from_char(mPin), strlen(mPin)));
     }
 
 private:
@@ -4493,7 +4800,8 @@ public:
 
         chip::Controller::DoorLockCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.SetPin(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId, mUserStatus, mUserType, mPin);
+        return cluster.SetPin(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId, mUserStatus, mUserType,
+                              chip::ByteSpan(chip::Uint8::from_char(mPin), strlen(mPin)));
     }
 
 private:
@@ -4528,7 +4836,8 @@ public:
 
         chip::Controller::DoorLockCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.SetRfid(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId, mUserStatus, mUserType, mId);
+        return cluster.SetRfid(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId, mUserStatus, mUserType,
+                               chip::ByteSpan(chip::Uint8::from_char(mId), strlen(mId)));
     }
 
 private:
@@ -4671,7 +4980,8 @@ public:
 
         chip::Controller::DoorLockCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.UnlockDoor(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mPin);
+        return cluster.UnlockDoor(onSuccessCallback->Cancel(), onFailureCallback->Cancel(),
+                                  chip::ByteSpan(chip::Uint8::from_char(mPin), strlen(mPin)));
     }
 
 private:
@@ -4701,7 +5011,8 @@ public:
 
         chip::Controller::DoorLockCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.UnlockWithTimeout(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mTimeoutInSeconds, mPin);
+        return cluster.UnlockWithTimeout(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mTimeoutInSeconds,
+                                         chip::ByteSpan(chip::Uint8::from_char(mPin), strlen(mPin)));
     }
 
 private:
@@ -5048,8 +5359,8 @@ public:
     }
 
 private:
-    chip::Callback::Callback<UnsupportedAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<UnsupportedAttributeCallback>(OnUnsupportedAttributeResponse, this);
+    chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
+        new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
     chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
         new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
 };
@@ -5172,7 +5483,8 @@ public:
 
         chip::Controller::GroupsCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.AddGroup(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId, mGroupName);
+        return cluster.AddGroup(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId,
+                                chip::ByteSpan(chip::Uint8::from_char(mGroupName), strlen(mGroupName)));
     }
 
 private:
@@ -5203,7 +5515,8 @@ public:
 
         chip::Controller::GroupsCluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.AddGroupIfIdentifying(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId, mGroupName);
+        return cluster.AddGroupIfIdentifying(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId,
+                                             chip::ByteSpan(chip::Uint8::from_char(mGroupName), strlen(mGroupName)));
     }
 
 private:
@@ -6657,7 +6970,8 @@ public:
         chip::Controller::ScenesCluster cluster;
         cluster.Associate(device, endpointId);
         return cluster.AddScene(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId, mSceneId, mTransitionTime,
-                                mSceneName, mClusterId, mLength, mValue);
+                                chip::ByteSpan(chip::Uint8::from_char(mSceneName), strlen(mSceneName)), mClusterId, mLength,
+                                mValue);
     }
 
 private:
@@ -7275,8 +7589,22 @@ void registerClusterBasic(Commands & commands)
     const char * clusterName = "Basic";
 
     commands_list clusterCommands = {
-        make_unique<BasicMfgSpecificPing>(), make_unique<BasicResetToFactoryDefaults>(), make_unique<DiscoverBasicAttributes>(),
-        make_unique<ReadBasicZclVersion>(),  make_unique<ReadBasicPowerSource>(),        make_unique<ReadBasicClusterRevision>(),
+        make_unique<BasicMfgSpecificPing>(),
+        make_unique<DiscoverBasicAttributes>(),
+        make_unique<ReadBasicInteractionModelVersion>(),
+        make_unique<ReadBasicVendorName>(),
+        make_unique<ReadBasicVendorID>(),
+        make_unique<ReadBasicProductName>(),
+        make_unique<ReadBasicProductID>(),
+        make_unique<ReadBasicUserLabel>(),
+        make_unique<WriteBasicUserLabel>(),
+        make_unique<ReadBasicLocation>(),
+        make_unique<WriteBasicLocation>(),
+        make_unique<ReadBasicHardwareVersion>(),
+        make_unique<ReadBasicHardwareVersionString>(),
+        make_unique<ReadBasicSoftwareVersion>(),
+        make_unique<ReadBasicSoftwareVersionString>(),
+        make_unique<ReadBasicClusterRevision>(),
     };
 
     commands.Register(clusterName, clusterCommands);
diff --git a/examples/chip-tool/commands/clusters/ModelCommandResponse.h b/examples/chip-tool/commands/clusters/ModelCommandResponse.h
deleted file mode 100644 (file)
index e47f229..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *   Copyright (c) 2020 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
-
-class ModelCommandResponse
-{
-public:
-    ModelCommandResponse(uint8_t commandId) : mCommandId(commandId) {}
-    virtual ~ModelCommandResponse() {}
-
-    bool HandleCommandResponse(uint8_t commandId, uint8_t * message, uint16_t messageLen)
-    {
-        if (commandId != mCommandId)
-        {
-            ChipLogError(chipTool, "Unexpected command response id: '0x%02x'. Expecting: '0x%02x'", commandId, mCommandId);
-            return false;
-        }
-        return HandleResponse(message, messageLen);
-    }
-
-    virtual bool HandleResponse(uint8_t * message, uint16_t messageLen) const = 0;
-
-private:
-    const uint8_t mCommandId;
-};
diff --git a/examples/chip-tool/commands/common/Logging.cpp b/examples/chip-tool/commands/common/Logging.cpp
deleted file mode 100644 (file)
index 9830ec3..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *   Copyright (c) 2020 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 <support/CodeUtils.h>
-#include <support/logging/CHIPLogging.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-using namespace ::chip::Logging;
-
-constexpr LogCategory kDefaultLoggingLevel = kLogCategory_Detail;
-
-void ConfigureChipLogging()
-{
-    LogCategory chipLogLevel = kDefaultLoggingLevel;
-
-    const char * level = getenv("CHIP_LOG_LEVEL");
-    VerifyOrExit(level != NULL, /**/);
-
-    if (strcasecmp(level, "none") == 0)
-    {
-        chipLogLevel = kLogCategory_None;
-    }
-    else if (strcasecmp(level, "error") == 0)
-    {
-        chipLogLevel = kLogCategory_Error;
-    }
-    else if (strcasecmp(level, "progress") == 0)
-    {
-        chipLogLevel = kLogCategory_Progress;
-    }
-    else if (strcasecmp(level, "detail") == 0)
-    {
-        chipLogLevel = kLogCategory_Detail;
-    }
-    else if (strcasecmp(level, "retain") == 0)
-    {
-        chipLogLevel = kLogCategory_Retain;
-    }
-
-exit:
-    SetLogFilter(chipLogLevel);
-}
diff --git a/examples/chip-tool/commands/common/Logging.h b/examples/chip-tool/commands/common/Logging.h
deleted file mode 100644 (file)
index c289320..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- *   Copyright (c) 2020 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
-
-void ConfigureChipLogging();
diff --git a/examples/chip-tool/commands/common/NetworkCommand.cpp b/examples/chip-tool/commands/common/NetworkCommand.cpp
deleted file mode 100644 (file)
index e79cc7f..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *   Copyright (c) 2020 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 "NetworkCommand.h"
-
-using namespace ::chip;
-
-constexpr uint16_t kWaitDurationInSeconds = 10;
-
-// Make sure our buffer is big enough, but this will need a better setup!
-constexpr uint16_t kMaxBufferSize = 1024;
-
-CHIP_ERROR NetworkCommand::Run(PersistentStorage & storage, NodeId localId, NodeId remoteId)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    err = mCommissioner.Init(localId, &storage);
-    VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Controller, "Init failure! Commissioner: %s", chip::ErrorStr(err)));
-
-    err = mCommissioner.ServiceEvents();
-    VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Controller, "Init failure! Run Loop: %s", chip::ErrorStr(err)));
-
-    err = RunInternal(remoteId);
-    SuccessOrExit(err);
-
-    VerifyOrExit(GetCommandExitStatus(), err = CHIP_ERROR_INTERNAL);
-
-exit:
-    mCommissioner.ServiceEventSignal();
-    mCommissioner.Shutdown();
-    return err;
-}
-
-CHIP_ERROR NetworkCommand::RunInternal(NodeId remoteId)
-{
-    ChipDevice * device;
-    CHIP_ERROR err = mCommissioner.GetDevice(remoteId, &device);
-    VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(chipTool, "Could not find a paired device. Are you sure it has been paired ?"));
-
-    device->SetDelegate(this);
-
-    err = RunCommandInternal(device);
-    SuccessOrExit(err);
-
-    UpdateWaitForResponse(true);
-    WaitForResponse(kWaitDurationInSeconds);
-
-exit:
-    return err;
-}
-
-CHIP_ERROR NetworkCommand::RunCommandInternal(ChipDevice * device)
-{
-    CHIP_ERROR err      = CHIP_NO_ERROR;
-    uint16_t payloadLen = 0;
-
-    PacketBufferHandle buffer = PacketBuffer::NewWithAvailableSize(kMaxBufferSize);
-    VerifyOrExit(!buffer.IsNull(), err = CHIP_ERROR_NO_MEMORY);
-
-    payloadLen = Encode(buffer, kMaxBufferSize);
-    VerifyOrExit(payloadLen != 0, err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-
-    buffer->SetDataLength(payloadLen);
-
-#ifdef DEBUG
-    PrintBuffer(buffer);
-#endif
-
-    err = device->SendMessage(std::move(buffer));
-    VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(chipTool, "Failed to send message: %s", ErrorStr(err)));
-
-exit:
-    return err;
-}
-
-void NetworkCommand::OnMessage(PacketBufferHandle buffer)
-{
-    ChipLogDetail(chipTool, "OnMessage: Received %zu bytes", buffer->DataLength());
-
-    SetCommandExitStatus(Decode(buffer));
-    UpdateWaitForResponse(false);
-}
-
-void NetworkCommand::OnStatusChange(void)
-{
-    ChipLogProgress(chipTool, "DeviceStatusDelegate::OnStatusChange");
-}
-
-void NetworkCommand::PrintBuffer(PacketBufferHandle & buffer) const
-{
-    const size_t data_len = buffer->DataLength();
-
-    fprintf(stderr, "SENDING: %zu ", data_len);
-    for (size_t i = 0; i < data_len; ++i)
-    {
-        fprintf(stderr, "%d ", buffer->Start()[i]);
-    }
-    fprintf(stderr, "\n");
-}
diff --git a/examples/chip-tool/commands/common/NetworkCommand.h b/examples/chip-tool/commands/common/NetworkCommand.h
deleted file mode 100644 (file)
index d520f6d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *   Copyright (c) 2020 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 "../../config/PersistentStorage.h"
-#include "Command.h"
-
-class NetworkCommand : public Command, public chip::Controller::DeviceStatusDelegate
-{
-public:
-    NetworkCommand(const char * commandName) : Command(commandName) {}
-
-    virtual uint16_t Encode(PacketBufferHandle & buffer, uint16_t bufferSize) = 0;
-    virtual bool Decode(PacketBufferHandle & buffer) const                    = 0;
-
-    /////////// Command Interface /////////
-    CHIP_ERROR Run(PersistentStorage & storage, NodeId localId, NodeId remoteId) override;
-
-    /////////// DeviceStatusDelegate Interface /////////
-    void OnMessage(PacketBufferHandle buffer) override;
-    void OnStatusChange(void) override;
-
-private:
-    CHIP_ERROR RunInternal(NodeId remoteId);
-    CHIP_ERROR RunCommandInternal(ChipDevice * device);
-
-    void PrintBuffer(PacketBufferHandle & buffer) const;
-
-    ChipDeviceCommissioner mCommissioner;
-};
diff --git a/examples/chip-tool/commands/echo/Commands.h b/examples/chip-tool/commands/echo/Commands.h
deleted file mode 100644 (file)
index a9702db..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *   Copyright (c) 2020 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 "EchoCommand.h"
-
-class Echo : public EchoCommand
-{
-public:
-    Echo() : EchoCommand("ip") {}
-};
-
-void registerCommandsEcho(Commands & commands)
-{
-    const char * clusterName = "Echo";
-
-    commands_list clusterCommands = {
-        make_unique<Echo>(),
-    };
-
-    commands.Register(clusterName, clusterCommands);
-}
diff --git a/examples/chip-tool/commands/echo/EchoCommand.cpp b/examples/chip-tool/commands/echo/EchoCommand.cpp
deleted file mode 100644 (file)
index 04e2fe2..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *   Copyright (c) 2020 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 "EchoCommand.h"
-
-using namespace ::chip;
-
-namespace {
-static const char PAYLOAD[] = "Message from Standalone CHIP echo client!";
-
-bool IsIdenticalMessage(System::PacketBufferHandle & buffer)
-{
-    size_t dataLen = buffer->DataLength();
-    return (dataLen + 1 == sizeof PAYLOAD) && (memcmp(buffer->Start(), PAYLOAD, dataLen) == 0);
-}
-} // namespace
-
-uint16_t EchoCommand::Encode(PacketBufferHandle & buffer, uint16_t bufferSize)
-{
-    uint16_t payloadLen = 0;
-
-    if (strlen(PAYLOAD) > bufferSize)
-    {
-        ChipLogError(chipTool, "PAYLOAD length too big for PacketBuffer (> bufferSize)");
-    }
-    else
-    {
-        payloadLen = static_cast<uint16_t>(strlen(PAYLOAD));
-        memcpy(buffer->Start(), PAYLOAD, payloadLen);
-    }
-
-    return payloadLen;
-}
-
-bool EchoCommand::Decode(PacketBufferHandle & buffer) const
-{
-    bool success = IsIdenticalMessage(buffer);
-
-    if (!success)
-    {
-        ChipLogError(chipTool, "Echo: Error \nSend: %s \nRecv: %.*s", PAYLOAD, buffer->DataLength(), buffer->Start());
-    }
-
-    return success;
-}
diff --git a/examples/chip-tool/commands/echo/EchoCommand.h b/examples/chip-tool/commands/echo/EchoCommand.h
deleted file mode 100644 (file)
index 5ce008d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *   Copyright (c) 2020 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 "../common/NetworkCommand.h"
-
-class EchoCommand : public NetworkCommand
-{
-public:
-    EchoCommand(const char * commandName) : NetworkCommand(commandName) {}
-
-    /////////// NetworkCommand Interface /////////
-    uint16_t Encode(PacketBufferHandle & buffer, uint16_t bufferSize) override;
-    bool Decode(PacketBufferHandle & buffer) const override;
-};
index 952cbc6..71fe6c6 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -1489,10 +1527,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -1503,6 +1537,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index ae3e2fc..00c37b8 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,6 +34,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
index d1a3997..847dc97 100644 (file)
@@ -83,10 +83,20 @@ NS_ASSUME_NONNULL_BEGIN
 @interface CHIPBasic : CHIPCluster
 
 - (void)mfgSpecificPing:(ResponseHandler)completionHandler;
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler;
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler;
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler;
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
 
 @end
@@ -323,7 +333,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 - (void)setHolidaySchedule:(uint8_t)scheduleId
                 localStartTime:(uint32_t)localStartTime
                   localEndTime:(uint32_t)localEndTime
@@ -332,12 +342,12 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler;
 - (void)setWeekdaySchedule:(uint8_t)scheduleId
@@ -353,8 +363,8 @@ NS_ASSUME_NONNULL_BEGIN
             localStartTime:(uint32_t)localStartTime
               localEndTime:(uint32_t)localEndTime
          completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 
 - (void)readAttributeLockState:(ResponseHandler)completionHandler;
 - (void)configureAttributeLockState:(uint16_t)minInterval
@@ -397,8 +407,10 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @interface CHIPGroups : CHIPCluster
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroupIfIdentifying:(uint16_t)groupId
+                    groupName:(NSString *)groupName
+            completionHandler:(ResponseHandler)completionHandler;
 - (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler;
 - (void)removeAllGroups:(ResponseHandler)completionHandler;
 - (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler;
@@ -529,7 +541,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
index 28dab3d..cd60722 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -1599,8 +1645,8 @@ private:
 
 - (void)readAttributeVendorName:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1646,8 +1692,8 @@ private:
 
 - (void)readAttributeApplicationName:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1693,8 +1739,8 @@ private:
 
 - (void)readAttributeApplicationId:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1992,7 +2038,149 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
+
+- (void)readAttributeInteractionModelVersion:(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.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorID:(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.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductID:(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.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2007,7 +2195,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2015,9 +2205,10 @@ private:
     }
 }
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2030,7 +2221,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2038,9 +2229,105 @@ private:
     }
 }
 
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersion:(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.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
+{
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(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.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2053,7 +2340,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2881,8 +3168,8 @@ private:
 
 - (void)readAttributeCompensationText:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4674,7 +4961,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -4690,7 +4977,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4728,7 +5017,7 @@ private:
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterSetPinResponseCallbackBridge * onSuccess
@@ -4745,7 +5034,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, pin);
+    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4755,7 +5046,7 @@ private:
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterSetRfidResponseCallbackBridge * onSuccess
@@ -4772,7 +5063,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, id);
+    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4861,7 +5154,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -4877,14 +5170,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -4900,7 +5195,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds, pin);
+    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -5137,8 +5434,8 @@ private:
 
 - (void)readAttributeFabricId:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -5241,7 +5538,7 @@ private:
     return &_cppCluster;
 }
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
 {
     CHIPGroupsClusterAddGroupResponseCallbackBridge * onSuccess
         = new CHIPGroupsClusterAddGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -5257,14 +5554,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -5279,7 +5578,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -6373,7 +6674,7 @@ private:
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
@@ -6393,8 +6694,10 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddScene(
-        onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, sceneName, clusterId, length, value);
+    CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime,
+        chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]),
+        clusterId, length, value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
index 3ab0310..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index c4f2f0a..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
index 2069290..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
index 655425d..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
index 2b8eb4c..482e761 100644 (file)
 #define GENERATED_ATTRIBUTE_COUNT 16
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
-        { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 } }, /* Basic (client): cluster revision */     \
-            {                                                                                                                      \
-                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 2 }                                         \
-            }, /* Identify (client): cluster revision */                                                                           \
+        { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 2 } }, /* Identify (client): cluster revision */  \
             {                                                                                                                      \
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 }                                         \
             }, /* Groups (client): cluster revision */                                                                             \
@@ -75,6 +72,9 @@
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 }                                         \
             }, /* Level Control (client): cluster revision */                                                                      \
             {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT) | ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }         \
+            }, /* Basic (client): cluster revision */                                                                              \
+            {                                                                                                                      \
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 0x0001 }                                    \
             }, /* General Commissioning (client): cluster revision */                                                              \
             {                                                                                                                      \
 #define GENERATED_CLUSTER_COUNT 16
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */       \
-            {                                                                                                                      \
-                0x0003, ZAP_ATTRIBUTE_INDEX(1), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
-            }, /* Endpoint: 1, Cluster: Identify (client) */                                                                       \
-            { 0x0004, ZAP_ATTRIBUTE_INDEX(2), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Groups (client) */  \
-            { 0x0005, ZAP_ATTRIBUTE_INDEX(3), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Scenes (client) */  \
-            { 0x0006, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: On/off (client) */  \
+        { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */    \
+            { 0x0004, ZAP_ATTRIBUTE_INDEX(1), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Groups (client) */  \
+            { 0x0005, ZAP_ATTRIBUTE_INDEX(2), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Scenes (client) */  \
+            { 0x0006, ZAP_ATTRIBUTE_INDEX(3), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: On/off (client) */  \
             {                                                                                                                      \
-                0x0008, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
+                0x0008, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
             }, /* Endpoint: 1, Cluster: Level Control (client) */                                                                  \
+            { 0x0028, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */   \
             {                                                                                                                      \
                 0x0030, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
             }, /* Endpoint: 1, Cluster: General Commissioning (client) */                                                          \
 #define ATTRIBUTE_LARGEST (2)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (0)
+#define ATTRIBUTE_SINGLETONS_SIZE (2)
 
 // Total size of attribute storage
 #define ATTRIBUTE_MAX_SIZE (32)
 
 // Array of EmberAfCommandMetadata structs.
 #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
-#define EMBER_AF_GENERATED_COMMAND_COUNT (127)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (129)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, 0x00, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Basic (client): MfgSpecificPing */                                 \
-            {                                                                                                                      \
-                0x0000, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT)                                \
-            },                                                   /* Basic (client): ResetToFactoryDefaults */                      \
-            { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): Identify */                                 \
+        { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (client): Identify */                                 \
             { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Identify (client): IdentifyQueryResponse */                    \
             { 0x0003, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): IdentifyQuery */                            \
             { 0x0004, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Groups (client): AddGroup */                                   \
             { 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (client): MoveWithOnOff */                       \
             { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (client): StepWithOnOff */                       \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (client): StopWithOnOff */                       \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Basic (client): MfgSpecificPing */                             \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (client): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (client): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (client): Leave */                                       \
             { 0x0030, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (client): SetFabric */                   \
             { 0x0030, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* General Commissioning (client): SetFabricResponse */           \
             { 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (client): ArmFailSafe */                 \
 #define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT (1)
 #define GENERATED_COMMAND_MANUFACTURER_CODES                                                                                       \
     {                                                                                                                              \
-        { 0, 4098 },                                                                                                               \
+        { 37, 4098 },                                                                                                              \
     }
 
 // This is an array of EmberAfManufacturerCodeEntry structures for clusters.
 #define ZRD(x) EMBER_ZCL_REPORTING_DIRECTION_##x
 #define ZAP_REPORT_DIRECTION(x) ZRD(x)
 
-// 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 (1)
-#define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS
-
-#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (1)
+#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (0)
 #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS                                                                               \
     {                                                                                                                              \
-        {                                                                                                                          \
-            ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0000, 0xFFFD, ZAP_CLUSTER_MASK(CLIENT), 0x0000, { { 0, 65344, 0 } }          \
-        }, /* Reporting for cluster: "Basic", attribute: "cluster revision". side: client */                                       \
     }
index 1ea3151..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
index d59fb1e..2f4623a 100644 (file)
@@ -7,7 +7,6 @@
 #include "ModelCommand.h"
 #include "gen/CHIPClientCallbacks.h"
 #include <controller/CHIPClusters.h>
-#include <lib/support/Span.h>
 #include <lib/core/CHIPSafeCasts.h>
 
 static void OnDefaultSuccessResponse(void * context)
@@ -26,12 +25,6 @@ static void OnDefaultFailureResponse(void * context, uint8_t status)
     command->SetCommandExitStatus(false);
 }
 
-typedef void (*UnsupportedAttributeCallback)(void * context);
-static void OnUnsupportedAttributeResponse(void * context)
-{
-    ChipLogError(chipTool, "Unsupported attribute Response. This should never happen !");
-}
-
 static void OnBooleanAttributeResponse(void * context, bool value)
 {
     ChipLogProgress(chipTool, "Boolean attribute Response: %d", value);
@@ -56,9 +49,9 @@ static void OnInt16uAttributeResponse(void * context, uint16_t value)
     command->SetCommandExitStatus(true);
 }
 
-static void OnInt16sAttributeResponse(void * context, int16_t value)
+static void OnInt32uAttributeResponse(void * context, uint32_t value)
 {
-    ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value);
+    ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value);
 
     ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
     command->SetCommandExitStatus(true);
@@ -72,6 +65,27 @@ static void OnInt64uAttributeResponse(void * context, uint64_t value)
     command->SetCommandExitStatus(true);
 }
 
+static void OnInt16sAttributeResponse(void * context, int16_t value)
+{
+    ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value);
+
+    ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
+    command->SetCommandExitStatus(true);
+}
+
+static void OnStringAttributeResponse(void * context, const chip::ByteSpan value)
+{
+    char * str = (char *)malloc(value.size() * sizeof(char));
+    memmove(str, value.data(), value.size());
+    str[value.size()] = '\0';
+    free(str);
+
+    ChipLogProgress(chipTool, "String attribute Response: %s (%" PRIu16 ")", str, strlen(str));
+
+    ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
+    command->SetCommandExitStatus(true);
+}
+
 {{#all_user_clusters}}
 {{#if (isClient side) }}
 {{#if (user_cluster_has_enabled_command name side)}}
@@ -129,7 +143,7 @@ public:
 
         chip::Controller::{{asCamelCased parent.name false}}Cluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.{{asCamelCased name false}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(){{#chip_server_cluster_command_arguments}}, {{#if (isByteString type)}} chip::ByteSpan(chip::Uint8::from_char(m{{asCamelCased label false}}), strlen(m{{asCamelCased label false}})){{else}}m{{asCamelCased label false}}{{/if}}{{/chip_server_cluster_command_arguments}});
+        return cluster.{{asCamelCased name false}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(){{#chip_server_cluster_command_arguments}}, {{#if (isString type)}} chip::ByteSpan(chip::Uint8::from_char(m{{asCamelCased label false}}), strlen(m{{asCamelCased label false}})){{else}}m{{asCamelCased label false}}{{/if}}{{/chip_server_cluster_command_arguments}});
     }
 
 private:
@@ -209,7 +223,11 @@ public:
     Write{{asCamelCased parent.name false}}{{asCamelCased name false}}(): ModelCommand("write")
     {
         AddArgument("attr-name", "{{asDelimitedCommand (asCamelCased name)}}");
+        {{#if (isString type)}}
+        AddArgument("attr-value", &mValue);
+        {{else}}
         AddArgument("attr-value", {{asTypeMinValue type}}, {{asTypeMaxValue type}}, &mValue);
+        {{/if}}
         ModelCommand::AddArguments();
     }
 
@@ -219,13 +237,17 @@ public:
 
         chip::Controller::{{asCamelCased parent.name false}}Cluster cluster;
         cluster.Associate(device, endpointId);
-        return cluster.WriteAttribute{{asCamelCased name false}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mValue);
+        return cluster.WriteAttribute{{asCamelCased name false}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), {{#if (isString type)}} chip::ByteSpan(chip::Uint8::from_char(mValue), strlen(mValue)){{else}}mValue{{/if}});
     }
 
 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);
+    {{#if (isString type)}}
+    char * mValue;
+    {{else}}
     {{chipType}} mValue;
+    {{/if}}
 };
 
 {{/if}}
index 71a2c7e..8028578 100644 (file)
@@ -55,81 +55,6 @@ function hasSpecificResponse(commandName)
   return templateUtil.templatePromise(this.global, promise);
 }
 
-function asCallbackAttributeType(attributeType)
-{
-  switch (parseInt(attributeType)) {
-  case 0x00: // nodata / No data
-  case 0x0A: // data24 / 24-bit data
-  case 0x0C: // data40 / 40-bit data
-  case 0x0D: // data48 / 48-bit data
-  case 0x0E: // data56 / 56-bit data
-  case 0x1A: // map24 / 24-bit bitmap
-  case 0x1C: // map40 / 40-bit bitmap
-  case 0x1D: // map48 / 48-bit bitmap
-  case 0x1E: // map56 / 56-bit bitmap
-  case 0x22: // uint24 / Unsigned 24-bit integer
-  case 0x24: // uint40 / Unsigned 40-bit integer
-  case 0x25: // uint48 / Unsigned 48-bit integer
-  case 0x26: // uint56 / Unsigned 56-bit integer
-  case 0x2A: // int24 / Signed 24-bit integer
-  case 0x2C: // int40 / Signed 40-bit integer
-  case 0x2D: // int48 / Signed 48-bit integer
-  case 0x2E: // int56 / Signed 56-bit integer
-  case 0x38: // semi / Semi-precision
-  case 0x39: // single / Single precision
-  case 0x3A: // double / Double precision
-  case 0x41: // octstr / Octet string
-  case 0x42: // string / Character string
-  case 0x43: // octstr16 / Long octet string
-  case 0x44: // string16 / Long character string
-  case 0x48: // array / Array
-  case 0x49: // struct / Structure
-  case 0x50: // set / Set
-  case 0x51: // bag / Bag
-  case 0xE0: // ToD / Time of day
-    return 'Unsupported';
-  case 0x08: // data8 / 8-bit data
-  case 0x18: // map8 / 8-bit bitmap
-  case 0x20: // uint8 / Unsigned  8-bit integer
-  case 0x30: // enum8 / 8-bit enumeration
-    return 'Int8u';
-  case 0x09: // data16 / 16-bit data
-  case 0x19: // map16 / 16-bit bitmap
-  case 0x21: // uint16 / Unsigned 16-bit integer
-  case 0x31: // enum16 / 16-bit enumeration
-  case 0xE8: // clusterId / Cluster ID
-  case 0xE9: // attribId / Attribute ID
-  case 0xEA: // bacOID / BACnet OID
-  case 0xF1: // key128 / 128-bit security key
-  case 0xFF: // unk / Unknown
-    return 'Int16u';
-  case 0x0B: // data32 / 32-bit data
-  case 0x1B: // map32 / 32-bit bitmap
-  case 0x23: // uint32 / Unsigned 32-bit integer
-  case 0xE1: // date / Date
-  case 0xE2: // UTC / UTCTime
-    return 'Int32u';
-  case 0x0F: // data64 / 64-bit data
-  case 0x1F: // map64 / 64-bit bitmap
-  case 0x27: // uint64 / Unsigned 64-bit integer
-  case 0xF0: // EUI64 / IEEE address
-    return 'Int64u';
-  case 0x10: // bool / Boolean
-    return 'Boolean';
-  case 0x28: // int8 / Signed 8-bit integer
-    return 'Int8s';
-  case 0x29: // int16 / Signed 16-bit integer
-    return 'Int16s';
-  case 0x2B: // int32 / Signed 32-bit integer
-    return 'Int32s';
-  case 0x2F: // int64 / Signed 64-bit integer
-    return 'Int64s';
-  default:
-    error = 'Unhandled attribute type ' + attributeType;
-    throw error;
-  }
-}
-
 function asDelimitedCommand(name)
 {
   return name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
@@ -203,9 +128,8 @@ function isStrEndsWith(str, substr)
 //
 // Module exports
 //
-exports.hasSpecificResponse     = hasSpecificResponse;
-exports.asCallbackAttributeType = asCallbackAttributeType;
-exports.asDelimitedCommand      = asDelimitedCommand;
-exports.asTypeMinValue          = asTypeMinValue;
-exports.asTypeMaxValue          = asTypeMaxValue;
-exports.isStrEndsWith           = isStrEndsWith;
+exports.hasSpecificResponse = hasSpecificResponse;
+exports.asDelimitedCommand  = asDelimitedCommand;
+exports.asTypeMinValue      = asTypeMinValue;
+exports.asTypeMaxValue      = asTypeMaxValue;
+exports.isStrEndsWith       = isStrEndsWith;
diff --git a/examples/common/chip-app-server/.gn b/examples/common/chip-app-server/.gn
deleted file mode 100644 (file)
index c3cfa5f..0000000
+++ /dev/null
@@ -1,23 +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.
-
-# The location of the build configuration file.
-buildconfig = "//build/config/BUILDCONFIG.gn"
-
-# CHIP uses angle bracket includes.
-check_system_includes = true
-
-default_args = {
-  import("//args.gni")
-}
diff --git a/examples/common/chip-app-server/BUILD.gn b/examples/common/chip-app-server/BUILD.gn
deleted file mode 100644 (file)
index 1f9ed65..0000000
+++ /dev/null
@@ -1,45 +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.
-
-import("//build_overrides/chip.gni")
-
-config("includes") {
-  include_dirs = [
-    ".",
-    "include",
-  ]
-}
-
-static_library("chip-app-server") {
-  output_name = "chip-app-server"
-
-  # Issue #1630
-  # DataModelHandler.cpp includes files that relies on generated headers
-  # so we can't compile it into this static library.  It needs to be compiled
-  # directly by someone who knows where the generated files for the app we're
-  # compiling live.
-  sources = [
-    "RendezvousServer.cpp",
-    "Server.cpp",
-  ]
-
-  deps = [
-    "${chip_root}/src/lib",
-    "${chip_root}/src/lib/mdns",
-  ]
-
-  public_configs = [ ":includes" ]
-
-  output_dir = root_out_dir
-}
diff --git a/examples/common/chip-app-server/DataModelHandler.cpp b/examples/common/chip-app-server/DataModelHandler.cpp
deleted file mode 100644 (file)
index 9aa8673..0000000
+++ /dev/null
@@ -1,201 +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.
- */
-
-/**
- * @file
- *   This file implements the handler for data model messages.
- */
-
-#include "DataModelHandler.h"
-
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
-#include <lib/support/logging/CHIPLogging.h>
-#include <support/logging/CHIPLogging.h>
-#include <system/SystemPacketBuffer.h>
-
-using namespace ::chip;
-
-/**
- * A data model message has nonzero length and always has a first byte whose
- * value is one of: 0x00, 0x01, 0x02, 0x03.  See chipZclEncodeZclHeader for the
- * construction of the message and in particular the first byte.
- *
- * Echo messages should generally not have a first byte with those values, so we
- * can use that to try to distinguish between the two.
- */
-bool ContentMayBeADataModelMessage(const System::PacketBufferHandle & buffer)
-{
-    const size_t data_len      = buffer->DataLength();
-    const uint8_t * data       = buffer->Start();
-    bool maybeDataModelMessage = true;
-
-    // Has to have nonzero length.
-    VerifyOrExit(data_len > 0, maybeDataModelMessage = false);
-
-    // Has to have a valid first byte value.
-    VerifyOrExit(data[0] < 0x04, maybeDataModelMessage = false);
-
-exit:
-    return maybeDataModelMessage;
-}
-
-/**
- * @brief implements something like "od -c", changes an arbitrary byte string
- *   into a single-line of ascii.  Destroys any byte-wise encoding that
- *   might be present, e.g. utf-8.
- *
- * @param bytes     potentially unprintable buffer
- * @param bytes_len length of bytes
- * @param out       where to put the printable string
- * @param out_len   length of out
- * @return size_t required size of output buffer, including null-termination
- */
-static size_t BinaryBytesToPrintableString(const uint8_t * bytes, size_t bytes_len, char * out, size_t out_len)
-{
-    size_t required = 1; // always need null termination
-    memset(out, 0, out_len);
-    // count and print
-    for (; bytes_len > 0; bytes_len--, bytes++)
-    {
-        uint8_t byte = *bytes;
-
-        if ((byte >= '\t' && byte <= '\r') || byte == '\\')
-        {
-            static const char * kCodes = "tnvfr";
-            char code                  = (byte == '\\') ? '\\' : kCodes[byte - '\t'];
-            required += 2;
-            if (out_len > 2)
-            {
-                *out++ = '\\';
-                *out++ = code;
-                out_len -= 2;
-            }
-        }
-        else if (byte >= ' ' && byte <= '~')
-        {
-            required += 1;
-            if (out_len > 1)
-            {
-                *out++ = byte;
-                out_len--;
-            }
-        }
-        else
-        {
-            static const size_t kBinCodeLen = sizeof("\\xFF") - 1;
-            static const char * kCodes      = "0123456789ABCDEF";
-
-            required += kBinCodeLen;
-            if (out_len > kBinCodeLen)
-            {
-                *out++ = '\\';
-                *out++ = 'x';
-                *out++ = kCodes[(byte & 0xf0) >> 4];
-                *out++ = kCodes[byte & 0xf];
-                out_len -= kBinCodeLen;
-            }
-        }
-    }
-
-    return required;
-}
-
-void ProcessOthersMessage(const PacketHeader & header, System::PacketBufferHandle & buffer, SecureSessionMgr * mgr)
-{
-    CHIP_ERROR err;
-    char logmsg[512];
-
-    BinaryBytesToPrintableString(buffer->Start(), buffer->DataLength(), logmsg, sizeof(logmsg));
-
-    ChipLogProgress(AppServer, "Client sent: %s", logmsg);
-
-    // Attempt to echo back
-    err = mgr->SendMessage(header.GetSourceNodeId().Value(), std::move(buffer));
-    if (err != CHIP_NO_ERROR)
-    {
-        ChipLogProgress(AppServer, "Unable to echo back to client: %s", ErrorStr(err));
-    }
-    else
-    {
-        ChipLogProgress(AppServer, "Echo sent");
-    }
-}
-
-void ProcessDataModelMessage(const PacketHeader & header, System::PacketBufferHandle & buffer)
-{
-    EmberApsFrame frame;
-    bool ok = extractApsFrame(buffer->Start(), buffer->DataLength(), &frame) > 0;
-    if (ok)
-    {
-        ChipLogProgress(Zcl, "APS frame processing success!");
-    }
-    else
-    {
-        ChipLogProgress(Zcl, "APS frame processing failure!");
-        return;
-    }
-
-    uint8_t * message;
-    uint16_t messageLen = extractMessage(buffer->Start(), buffer->DataLength(), &message);
-    ok                  = emberAfProcessMessage(&frame,
-                               0, // type
-                               message, messageLen,
-                               header.GetSourceNodeId().Value(), // source identifier
-                               NULL);
-
-    if (ok)
-    {
-        ChipLogProgress(Zcl, "Data model processing success!");
-    }
-    else
-    {
-        ChipLogProgress(Zcl, "Data model processing failure!");
-    }
-}
-
-/**
- * Handle a message that should be processed via our data model processing
- * codepath. This function will free the packet buffer.
- *
- * @param [in] buffer The buffer holding the message.  This function guarantees
- *                    that it will free the buffer before returning.
- */
-void HandleDataModelMessage(const PacketHeader & header, System::PacketBufferHandle buffer, SecureSessionMgr * mgr)
-{
-    // FIXME: Long-term we shouldn't be guessing what sort of message this is
-    // based on the message bytes.  We're doing this for now to support both
-    // data model messages and text echo messages, but in the long term we
-    // should either do echo via a data model command or do echo on a separate
-    // port from data model processing.
-    if (ContentMayBeADataModelMessage(buffer))
-    {
-        ProcessDataModelMessage(header, buffer);
-    }
-    else
-    {
-        ProcessOthersMessage(header, buffer, mgr);
-    }
-}
-
-void InitDataModelHandler()
-{
-    emberAfEndpointConfigure();
-    emberAfInit();
-}
diff --git a/examples/common/chip-app-server/QRCodeUtil.cpp b/examples/common/chip-app-server/QRCodeUtil.cpp
deleted file mode 100644 (file)
index 9a38a08..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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 "QRCodeUtil.h"
-
-#include <platform/CHIPDeviceLayer.h>
-
-#include <setup_payload/QRCodeSetupPayloadGenerator.h>
-#include <support/CodeUtils.h>
-#include <support/ScopedBuffer.h>
-#include <support/logging/CHIPLogging.h>
-
-constexpr char qrCodeBaseUrl[]                   = "https://dhrishi.github.io/connectedhomeip/qrcode.html";
-constexpr char specialCharsUnreservedInRfc3986[] = "-._~";
-
-void PrintQRCode(chip::RendezvousInformationFlags rendezvousFlags)
-{
-    uint32_t setupPinCode;
-    std::string QRCode;
-
-    if (GetQRCode(setupPinCode, QRCode, rendezvousFlags) == CHIP_NO_ERROR)
-    {
-        ChipLogProgress(AppServer, "SetupPINCode: [%" PRIu32 "]", setupPinCode);
-        ChipLogProgress(AppServer, "SetupQRCode:  [%s]", QRCode.c_str());
-
-        chip::Platform::ScopedMemoryBuffer<char> qrCodeBuffer;
-        const size_t qrCodeBufferMaxSize = 3 * QRCode.size() + 1;
-        qrCodeBuffer.Alloc(qrCodeBufferMaxSize);
-        if (EncodeQRCodeToUrl(QRCode.c_str(), QRCode.size(), &qrCodeBuffer[0], qrCodeBufferMaxSize) == CHIP_NO_ERROR)
-        {
-            ChipLogProgress(AppServer, "Copy/paste the below URL in a browser to see the QR Code:\n\t%s?data=%s", qrCodeBaseUrl,
-                            &qrCodeBuffer[0]);
-        }
-    }
-    else
-    {
-        ChipLogError(AppServer, "Getting QR code failed!");
-    }
-}
-
-CHIP_ERROR GetQRCode(uint32_t & setupPinCode, std::string & QRCode, chip::RendezvousInformationFlags rendezvousFlags)
-{
-    using namespace ::chip::DeviceLayer;
-
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::SetupPayload payload;
-
-    payload.version               = 1;
-    payload.rendezvousInformation = rendezvousFlags;
-
-    err = ConfigurationMgr().GetSetupPinCode(payload.setUpPINCode);
-    VerifyOrExit(err == CHIP_NO_ERROR,
-                 ChipLogProgress(AppServer, "ConfigurationMgr().GetSetupPinCode() failed: %s", chip::ErrorStr(err)));
-    setupPinCode = payload.setUpPINCode;
-
-    err = ConfigurationMgr().GetSetupDiscriminator(payload.discriminator);
-    VerifyOrExit(err == CHIP_NO_ERROR,
-                 ChipLogProgress(AppServer, "ConfigurationMgr().GetSetupDiscriminator() failed: %s", chip::ErrorStr(err)));
-
-    err = ConfigurationMgr().GetVendorId(payload.vendorID);
-    VerifyOrExit(err == CHIP_NO_ERROR,
-                 ChipLogProgress(AppServer, "ConfigurationMgr().GetVendorId() failed: %s", chip::ErrorStr(err)));
-
-    err = ConfigurationMgr().GetProductId(payload.productID);
-    VerifyOrExit(err == CHIP_NO_ERROR,
-                 ChipLogProgress(AppServer, "ConfigurationMgr().GetProductId() failed: %s", chip::ErrorStr(err)));
-
-    // TODO: Usage of STL will significantly increase the image size, this should be changed to more efficient method for
-    // generating payload
-    err = chip::QRCodeSetupPayloadGenerator(payload).payloadBase41Representation(QRCode);
-    VerifyOrExit(err == CHIP_NO_ERROR, ChipLogProgress(AppServer, "Generating QR Code failed: %s", chip::ErrorStr(err)));
-
-exit:
-    return err;
-}
-
-static inline bool isCharUnreservedInRfc3986(const char c)
-{
-    return isalpha(c) || isdigit(c) || (strchr(specialCharsUnreservedInRfc3986, c) != nullptr);
-}
-
-CHIP_ERROR EncodeQRCodeToUrl(const char * QRCode, size_t len, char * url, size_t maxSize)
-{
-    const char upperHexDigits[] = "0123456789ABCDEF";
-    CHIP_ERROR err              = CHIP_NO_ERROR;
-    size_t i = 0, j = 0;
-
-    VerifyOrExit((QRCode != nullptr) && (url != nullptr), err = CHIP_ERROR_INVALID_ARGUMENT);
-
-    for (i = 0; i < len; ++i)
-    {
-        unsigned char c = QRCode[i];
-        if (isCharUnreservedInRfc3986(c))
-        {
-
-            VerifyOrExit((j + 1) < maxSize, err = CHIP_ERROR_BUFFER_TOO_SMALL);
-
-            url[j++] = c;
-        }
-        else
-        {
-
-            VerifyOrExit((j + 3) < maxSize, err = CHIP_ERROR_BUFFER_TOO_SMALL);
-
-            url[j++] = '%';
-            url[j++] = upperHexDigits[(c & 0xf0) >> 4];
-            url[j++] = upperHexDigits[(c & 0x0f)];
-        }
-    }
-
-    url[j] = '\0';
-
-exit:
-    return err;
-}
diff --git a/examples/common/chip-app-server/RendezvousServer.cpp b/examples/common/chip-app-server/RendezvousServer.cpp
deleted file mode 100644 (file)
index 1bf3a98..0000000
+++ /dev/null
@@ -1,122 +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.
- */
-
-#include "RendezvousServer.h"
-
-#include "SessionManager.h"
-#include <core/CHIPError.h>
-#include <support/CodeUtils.h>
-#include <transport/SecureSessionMgr.h>
-
-#if CHIP_ENABLE_OPENTHREAD
-#include <platform/ThreadStackManager.h>
-#endif
-#include <lib/mdns/DiscoveryManager.h>
-
-using namespace ::chip::Inet;
-using namespace ::chip::Transport;
-using namespace ::chip::DeviceLayer;
-
-namespace chip {
-
-RendezvousServer::RendezvousServer() : mRendezvousSession(this) {}
-
-CHIP_ERROR RendezvousServer::Init(const RendezvousParameters & params, TransportMgrBase * transportMgr)
-{
-    return mRendezvousSession.Init(params, transportMgr);
-}
-
-void RendezvousServer::OnRendezvousError(CHIP_ERROR err)
-{
-    ChipLogProgress(AppServer, "OnRendezvousError: %s", ErrorStr(err));
-}
-
-void RendezvousServer::OnRendezvousConnectionOpened()
-{
-    ChipLogProgress(AppServer, "OnRendezvousConnectionOpened");
-}
-
-void RendezvousServer::OnRendezvousConnectionClosed()
-{
-    ChipLogProgress(AppServer, "OnRendezvousConnectionClosed");
-}
-
-void RendezvousServer::OnRendezvousMessageReceived(const PacketHeader & packetHeader, const PeerAddress & peerAddress,
-                                                   System::PacketBufferHandle buffer)
-{}
-
-void RendezvousServer::OnRendezvousComplete()
-{
-    ChipLogProgress(AppServer, "Device completed Rendezvous process");
-    if (mRendezvousSession.GetLocalNodeId().HasValue() && mRendezvousSession.GetRemoteNodeId().HasValue())
-    {
-        SessionManager().NewPairing(Optional<Transport::PeerAddress>{}, mRendezvousSession.GetRemoteNodeId().Value(),
-                                    &mRendezvousSession.GetPairingSession());
-    }
-    else
-    {
-        ChipLogError(AppServer, "Commissioner did not assign a node ID to the device!!!");
-    }
-}
-
-void RendezvousServer::OnRendezvousStatusUpdate(Status status, CHIP_ERROR err)
-{
-    VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(AppServer, "OnRendezvousStatusUpdate: %s", chip::ErrorStr(err)));
-
-    switch (status)
-    {
-    case RendezvousSessionDelegate::SecurePairingSuccess:
-        ChipLogProgress(AppServer, "Device completed SPAKE2+ handshake");
-        if (mDelegate != nullptr)
-        {
-            mDelegate->OnRendezvousStarted();
-        }
-        break;
-
-    case RendezvousSessionDelegate::SecurePairingFailed:
-        ChipLogProgress(AppServer, "Failed in SPAKE2+ handshake");
-        if (mDelegate != nullptr)
-        {
-            mDelegate->OnRendezvousStopped();
-        }
-        break;
-
-    case RendezvousSessionDelegate::NetworkProvisioningSuccess:
-        ChipLogProgress(AppServer, "Device was assigned network credentials");
-        chip::Mdns::DiscoveryManager::GetInstance().StartPublishDevice();
-        if (mDelegate != nullptr)
-        {
-            mDelegate->OnRendezvousStopped();
-        }
-        break;
-
-    case RendezvousSessionDelegate::NetworkProvisioningFailed:
-        ChipLogProgress(AppServer, "Failed in network provisioning");
-        if (mDelegate != nullptr)
-        {
-            mDelegate->OnRendezvousStopped();
-        }
-        break;
-
-    default:
-        break;
-    };
-
-exit:
-    return;
-}
-} // namespace chip
diff --git a/examples/common/chip-app-server/Server.cpp b/examples/common/chip-app-server/Server.cpp
deleted file mode 100644 (file)
index 09c2a77..0000000
+++ /dev/null
@@ -1,177 +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.
- */
-
-#include "Server.h"
-
-#include "DataModelHandler.h"
-#include "RendezvousServer.h"
-#include "SessionManager.h"
-
-#include <ble/BLEEndPoint.h>
-#include <inet/IPAddress.h>
-#include <inet/InetError.h>
-#include <inet/InetLayer.h>
-#include <lib/mdns/DiscoveryManager.h>
-#include <platform/CHIPDeviceLayer.h>
-#include <setup_payload/SetupPayload.h>
-#include <support/CodeUtils.h>
-#include <support/ErrorStr.h>
-#include <support/logging/CHIPLogging.h>
-#include <sys/param.h>
-#include <system/SystemPacketBuffer.h>
-#include <transport/SecureSessionMgr.h>
-
-using namespace ::chip;
-using namespace ::chip::Inet;
-using namespace ::chip::Transport;
-using namespace ::chip::DeviceLayer;
-
-namespace {
-
-bool isRendezvousBypassed()
-{
-    RendezvousInformationFlags rendezvousMode = RendezvousInformationFlags::kBLE;
-
-#ifdef CONFIG_RENDEZVOUS_MODE
-    rendezvousMode = static_cast<RendezvousInformationFlags>(CONFIG_RENDEZVOUS_MODE);
-#endif
-
-#ifdef CHIP_BYPASS_RENDEZVOUS
-    rendezvousMode = RendezvousInformationFlags::kNone;
-#endif
-
-    return rendezvousMode == RendezvousInformationFlags::kNone;
-}
-
-class ServerCallback : public SecureSessionMgrDelegate
-{
-public:
-    void OnMessageReceived(const PacketHeader & header, const PayloadHeader & payloadHeader,
-                           const Transport::PeerConnectionState * state, System::PacketBufferHandle buffer,
-                           SecureSessionMgr * mgr) override
-    {
-        const size_t data_len = buffer->DataLength();
-        char src_addr[PeerAddress::kMaxToStringSize];
-
-        // as soon as a client connects, assume it is connected
-        VerifyOrExit(!buffer.IsNull(), ChipLogProgress(AppServer, "Received data but couldn't process it..."));
-        VerifyOrExit(header.GetSourceNodeId().HasValue(), ChipLogProgress(AppServer, "Unknown source for received message"));
-
-        VerifyOrExit(state->GetPeerNodeId() != kUndefinedNodeId, ChipLogProgress(AppServer, "Unknown source for received message"));
-
-        state->GetPeerAddress().ToString(src_addr, sizeof(src_addr));
-
-        ChipLogProgress(AppServer, "Packet received from %s: %zu bytes", src_addr, static_cast<size_t>(data_len));
-
-        HandleDataModelMessage(header, std::move(buffer), mgr);
-
-    exit:;
-    }
-
-    void OnReceiveError(CHIP_ERROR error, const Transport::PeerAddress & source, SecureSessionMgr * mgr) override
-    {
-        ChipLogProgress(AppServer, "Packet received error: %s", ErrorStr(error));
-        if (mDelegate != nullptr)
-        {
-            mDelegate->OnReceiveError();
-        }
-    }
-
-    void OnNewConnection(const Transport::PeerConnectionState * state, SecureSessionMgr * mgr) override
-    {
-        ChipLogProgress(AppServer, "Received a new connection.");
-    }
-
-    void SetDelegate(AppDelegate * delegate) { mDelegate = delegate; }
-
-private:
-    AppDelegate * mDelegate = nullptr;
-};
-
-DemoTransportMgr gTransports;
-SecureSessionMgr gSessions;
-ServerCallback gCallbacks;
-SecurePairingUsingTestSecret gTestPairing;
-RendezvousServer gRendezvousServer;
-
-} // namespace
-
-SecureSessionMgr & chip::SessionManager()
-{
-    return gSessions;
-}
-
-// The function will initialize datamodel handler and then start the server
-// The server assumes the platform's networking has been setup already
-void InitServer(AppDelegate * delegate)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    Optional<Transport::PeerAddress> peer(Transport::Type::kUndefined);
-
-    InitDataModelHandler();
-    gCallbacks.SetDelegate(delegate);
-    gRendezvousServer.SetDelegate(delegate);
-
-    // Init transport before operations with secure session mgr.
-#if INET_CONFIG_ENABLE_IPV4
-    err = gTransports.Init(UdpListenParameters(&DeviceLayer::InetLayer).SetAddressType(kIPAddressType_IPv6),
-                           UdpListenParameters(&DeviceLayer::InetLayer).SetAddressType(kIPAddressType_IPv4));
-#else
-    err = gTransports.Init(UdpListenParameters(&DeviceLayer::InetLayer).SetAddressType(kIPAddressType_IPv6));
-#endif
-    SuccessOrExit(err);
-
-    err = gSessions.Init(chip::kTestDeviceNodeId, &DeviceLayer::SystemLayer, &gTransports);
-    SuccessOrExit(err);
-
-    // This flag is used to bypass BLE in the cirque test
-    // Only in the cirque test this is enabled with --args='bypass_rendezvous=true'
-    if (isRendezvousBypassed())
-    {
-        ChipLogProgress(AppServer, "Rendezvous and Secure Pairing skipped. Using test secret.");
-        err = gSessions.NewPairing(peer, chip::kTestControllerNodeId, &gTestPairing);
-        SuccessOrExit(err);
-    }
-    else
-    {
-        RendezvousParameters params;
-        uint32_t pinCode;
-
-        SuccessOrExit(err = DeviceLayer::ConfigurationMgr().GetSetupPinCode(pinCode));
-        params.SetSetupPINCode(pinCode)
-            .SetLocalNodeId(chip::kTestDeviceNodeId)
-            .SetBleLayer(DeviceLayer::ConnectivityMgr().GetBleLayer())
-            .SetPeerAddress(Transport::PeerAddress::BLE());
-        SuccessOrExit(err = gRendezvousServer.Init(params, &gTransports));
-    }
-
-    err = gSessions.NewPairing(peer, chip::kTestControllerNodeId, &gTestPairing);
-    SuccessOrExit(err);
-
-    gSessions.SetDelegate(&gCallbacks);
-    chip::Mdns::DiscoveryManager::GetInstance().StartPublishDevice(kIPAddressType_IPv6);
-
-exit:
-    if (err != CHIP_NO_ERROR)
-    {
-        ChipLogError(AppServer, "ERROR setting up transport: %s", ErrorStr(err));
-    }
-    else
-    {
-        ChipLogProgress(AppServer, "Server Listening...");
-    }
-}
diff --git a/examples/common/chip-app-server/args.gni b/examples/common/chip-app-server/args.gni
deleted file mode 100644 (file)
index aa216c8..0000000
+++ /dev/null
@@ -1,15 +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.
-
-import("//build_overrides/chip.gni")
diff --git a/examples/common/chip-app-server/build b/examples/common/chip-app-server/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/common/chip-app-server/include/AppDelegate.h b/examples/common/chip-app-server/include/AppDelegate.h
deleted file mode 100644 (file)
index dbeea37..0000000
+++ /dev/null
@@ -1,32 +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.
- */
-
-/**
- * @file
- *   This file defines the API for application specific callbacks.
- */
-
-#pragma once
-
-class AppDelegate
-{
-public:
-    virtual ~AppDelegate() {}
-    virtual void OnReceiveError(){};
-    virtual void OnRendezvousStarted(){};
-    virtual void OnRendezvousStopped(){};
-};
diff --git a/examples/common/chip-app-server/include/DataModelHandler.h b/examples/common/chip-app-server/include/DataModelHandler.h
deleted file mode 100644 (file)
index 39854b8..0000000
+++ /dev/null
@@ -1,38 +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.
- */
-
-/**
- * @file
- *   This file defines the API for the handler for data model messages.
- */
-
-#pragma once
-
-#include <system/SystemPacketBuffer.h>
-#include <transport/SecureSessionMgr.h>
-#include <transport/raw/MessageHeader.h>
-
-/**
- * Handle a message that should be processed via our data model processing
- * codepath.
- *
- * @param [in] buffer The buffer holding the message.  This function guarantees
- *                    that it will free the buffer before returning.
- */
-void HandleDataModelMessage(const chip::PacketHeader & header, chip::System::PacketBufferHandle buffer,
-                            chip::SecureSessionMgr * mgr);
-void InitDataModelHandler();
diff --git a/examples/common/chip-app-server/include/QRCodeUtil.h b/examples/common/chip-app-server/include/QRCodeUtil.h
deleted file mode 100644 (file)
index a27ead1..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *    Copyright (c) 2020 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 <setup_payload/SetupPayload.h>
-
-void PrintQRCode(chip::RendezvousInformationFlags rendezvousFlags);
-CHIP_ERROR GetQRCode(uint32_t & setupPinCode, std::string & QRCode, chip::RendezvousInformationFlags rendezvousFlags);
-
-/**
- * Initialize DataModelHandler and start CHIP datamodel server, the server
- * assumes the platform's networking has been setup already.
- *
- * Method verifies if every character of the QR Code is valid for the url encoding
- * and otherwise it encodes the invalid character using available ones.
- *
- * @param QRCode address of the array storing QR Code to encode.
- * @param len length of the given QR Code.
- * @param url address of the location where encoded url should be stored.
- * @param maxSize maximal size of the array where encoded url should be stored.
- * @return CHIP_NO_ERROR on success and other values on error.
- */
-CHIP_ERROR EncodeQRCodeToUrl(const char * QRCode, size_t len, char * url, size_t maxSize);
diff --git a/examples/common/chip-app-server/include/RendezvousServer.h b/examples/common/chip-app-server/include/RendezvousServer.h
deleted file mode 100644 (file)
index 54d0976..0000000
+++ /dev/null
@@ -1,50 +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 "AppDelegate.h"
-#include <platform/CHIPDeviceLayer.h>
-#include <transport/RendezvousSession.h>
-
-namespace chip {
-
-class RendezvousServer : public RendezvousSessionDelegate
-{
-public:
-    RendezvousServer();
-
-    CHIP_ERROR Init(const RendezvousParameters & params, TransportMgrBase * transportMgr);
-    void SetDelegate(AppDelegate * delegate) { mDelegate = delegate; };
-
-    //////////////// RendezvousSessionDelegate Implementation ///////////////////
-
-    void OnRendezvousConnectionOpened() override;
-    void OnRendezvousConnectionClosed() override;
-    void OnRendezvousError(CHIP_ERROR err) override;
-    void OnRendezvousMessageReceived(const PacketHeader & packetHeader, const Transport::PeerAddress & peerAddress,
-                                     System::PacketBufferHandle buffer) override;
-    void OnRendezvousComplete() override;
-    void OnRendezvousStatusUpdate(Status status, CHIP_ERROR err) override;
-    RendezvousSession * GetRendezvousSession() { return &mRendezvousSession; };
-
-private:
-    RendezvousSession mRendezvousSession;
-    AppDelegate * mDelegate;
-};
-
-} // namespace chip
diff --git a/examples/common/chip-app-server/include/Server.h b/examples/common/chip-app-server/include/Server.h
deleted file mode 100644 (file)
index c149bb4..0000000
+++ /dev/null
@@ -1,37 +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 "AppDelegate.h"
-#include <inet/InetConfig.h>
-#include <transport/TransportMgr.h>
-#include <transport/raw/UDP.h>
-
-#if INET_CONFIG_ENABLE_IPV4
-using DemoTransportMgr = chip::TransportMgr<chip::Transport::UDP, chip::Transport::UDP>;
-#else
-using DemoTransportMgr = chip::TransportMgr<chip::Transport::UDP>;
-#endif
-
-/**
- * Initialize DataModelHandler and start CHIP datamodel server, the server
- * assumes the platform's networking has been setup already.
- *
- * @param [in] delegate   An optional AppDelegate
- */
-void InitServer(AppDelegate * delegate = nullptr);
diff --git a/examples/common/chip-app-server/include/SessionManager.h b/examples/common/chip-app-server/include/SessionManager.h
deleted file mode 100644 (file)
index 17d78a9..0000000
+++ /dev/null
@@ -1,24 +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 <transport/SecureSessionMgr.h>
-
-namespace chip {
-SecureSessionMgr & SessionManager();
-} // namespace chip
diff --git a/examples/lighting-app/efr32/build b/examples/lighting-app/efr32/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lighting-app/efr32/include/board_features.h b/examples/lighting-app/efr32/include/board_features.h
deleted file mode 100644 (file)
index e1ccb84..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief board_features.h
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-// Top level macros
-#define SILABS_AF_DEVICE_NAME "lighting-example"
-
-// Generated plugin macros
-
-#ifdef EMBER_AF_BOARD_TYPE
-#undef EMBER_AF_BOARD_TYPE
-#endif
-#define EMBER_AF_BOARD_TYPE BOARD_ID
-
-/* Indicate if LCD is supported */
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_LCD_SUPPORT
-#endif
-
-/* Indicate if the same pins are used for LEDs and Buttons on the WSTK */
-#if (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_LED_BUTTON_ON_SAME_PIN
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_SPI_FLASH
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4101B)
-#define FEATURE_IOEXPANDER
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4151A) || (EMBER_AF_BOARD_TYPE == BRD4158A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A)
-#define FEATURE_PA_INPUT_FROM_VBAT
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_EXP_HEADER_USART1
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4103A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4170A)
-#define FEATURE_EXP_HEADER_USART3
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_PTI_SUPPORT
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4300A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_HW_FLOW_CONTROL
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_I2C_SENSOR
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || (EMBER_AF_BOARD_TYPE == BRD4180B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || (EMBER_AF_BOARD_TYPE == BRD4182A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4300A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4310A)
-#define FEATURE_LFXO
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4179B)
-#define FEATURE_EFP
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) ||                 \
-    (EMBER_AF_BOARD_TYPE == RD_0057_0101)
-#define FEATURE_BOARD_DETECTED
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == CUSTOM_BOARD)
-// Uncomment the corresponding line in case of using Silicon Labs board feature in your design.
-// For using the selected feature you may need additional drivers. Check an appropriate SDK example for reference.
-
-// #define FEATURE_LCD_SUPPORT
-// #define FEATURE_LED_BUTTON_ON_SAME_PIN
-// #define FEATURE_SPI_FLASH
-// #define FEATURE_IOEXPANDER
-// #define FEATURE_PA_INPUT_FROM_VBAT
-// #define FEATURE_EXP_HEADER_USART1
-// #define FEATURE_EXP_HEADER_USART3
-// #define FEATURE_PTI_SUPPORT
-// #define FEATURE_HW_FLOW_CONTROL
-// #define FEATURE_I2C_SENSOR
-// #define FEATURE_LFXO
-// #define FEATURE_EFP
-// #define FEATURE_BOARD_DETECTED
-#endif
diff --git a/examples/lighting-app/efr32/include/hal-config-app-common.h b/examples/lighting-app/efr32/include/hal-config-app-common.h
deleted file mode 100644 (file)
index b19a615..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/******************************************************************************
- * @file
- * @brief hal-config-app-common.h
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-#if defined(FEATURE_IOEXPANDER)
-#include "hal-config-ioexp.h"
-#endif
-
-#define HAL_EXTFLASH_FREQUENCY (1000000)
-
-#define HAL_PTI_ENABLE (1)
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000)
-
-#define HAL_PA_RAMP (10)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-
-#define HAL_PA_VOLTAGE BSP_PA_VOLTAGE
-
-// Select antenna path on EFR32xG2x devices:
-//   - RF2G2_IO1: 0
-//   - RF2G2_IO2: 1
-#define GECKO_RF_ANTENNA 1
-#if defined(FEATURE_EXP_HEADER_USART3)
-
-#define BSP_EXP_USART USART3
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART3_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART3_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART3_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART3_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART3_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART3_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART3_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART3_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART3_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART3_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART3_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART3_TX_LOC
-
-#elif defined(FEATURE_EXP_HEADER_USART1)
-
-#define BSP_EXP_USART USART1
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART1_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART1_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART1_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART1_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART1_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART1_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART1_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART1_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART1_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART1_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART1_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART1_TX_LOC
-
-#else
-
-#define BSP_EXP_USART USART0
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART0_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART0_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART0_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART0_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART0_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART0_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART0_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART0_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART0_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART0_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART0_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART0_TX_LOC
-
-#endif // FEATURE_EXP_HEADER_USART3
index f5f88af..fc5ea3b 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -696,10 +734,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -710,6 +744,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index 14a3742..d028079 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,6 +34,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
index d10700c..459e4c5 100644 (file)
@@ -43,6 +43,29 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
+ * Cluster Basic
+ *
+ */
+@interface CHIPBasic : CHIPCluster
+
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
+
+@end
+
+/**
  * Cluster Level Control
  *
  */
index a1394c1..d554b9b 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -308,6 +354,351 @@ private:
 }
 @end
 
+@interface CHIPBasic ()
+@property (readonly) Controller::BasicCluster cppCluster;
+@end
+
+@implementation CHIPBasic
+
+- (Controller::ClusterBase *)getCluster
+{
+    return &_cppCluster;
+}
+
+- (void)readAttributeInteractionModelVersion:(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.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorID:(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.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductID:(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.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersion:(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.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
+{
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(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.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeSoftwareVersionString(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 CHIPLevelControl ()
 @property (readonly) Controller::LevelControlCluster cppCluster;
 @end
index 8802797..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Low Power
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index 375d024..4680bec 100644 (file)
@@ -28,6 +28,7 @@
 
 using namespace chip;
 
+EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfNetworkCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);
@@ -71,6 +72,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
     {
         switch (cmd->apsFrame->clusterId)
         {
+        case ZCL_BASIC_CLUSTER_ID:
+            // No commands are enabled for cluster Basic
+            result = status(false, true, cmd->mfgSpecific);
+            break;
         case ZCL_LEVEL_CONTROL_CLUSTER_ID:
             result = emberAfLevelControlClusterServerCommandParse(cmd);
             break;
index b090552..f40262e 100644 (file)
@@ -27,6 +27,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
 {
     switch (clusterId)
     {
+    case ZCL_BASIC_CLUSTER_ID:
+        emberAfBasicClusterInitCallback(endpoint);
+        break;
     case ZCL_LEVEL_CONTROL_CLUSTER_ID:
         emberAfLevelControlClusterInitCallback(endpoint);
         break;
@@ -42,6 +45,11 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     }
 }
 
+void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint)
+{
+    // To prevent warning
+    (void) endpoint;
+}
 void __attribute__((weak)) emberAfLevelControlClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
index 28a6fbb..dfac28f 100644 (file)
@@ -37,6 +37,14 @@ void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clust
 
 // Cluster Init Functions
 
+/** @brief Basic Cluster Init
+ *
+ * Cluster Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);
+
 /** @brief Level Control Cluster Init
  *
  * Cluster Init
@@ -64,6 +72,74 @@ void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint);
 // Cluster Server/Client Init Functions
 
 //
+// Basic Cluster server
+//
+
+/** @brief Basic Cluster Server Init
+ *
+ * Server Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint);
+
+/** @brief Basic Cluster Server Attribute Changed
+ *
+ * Server Attribute Changed
+ *
+ * @param endpoint    Endpoint that is being initialized
+ * @param attributeId Attribute that changed
+ */
+void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
+
+/** @brief Basic 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 emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
+                                                                           uint16_t manufacturerCode);
+
+/** @brief Basic 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 emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
+                                                  EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
+
+/** @brief Basic 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 emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
+                                                                   EmberAfAttributeType attributeType, uint8_t size,
+                                                                   uint8_t * value);
+
+/** @brief Basic Cluster Server Tick
+ *
+ * server Tick
+ *
+ * @param endpoint  Endpoint that is being served
+ */
+void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
+
+//
 // Level Control Cluster server
 //
 
index 97de7f6..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for Sleep
+ *
+ * Command: Sleep
+ */
+#define emberAfFillCommandLow                                                                                                      \
+    PowerClusterSleep() emberAfFillExternalBuffer(mask,                                                                            \
+                                                                                                                                   \
+                                                  ZCL_SLEEP_COMMAND_ID, "", );
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
index 99de14e..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Low Power
+#define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
index d31a267..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Low Power
+#define ZCL_SLEEP_COMMAND_ID (0x00)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
index 7246b72..f82aab4 100644 (file)
 #if BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 32 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                  \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 64 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 96 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 112 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 176 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 180 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */                 \
     }
 
 #else // !BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 32 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 64 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 96 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 112 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 176 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 180 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */              \
     }
 
 #endif // BIGENDIAN_CPU
 
-#define GENERATED_DEFAULTS_COUNT (0)
+#define GENERATED_DEFAULTS_COUNT (7)
 
 #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
 #define ZAP_LONG_DEFAULTS_INDEX(index)                                                                                             \
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 5
+#define GENERATED_ATTRIBUTE_COUNT 17
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
-        { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },          /* On/off (server): cluster revision */                    \
-            { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, { (uint8_t *) 0x00 } },  /* On/off (server): on/off */                              \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },      /* Level Control (server): cluster revision */             \
-            { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x00 } },    /* Level Control (server): current level */                \
+        { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },         /* On/off (server): cluster revision */                     \
+            { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, { (uint8_t *) 0x00 } }, /* On/off (server): on/off */                               \
+            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },     /* Level Control (server): cluster revision */              \
+            { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x00 } },   /* Level Control (server): current level */                 \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }                                      \
+            }, /* Basic (server): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }       \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(32) }      \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(64) } }, /* Basic (server): UserLabel */                                       \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(96) } }, /* Basic (server): Location */                                        \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(112) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(176) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(180) }     \
+            },                                                          /* Basic (server): SoftwareVersionString */                \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Network Commissioning (server): cluster revision */     \
     }
 
     };
 
 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
-#define GENERATED_CLUSTER_COUNT 3
+#define GENERATED_CLUSTER_COUNT 4
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
         {                                                                                                                          \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */                                \
             {                                                                                                                      \
-                0xAAAA, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                               \
+                0x0028, ZAP_ATTRIBUTE_INDEX(4), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                            \
+            }, /* Endpoint: 1, Cluster: Basic (server) */                                                                          \
+            {                                                                                                                      \
+                0xAAAA, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Network Commissioning (server) */                                                          \
     }
 
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 3, 8 },                                                                                            \
+        { ZAP_CLUSTER_INDEX(0), 4, 262 },                                                                                          \
     }
 
 // Largest attribute size is needed for various buffers
-#define ATTRIBUTE_LARGEST (3)
+#define ATTRIBUTE_LARGEST (64)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (0)
+#define ATTRIBUTE_SINGLETONS_SIZE (254)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (8)
+#define ATTRIBUTE_MAX_SIZE (262)
 
 // 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 (28)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (31)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
         { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* On/off (server): Off */                                        \
             { 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): MoveWithOnOff */                       \
             { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StepWithOnOff */                       \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StopWithOnOff */                       \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
             { 0xAAAA, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): ScanNetworks */                \
             { 0xAAAA, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (server): ScanNetworksResponse */        \
             { 0xAAAA, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): AddWiFiNetwork */              \
index 9bd486c..524f4fb 100644 (file)
 #define EMBER_APS_UNICAST_MESSAGE_COUNT 10
 
 /**** Cluster endpoint counts ****/
+#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_LEVEL_CONTROL_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)
 
 /**** Cluster Plugins ****/
 
+// Use this macro to check if the server side of the Basic cluster is included
+#define ZCL_USING_BASIC_CLUSTER_SERVER
+#define EMBER_AF_PLUGIN_BASIC_SERVER
+#define EMBER_AF_PLUGIN_BASIC
+
 // Use this macro to check if the server side of the Level Control cluster is included
 #define ZCL_USING_LEVEL_CONTROL_CLUSTER_SERVER
 #define EMBER_AF_PLUGIN_LEVEL_CONTROL_SERVER
index 86a2a27..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #define CHIP_PRINTCLUSTER_IAS_WD_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_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
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
index 699ae3f..79094c9 100644 (file)
@@ -39,7 +39,7 @@
       "clusters": [
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "client",
@@ -53,7 +53,7 @@
               "side": "client",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "3",
               "reportable": 0,
         },
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "server",
-          "enabled": 0,
-          "commands": [],
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "3",
               "reportable": 0,
               "reportableChange": 0
             },
             {
-              "name": "ZCL version",
+              "name": "InteractionModelVersion",
               "code": 0,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x08",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "power source",
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
               "code": 7,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "0x00",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             }
           ]
         },
diff --git a/examples/lighting-app/linux/build b/examples/lighting-app/linux/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
index 509db8f..b34a4bc 100644 (file)
@@ -168,7 +168,7 @@ int main(int argc, char * argv[])
 
     chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName(nullptr); // Use default device name (CHIP-XXXX)
 
-#ifdef CONFIG_NETWORK_BLE
+#if CONFIG_NETWORK_LAYER_BLE
     chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureBle(LinuxDeviceOptions::GetInstance().mBleDevice, false);
 #endif
 
index 32a65e7..bc46f10 100644 (file)
@@ -19,9 +19,10 @@ get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connect
 get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH)
 get_filename_component(LIGHTING_COMMON ${CHIP_ROOT}/examples/lighting-app/lighting-common REALPATH)
 
-set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
+include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
 
 # Load NCS/Zephyr build system
+set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module)
 find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
 
index 4faa099..80c0504 100644 (file)
@@ -92,7 +92,9 @@ with other Thread devices in the network.
 
 ## Requirements
 
-The application requires the nRF Connect SDK v1.5.0 to work correctly.
+The application requires a specific revision of the nRF Connect SDK to work
+correctly. See [Setting up the environment](#setting-up-the-environment) for
+more information.
 
 <a name="supported_devices"></a>
 
@@ -176,9 +178,9 @@ using the following command:
 
         $ git submodule update --init
 
-The example requires the nRF Connect SDK v1.5.0. You can either install it along
-with the related tools directly on your system or use a Docker image that has
-the tools pre-installed.
+The example requires a specific revision of the nRF Connect SDK. You can either
+install it along with the related tools directly on your system or use a Docker
+image that has the tools pre-installed.
 
 If you are a macOS user, you won't be able to use the Docker container to flash
 the application onto a Nordic development kit due to
@@ -220,13 +222,11 @@ To use the Docker container for setup, complete the following steps:
     -   _-e RUNAS=\$(id -u)_ is needed to start the container session as the
         current user instead of root.
 
-4.  Check out or update the nRF Connect SDK to the recommended `v1.5.0` version
-    by running the following command in the Docker container:
+4.  Update the nRF Connect SDK to the most recent supported revision, by running
+    the following command:
 
-         $ setup --ncs v1.5.0
-         /var/ncs repository is empty. Do you wish to check out nRF Connect SDK sources [v1.5.0]? [Y/N] y
-         ...
-         /var/chip repository is initialized, skipping...
+         $ cd /var/chip
+         $ python3 scripts/setup/nrfconnect/update_ncs.py --update
 
 Now you can proceed with the [Building](#building) instruction.
 
@@ -239,23 +239,14 @@ To use the native shell for setup, complete the following steps:
     -   [nRF Command Line Tools](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools)
     -   [GN meta-build system](https://gn.googlesource.com/gn/)
 
-2.  Depending on whether you have the nRF Connect SDK installed:
-
-    -   Follow the
-        [guide](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#)
-        in the nRF Connect SDK documentation to install the nRF Connect SDK
-        v1.5.0. Since command-line tools will be used for building the example,
-        installing SEGGER Embedded Studio is not required.
-
-    -   If you have an older version of the SDK installed, use the following
-        commands to update it to the recommended version. Replace
-        _nrfconnect-dir_ with the path to your nRF Connect SDK installation
-        directory.
+2.  If you do not have the nRF Connect SDK installed, follow the
+    [guide](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#)
+    in the nRF Connect SDK documentation to install the latest stable nRF
+    Connect SDK version. Since command-line tools will be used for building the
+    example, installing SEGGER Embedded Studio is not required.
 
-               $ cd nrfconnect-dir/nrf
-               $ git fetch origin
-               $ git checkout v1.5.0
-               $ west update
+    If you have the SDK already installed, continue to the next step and update
+    the nRF Connect SDK after initializing environment variables.
 
 3.  Initialize environment variables referred to by the CHIP and the nRF Connect
     SDK build scripts. Replace _nrfconnect-dir_ with the path to your nRF
@@ -266,6 +257,13 @@ To use the native shell for setup, complete the following steps:
          $ export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
          $ export GNUARMEMB_TOOLCHAIN_PATH=toolchain-dir
 
+4.  Update the nRF Connect SDK to the most recent supported revision by running
+    the following command (replace _chip-dir_ with the path to CHIP repository
+    directory):
+
+         $ cd chip-dir
+         $ python3 scripts/setup/nrfconnect/update_ncs.py --update
+
 Now you can proceed with the [Building](#building) instruction.
 
 <hr>
diff --git a/examples/lighting-app/nrfconnect/dts.overlay b/examples/lighting-app/nrfconnect/dts.overlay
deleted file mode 100644 (file)
index e3716a4..0000000
+++ /dev/null
@@ -1,27 +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.
- */
-
-/ {
-       /*
-       * In some default configurations within the nRF Connect SDK,
-       * e.g. on nRF52840, the chosen zephyr,entropy node is &cryptocell.
-       * This devicetree overlay ensures that default is overridden wherever it
-       * is set, as this application uses the RNG node for entropy exclusively.
-       */
-       chosen {
-               zephyr,entropy = &rng;
-       };
-};
diff --git a/examples/lock-app/efr32/build b/examples/lock-app/efr32/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lock-app/efr32/include/ble-configuration.h b/examples/lock-app/efr32/include/ble-configuration.h
deleted file mode 100644 (file)
index c405714..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/*******************************************************************************
- * @file
- * @brief ble-configuration.h
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-// Top level macros
-#define SILABS_AF_DEVICE_NAME "lock-example"
-
-// Generated plugin macros
-
-#ifdef EMBER_AF_BOARD_TYPE
-#undef EMBER_AF_BOARD_TYPE
-#endif
-#define EMBER_AF_BOARD_TYPE BOARD_ID
diff --git a/examples/lock-app/efr32/include/board_features.h b/examples/lock-app/efr32/include/board_features.h
deleted file mode 100644 (file)
index 68d64b1..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief board_features.h
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include "ble-configuration.h"
-
-/* Indicate if LCD is supported */
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_LCD_SUPPORT
-#endif
-
-/* Indicate if the same pins are used for LEDs and Buttons on the WSTK */
-#if (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_LED_BUTTON_ON_SAME_PIN
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_SPI_FLASH
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4101B)
-#define FEATURE_IOEXPANDER
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4151A) || (EMBER_AF_BOARD_TYPE == BRD4158A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A)
-#define FEATURE_PA_INPUT_FROM_VBAT
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_EXP_HEADER_USART1
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4103A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4170A)
-#define FEATURE_EXP_HEADER_USART3
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_PTI_SUPPORT
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) || (EMBER_AF_BOARD_TYPE == BRD4163A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) || (EMBER_AF_BOARD_TYPE == BRD4167A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4168A) || (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4170A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4300A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4309A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_HW_FLOW_CONTROL
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A)
-#define FEATURE_I2C_SENSOR
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) || (EMBER_AF_BOARD_TYPE == BRD4173A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) || (EMBER_AF_BOARD_TYPE == BRD4175A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) || (EMBER_AF_BOARD_TYPE == BRD4180B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) || (EMBER_AF_BOARD_TYPE == BRD4182A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) || (EMBER_AF_BOARD_TYPE == BRD4300A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) || (EMBER_AF_BOARD_TYPE == BRD4303A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) || (EMBER_AF_BOARD_TYPE == BRD4305C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) || (EMBER_AF_BOARD_TYPE == BRD4306A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) || (EMBER_AF_BOARD_TYPE == BRD4306D) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) || (EMBER_AF_BOARD_TYPE == BRD4310A)
-#define FEATURE_LFXO
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4179B)
-#define FEATURE_EFP
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == BRD4100A) || (EMBER_AF_BOARD_TYPE == BRD4101B) || (EMBER_AF_BOARD_TYPE == BRD4103A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4104A) || (EMBER_AF_BOARD_TYPE == BRD4105A) || (EMBER_AF_BOARD_TYPE == BRD4150A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4150B) || (EMBER_AF_BOARD_TYPE == BRD4150C) || (EMBER_AF_BOARD_TYPE == BRD4151A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4153A) || (EMBER_AF_BOARD_TYPE == BRD4158A) || (EMBER_AF_BOARD_TYPE == BRD4159A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4160A) || (EMBER_AF_BOARD_TYPE == BRD4161A) || (EMBER_AF_BOARD_TYPE == BRD4162A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4163A) || (EMBER_AF_BOARD_TYPE == BRD4164A) || (EMBER_AF_BOARD_TYPE == BRD4165B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4166A) || (EMBER_AF_BOARD_TYPE == BRD4167A) || (EMBER_AF_BOARD_TYPE == BRD4168A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4169A) || (EMBER_AF_BOARD_TYPE == BRD4169B) || (EMBER_AF_BOARD_TYPE == BRD4170A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4171A) || (EMBER_AF_BOARD_TYPE == BRD4172A) || (EMBER_AF_BOARD_TYPE == BRD4172B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4173A) || (EMBER_AF_BOARD_TYPE == BRD4174A) || (EMBER_AF_BOARD_TYPE == BRD4174B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4175A) || (EMBER_AF_BOARD_TYPE == BRD4179B) || (EMBER_AF_BOARD_TYPE == BRD4180A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4180B) || (EMBER_AF_BOARD_TYPE == BRD4181A) || (EMBER_AF_BOARD_TYPE == BRD4181B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4182A) || (EMBER_AF_BOARD_TYPE == BRD4183A) || (EMBER_AF_BOARD_TYPE == BRD4184A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4300A) || (EMBER_AF_BOARD_TYPE == BRD4301A) || (EMBER_AF_BOARD_TYPE == BRD4302A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4303A) || (EMBER_AF_BOARD_TYPE == BRD4304A) || (EMBER_AF_BOARD_TYPE == BRD4305A) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4305C) || (EMBER_AF_BOARD_TYPE == BRD4305D) || (EMBER_AF_BOARD_TYPE == BRD4305E) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306A) || (EMBER_AF_BOARD_TYPE == BRD4306B) || (EMBER_AF_BOARD_TYPE == BRD4306C) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4306D) || (EMBER_AF_BOARD_TYPE == BRD4308A) || (EMBER_AF_BOARD_TYPE == BRD4308B) ||                 \
-    (EMBER_AF_BOARD_TYPE == BRD4309A) || (EMBER_AF_BOARD_TYPE == BRD4310A) || (EMBER_AF_BOARD_TYPE == BRD4311A) ||                 \
-    (EMBER_AF_BOARD_TYPE == RD_0057_0101)
-#define FEATURE_BOARD_DETECTED
-#endif
-
-#if (EMBER_AF_BOARD_TYPE == CUSTOM_BOARD)
-// Uncomment the corresponding line in case of using Silicon Labs board feature in your design.
-// For using the selected feature you may need additional drivers. Check an appropriate SDK example for reference.
-
-// #define FEATURE_LCD_SUPPORT
-// #define FEATURE_LED_BUTTON_ON_SAME_PIN
-// #define FEATURE_SPI_FLASH
-// #define FEATURE_IOEXPANDER
-// #define FEATURE_PA_INPUT_FROM_VBAT
-// #define FEATURE_EXP_HEADER_USART1
-// #define FEATURE_EXP_HEADER_USART3
-// #define FEATURE_PTI_SUPPORT
-// #define FEATURE_HW_FLOW_CONTROL
-// #define FEATURE_I2C_SENSOR
-// #define FEATURE_LFXO
-// #define FEATURE_EFP
-// #define FEATURE_BOARD_DETECTED
-#endif
diff --git a/examples/lock-app/efr32/include/hal-config-app-common.h b/examples/lock-app/efr32/include/hal-config-app-common.h
deleted file mode 100644 (file)
index b19a615..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/******************************************************************************
- * @file
- * @brief hal-config-app-common.h
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-#if defined(FEATURE_IOEXPANDER)
-#include "hal-config-ioexp.h"
-#endif
-
-#define HAL_EXTFLASH_FREQUENCY (1000000)
-
-#define HAL_PTI_ENABLE (1)
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000)
-
-#define HAL_PA_RAMP (10)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-
-#define HAL_PA_VOLTAGE BSP_PA_VOLTAGE
-
-// Select antenna path on EFR32xG2x devices:
-//   - RF2G2_IO1: 0
-//   - RF2G2_IO2: 1
-#define GECKO_RF_ANTENNA 1
-#if defined(FEATURE_EXP_HEADER_USART3)
-
-#define BSP_EXP_USART USART3
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART3_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART3_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART3_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART3_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART3_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART3_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART3_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART3_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART3_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART3_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART3_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART3_TX_LOC
-
-#elif defined(FEATURE_EXP_HEADER_USART1)
-
-#define BSP_EXP_USART USART1
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART1_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART1_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART1_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART1_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART1_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART1_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART1_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART1_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART1_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART1_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART1_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART1_TX_LOC
-
-#else
-
-#define BSP_EXP_USART USART0
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART0_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART0_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART0_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART0_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART0_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART0_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART0_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART0_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART0_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART0_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART0_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART0_TX_LOC
-
-#endif // FEATURE_EXP_HEADER_USART3
diff --git a/examples/lock-app/k32w/Makefile b/examples/lock-app/k32w/Makefile
deleted file mode 100644 (file)
index 44d55b1..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-#
-#
-#   Copyright (c) 2020 Project CHIP Authors
-#   Copyright (c) 2020 Google LLC.
-#   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.
-#
-
-#
-#   @file
-#         Makefile for building the CHIP K32W Lock Example Application.
-#
-
-PROJECT_ROOT := $(realpath .)
-
-CHIP_ROOT ?= $(realpath $(PROJECT_ROOT)/third_party/connectedhomeip)
-BUILD_SUPPORT_DIR = $(CHIP_ROOT)/config/k32w
-
-include $(BUILD_SUPPORT_DIR)/k32w061-app.mk
-include $(BUILD_SUPPORT_DIR)/k32w061-chip.mk
-
-APP = chip-k32w061-lock-example
-
-SRCS = \
-    $(PROJECT_ROOT)/main/main.cpp                                                                         \
-    $(PROJECT_ROOT)/main/AppTask.cpp                                                                      \
-    $(PROJECT_ROOT)/main/BoltLockManager.cpp                                                              \
-    $(PROJECT_ROOT)/main/ZclCallbacks.cpp                                                                 \
-    $(CHIP_ROOT)/examples/platform/k32w/util/LEDWidget.cpp                                                \
-    $(CHIP_ROOT)/examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.c                                \
-    ${CHIP_ROOT}/src/app/util/af-event.cpp                                                                \
-    ${CHIP_ROOT}/src/app/util/af-main-common.c                                                            \
-    $(CHIP_ROOT)/src/app/util/attribute-size.c                                                            \
-    $(CHIP_ROOT)/src/app/util/attribute-storage.c                                                         \
-    $(CHIP_ROOT)/src/app/util/attribute-table.c                                                           \
-    $(CHIP_ROOT)/src/app/util/chip-message-send.cpp                                                       \
-    $(CHIP_ROOT)/src/app/util/client-api.c                                                                \
-    $(CHIP_ROOT)/src/app/util/ember-print.cpp                                                             \
-    $(CHIP_ROOT)/src/app/util/message.c                                                                   \
-    $(CHIP_ROOT)/src/app/util/process-cluster-message.c                                                   \
-    $(CHIP_ROOT)/src/app/util/process-global-message.c                                                    \
-    $(CHIP_ROOT)/src/app/util/util.c                                                                      \
-    $(CHIP_ROOT)/src/app/clusters/on-off-server/on-off.c                                                  \
-    $(CHIP_ROOT)/examples/common/chip-app-server/DataModelHandler.cpp                                     \
-    $(CHIP_ROOT)/examples/common/chip-app-server/Server.cpp                                               \
-    $(CHIP_ROOT)/examples/lock-app/lock-common/gen/call-command-handler.c                                 \
-    $(CHIP_ROOT)/examples/lock-app/lock-common/gen/callback-stub.c                                        \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/tasks.c                                         \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/portable/MemMang/heap_3.c                       \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/list.c                                          \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/portable/GCC/ARM_CM3/port.c                     \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/queue.c                                         \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/timers.c                                        \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/event_groups.c                                  \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/PDM/pdm_port.c                                      \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/FunctionLib/FunctionLib.c                           \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Flash/Internal/Flash_Adapter.c                      \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Panic/Source/Panic.c                                \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/OSAbstraction/Source/fsl_os_abstraction_free_rtos.c \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Reset/Reset.c                                       \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/LED/Source/LED.c                                    \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Keyboard/Source/Keyboard.c                          \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/GPIO/GPIO_Adapter.c                                 \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/TimersManager/Source/TimersManager.c                \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/TimersManager/Source/TMR_Adapter.c                  \
-    $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/board_utility.c            \
-    $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/board.c                    \
-    $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/hardware_init.c            \
-    $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_common.c                                              \
-    $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_inputmux.c                                            \
-    $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_pint.c                                                \
-    $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_reset.c
-
-INC_DIRS = \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/include                                                  \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/include/private                                          \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/portable/GCC/ARM_CM3                            \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/third_party/unity/src                                    \
-    $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/include/                                                 \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/OSAbstraction/Interface                             \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/FunctionLib/                                        \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Flash/Internal/                                     \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Panic/Interface/                                    \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/LED/Interface/                                      \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/Keyboard/Interface/                                 \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/TimersManager/Interface/                            \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/RNG/Interface/                                      \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/GPIO/                                               \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/XCVR/DK6/                                           \
-    $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/                           \
-    $(K32W061_SDK_ROOT)/devices/K32W061/drivers/                                                          \
-    $(K32W061_SDK_ROOT)/components/serial_manager/                                                        \
-    $(PROJECT_ROOT)                                                                                       \
-    $(PROJECT_ROOT)/src                                                                                   \
-    $(PROJECT_ROOT)/main                                                                                  \
-    $(PROJECT_ROOT)/main/include                                                                          \
-    $(CHIP_ROOT)/examples/platform/k32w/util/include                                                      \
-    $(CHIP_ROOT)/examples/platform/k32w/app/support                                                       \
-    $(CHIP_ROOT)/examples/platform/k32w/app/project_include                                               \
-    $(CHIP_ROOT)/examples/lock-app/lock-common/                                                           \
-    $(CHIP_ROOT)/examples/common/chip-app-server/include/                                                 \
-    $(CHIP_ROOT)/src/include/                                                                             \
-    $(CHIP_ROOT)/src/lib                                                                                  \
-    $(CHIP_ROOT)/src/                                                                                     \
-    $(CHIP_ROOT)/src/app/util                                                                             \
-    $(CHIP_ROOT)/src/system                                                                               \
-    $(CHIP_ROOT)/third_party/openthread/repo/src/core
-
-LIBS = \
-    -lopenthread-cli-ftd                                                                                  \
-    -lopenthread-ftd                                                                                      \
-    -lopenthread-k32w061_plat                                                                             \
-    -lopenthread-k32w061_sdk                                                                              \
-    $(K32W061_SDK_ROOT)/middleware/wireless/ieee-802.15.4/lib/libMiniMac.a                                \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/XCVR/lib/libRadio.a                                 \
-    $(K32W061_SDK_ROOT)/middleware/wireless/framework/PDM/Library/libPDM.a                                \
-
-DEFINES = \
-    CPU_K32W061HN                                                                                         \
-    CPU_JN518X                                                                                            \
-    CPU_JN518X_REV=2                                                                                      \
-    JENNIC_CHIP_FAMILY_NAME=_JN518x                                                                       \
-    SDK_DEBUGCONSOLE=0                                                                                    \
-    USE_RTOS=1                                                                                            \
-    FSL_RTOS_FREE_RTOS=1                                                                                  \
-    gUartDebugConsole_d=0                                                                                 \
-    gUsePdm_d=1                                                                                           \
-    gLEDSupported_d                                                                                       \
-    gKeyBoardSupported_d                                                                                  \
-    gPdmNbSegments=64                                                                                     \
-    osCustomStartup=1                                                                                     \
-    OM15082=1                                                                                             \
-    gKBD_KeysCount_c=3                                                                                    \
-    gLEDsOnTargetBoardCnt_c=2                                                                             \
-    gLED_InvertedMode_d=1                                                                                 \
-    ENABLE_RAM_VECTOR_TABLE=1                                                                             \
-    gTMR_Enabled_d=1                                                                                      \
-    gTimestamp_Enabled_d=0                                                                                \
-    gMainThreadStackSize_c=2048                                                                           \
-    K32W_LOG_ENABLED=1                                                                                    \
-    CHIP_ENABLE_OPENTHREAD=1
-
-CFLAGS = \
-    --specs=nano.specs
-
-LDFLAGS = \
-    --specs=nano.specs
-
-ifdef DEVICE_FIRMWARE_REVISION
-DEFINES += \
-    CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION=\"$(DEVICE_FIRMWARE_REVISION)\"
-endif
-
-# A product's firmware usually comes with two build "flavors":
-# 1) a "development" build which typically enables debugging artifacts along with logging,
-# and disables security and optimizations and
-# 2) a "release" build which targets end-user devices
-# and disables debugging artifacts and logging, and enables security and optimizations.
-#
-# To facilitate supporting these two build flavors, the sample app source code supports
-# the build configuration option BUILD_RELEASE. By default, BUILD_RELEASE is not defined
-# and a development build is produced. If make is invoked with BUILD_RELEASE=1, then
-# a "pseudo-release" build is produced.
-#
-# We say "pseudo-release" build because the sample app is never to be used as-is
-# as the firmware for an end-user device. However, since real products may start off with
-# the sample app source code, we show how the BUILD_RELEASE build configuration option
-# can be used to produce two build flavors (development and release) of the firmware.
-#
-# IMPORTANT: By no means does the use of BUILD_RELEASE in the sample app cover all key aspects that
-# one should be concerned with (e.g. security, performance) when targeting real world end-user
-# devices. This is simply provided for guidance on how to support two build flavors.
-
-ifdef BUILD_RELEASE
-    DEFINES += BUILD_RELEASE=1
-    # Disable Thread logging.
-    CHIP_DEFINES += CHIP_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_NONE
-else
-    DEFINES += BUILD_RELEASE=0
-    # Increase Tread logging level to INFO.
-    CHIP_DEFINES += CHIP_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG
-endif
-
-CHIP_PROJECT_CONFIG = ${CHIP_ROOT}/examples/platform/k32w/app/project_include/CHIPProjectConfig.h
-
-OPENTHREAD_CONFIGURE_OPTIONS += \
-    --enable-child-supervision \
-    --enable-jam-detection
-
-LINKER_SCRIPT = ${CHIP_ROOT}/examples/platform/k32w/app/ldscripts/chip-k32w061-lock-example.ld
-
-$(call GenerateBuildRules)
diff --git a/examples/lock-app/k32w/build b/examples/lock-app/k32w/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
index c3445cc..edb5667 100644 (file)
 
 #include "openthread/platform/logging.h"
 #include "openthread/platform/uart.h"
+#include <mbedtls/platform.h>
 #include <openthread-system.h>
 #include <openthread/cli.h>
 #include <openthread/error.h>
-#include <openthread/heap.h>
 
 #include <core/CHIPError.h>
 #include <platform/CHIPDeviceLayer.h>
@@ -43,8 +43,6 @@ using namespace ::chip::Inet;
 using namespace ::chip::DeviceLayer;
 using namespace ::chip::Logging;
 
-extern "C" void * pvPortCallocRtos(size_t num, size_t size);
-
 #include <AppTask.h>
 
 typedef void (*InitFunc)(void);
@@ -54,6 +52,8 @@ extern InitFunc __init_array_end;
 /* needed for FreeRtos Heap 4 */
 uint8_t __attribute__((section(".heap"))) ucHeap[0xF000];
 
+extern "C" void * pvPortCallocRtos(size_t num, size_t size);
+
 extern "C" void main_task(void const * argument)
 {
     CHIP_ERROR ret = CHIP_ERROR_MAX;
@@ -65,6 +65,8 @@ extern "C" void main_task(void const * argument)
         (*pFunc)();
     }
 
+    mbedtls_platform_set_calloc_free(pvPortCallocRtos, vPortFree);
+
     /* Used for HW initializations */
     otSysInit(0, NULL);
 
index f5f88af..fc5ea3b 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -696,10 +734,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -710,6 +744,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index 14a3742..d028079 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,6 +34,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
index 9c9644f..acd8add 100644 (file)
@@ -43,6 +43,29 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
+ * Cluster Basic
+ *
+ */
+@interface CHIPBasic : CHIPCluster
+
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
+
+@end
+
+/**
  * Cluster On/off
  *
  */
index 2438c14..2877d11 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -308,6 +354,351 @@ private:
 }
 @end
 
+@interface CHIPBasic ()
+@property (readonly) Controller::BasicCluster cppCluster;
+@end
+
+@implementation CHIPBasic
+
+- (Controller::ClusterBase *)getCluster
+{
+    return &_cppCluster;
+}
+
+- (void)readAttributeInteractionModelVersion:(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.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorID:(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.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductID:(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.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersion:(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.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
+{
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(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.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeSoftwareVersionString(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 8802797..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Low Power
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index 5c9bdd7..730d7b2 100644 (file)
@@ -28,6 +28,7 @@
 
 using namespace chip;
 
+EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);
 
 static EmberAfStatus status(bool wasHandled, bool clusterExists, bool mfgSpecific)
@@ -69,6 +70,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
     {
         switch (cmd->apsFrame->clusterId)
         {
+        case ZCL_BASIC_CLUSTER_ID:
+            // No commands are enabled for cluster Basic
+            result = status(false, true, cmd->mfgSpecific);
+            break;
         case ZCL_ON_OFF_CLUSTER_ID:
             result = emberAfOnOffClusterServerCommandParse(cmd);
             break;
index 7673db7..3c6022f 100644 (file)
@@ -27,6 +27,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
 {
     switch (clusterId)
     {
+    case ZCL_BASIC_CLUSTER_ID:
+        emberAfBasicClusterInitCallback(endpoint);
+        break;
     case ZCL_ON_OFF_CLUSTER_ID:
         emberAfOnOffClusterInitCallback(endpoint);
         break;
@@ -36,6 +39,11 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     }
 }
 
+void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint)
+{
+    // To prevent warning
+    (void) endpoint;
+}
 void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
index fe0caa9..367f192 100644 (file)
@@ -37,6 +37,14 @@ void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clust
 
 // Cluster Init Functions
 
+/** @brief Basic Cluster Init
+ *
+ * Cluster Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);
+
 /** @brief On/off Cluster Init
  *
  * Cluster Init
@@ -48,6 +56,74 @@ void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint);
 // Cluster Server/Client Init Functions
 
 //
+// Basic Cluster server
+//
+
+/** @brief Basic Cluster Server Init
+ *
+ * Server Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint);
+
+/** @brief Basic Cluster Server Attribute Changed
+ *
+ * Server Attribute Changed
+ *
+ * @param endpoint    Endpoint that is being initialized
+ * @param attributeId Attribute that changed
+ */
+void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
+
+/** @brief Basic 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 emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
+                                                                           uint16_t manufacturerCode);
+
+/** @brief Basic 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 emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
+                                                  EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
+
+/** @brief Basic 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 emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
+                                                                   EmberAfAttributeType attributeType, uint8_t size,
+                                                                   uint8_t * value);
+
+/** @brief Basic Cluster Server Tick
+ *
+ * server Tick
+ *
+ * @param endpoint  Endpoint that is being served
+ */
+void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
+
+//
 // On/off Cluster server
 //
 
index 97de7f6..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for Sleep
+ *
+ * Command: Sleep
+ */
+#define emberAfFillCommandLow                                                                                                      \
+    PowerClusterSleep() emberAfFillExternalBuffer(mask,                                                                            \
+                                                                                                                                   \
+                                                  ZCL_SLEEP_COMMAND_ID, "", );
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
index 99de14e..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Low Power
+#define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
index d31a267..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Low Power
+#define ZCL_SLEEP_COMMAND_ID (0x00)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
index 41d5eeb..07daefd 100644 (file)
 #if BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 32 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                  \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 64 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 96 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 112 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 176 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 180 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */                 \
     }
 
 #else // !BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 32 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 64 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 96 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 112 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 176 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 180 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */              \
     }
 
 #endif // BIGENDIAN_CPU
 
-#define GENERATED_DEFAULTS_COUNT (0)
+#define GENERATED_DEFAULTS_COUNT (7)
 
 #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
 #define ZAP_LONG_DEFAULTS_INDEX(index)                                                                                             \
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 2
+#define GENERATED_ATTRIBUTE_COUNT 14
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
         { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } },         /* On/off (server): cluster revision */                     \
             { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, { (uint8_t *) 0x00 } }, /* On/off (server): on/off */                               \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }                                      \
+            }, /* Basic (server): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }       \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(32) }      \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(64) } }, /* Basic (server): UserLabel */                                       \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(96) } }, /* Basic (server): Location */                                        \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(112) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(176) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(180) }     \
+            }, /* Basic (server): SoftwareVersionString */                                                                         \
     }
 
 // This is an array of EmberAfCluster structures.
     };
 
 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
-#define GENERATED_CLUSTER_COUNT 1
+#define GENERATED_CLUSTER_COUNT 2
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
         {                                                                                                                          \
             ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                            \
             chipFuncArrayOnOffServer                                                                                               \
         }, /* Endpoint: 1, Cluster: On/off (server) */                                                                             \
+            {                                                                                                                      \
+                0x0028, ZAP_ATTRIBUTE_INDEX(2), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                            \
+            }, /* Endpoint: 1, Cluster: Basic (server) */                                                                          \
     }
 
 #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 1, 3 },                                                                                            \
+        { ZAP_CLUSTER_INDEX(0), 2, 257 },                                                                                          \
     }
 
 // Largest attribute size is needed for various buffers
-#define ATTRIBUTE_LARGEST (3)
+#define ATTRIBUTE_LARGEST (64)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (0)
+#define ATTRIBUTE_SINGLETONS_SIZE (254)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (3)
+#define ATTRIBUTE_MAX_SIZE (257)
 
 // 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 (3)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (6)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
         { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* On/off (server): Off */                                        \
             { 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): On */                                         \
             { 0x0006, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): Toggle */                                     \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
     }
 
 // Array of EmberAfManufacturerCodeEntry structures for commands.
index b5f0621..d4f918b 100644 (file)
 #define EMBER_APS_UNICAST_MESSAGE_COUNT 10
 
 /**** Cluster endpoint counts ****/
+#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 
 /**** Cluster Plugins ****/
 
+// Use this macro to check if the server side of the Basic cluster is included
+#define ZCL_USING_BASIC_CLUSTER_SERVER
+#define EMBER_AF_PLUGIN_BASIC_SERVER
+#define EMBER_AF_PLUGIN_BASIC
+
 // Use this macro to check if the server side of the On/off cluster is included
 #define ZCL_USING_ON_OFF_CLUSTER_SERVER
 #define EMBER_AF_PLUGIN_ON_OFF_SERVER
index 86a2a27..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #define CHIP_PRINTCLUSTER_IAS_WD_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_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
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
index 5d20290..807263d 100644 (file)
@@ -1,6 +1,6 @@
 {
-  "writeTime": "Wed Nov 18 2020 11:03:31 GMT+0100 (Central European Standard Time)",
-  "featureLevel": 4,
+  "writeTime": "Tue Mar 02 2021 13:36:08 GMT-0500 (Eastern Standard Time)",
+  "featureLevel": 11,
   "creator": "zap",
   "keyValuePairs": [
     {
     {
       "name": "Anonymous Endpoint Type",
       "deviceTypeName": "CBA-onofflight",
-      "deviceTypeCode": "0x0100",
-      "deviceTypeProfileId": "0x109",
+      "deviceTypeCode": 256,
+      "deviceTypeProfileId": 265,
       "clusters": [
         {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "client",
-          "enabled": 0,
-          "commands": [],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "server",
-          "enabled": 0,
-          "commands": [],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "ZCL version",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x08",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "power source",
-              "code": 7,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
           "name": "Power Configuration",
           "code": 1,
           "mfgCode": null,
           "define": "POWER_CONFIG_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": []
+          ]
         },
         {
           "name": "Device Temperature Configuration",
           "define": "DEVICE_TEMP_CLUSTER",
           "side": "client",
           "enabled": 0,
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": []
+          ]
         },
         {
           "name": "Device Temperature Configuration",
           "define": "DEVICE_TEMP_CLUSTER",
           "side": "server",
           "enabled": 0,
-          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ]
+          ],
+          "commands": []
         },
         {
           "name": "Identify",
           "define": "ON_OFF_CLUSTER",
           "side": "server",
           "enabled": 1,
-          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ]
+          ],
+          "commands": []
         },
         {
           "name": "Alarms",
           ]
         },
         {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "client",
+          "enabled": 0,
+          "commands": [],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "InteractionModelVersion",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
           "name": "Occupancy Sensing",
           "code": 1030,
           "mfgCode": null,
           "define": "OCCUPANCY_SENSING_CLUSTER",
           "side": "server",
           "enabled": 0,
-          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ]
+          ],
+          "commands": []
         }
       ]
     }
       "networkId": 0
     }
   ]
-}
+}
\ No newline at end of file
index b97d0ba..3b51c83 100644 (file)
@@ -19,9 +19,10 @@ get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connect
 get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH)
 get_filename_component(LOCK_COMMON ${CHIP_ROOT}/examples/lock-app/lock-common REALPATH)
 
-set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
+include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
 
 # Load NCS/Zephyr build system
+set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module)
 find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
 
index 857136b..814f0b9 100644 (file)
@@ -89,7 +89,9 @@ with other Thread devices in the network.
 
 ## Requirements
 
-The application requires the nRF Connect SDK v1.5.0 to work correctly.
+The application requires a specific revision of the nRF Connect SDK to work
+correctly. See [Setting up the environment](#setting-up-the-environment) for
+more information.
 
 <a name="supported_devices"></a>
 
@@ -176,9 +178,9 @@ using the following command:
 
         $ git submodule update --init
 
-The example requires the nRF Connect SDK v1.5.0. You can either install it along
-with the related tools directly on your system or use a Docker image that has
-the tools pre-installed.
+The example requires a specific revision of the nRF Connect SDK. You can either
+install it along with the related tools directly on your system or use a Docker
+image that has the tools pre-installed.
 
 If you are a macOS user, you won't be able to use the Docker container to flash
 the application onto a Nordic development kit due to
@@ -220,13 +222,11 @@ To use the Docker container for setup, complete the following steps:
     -   _-e RUNAS=\$(id -u)_ is needed to start the container session as the
         current user instead of root.
 
-4.  Check out or update the nRF Connect SDK to the recommended `v1.5.0` version
-    by running the following command in the Docker container:
+4.  Update the nRF Connect SDK to the most recent supported revision, by running
+    the following command:
 
-         $ setup --ncs v1.5.0
-         /var/ncs repository is empty. Do you wish to check out nRF Connect SDK sources [v1.5.0]? [Y/N] y
-         ...
-         /var/chip repository is initialized, skipping...
+         $ cd /var/chip
+         $ python3 scripts/setup/nrfconnect/update_ncs.py --update
 
 Now you can proceed with the [Building](#building) instruction.
 
@@ -239,23 +239,14 @@ To use the native shell for setup, complete the following steps:
     -   [nRF Command Line Tools](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools)
     -   [GN meta-build system](https://gn.googlesource.com/gn/)
 
-2.  Depending on whether you have the nRF Connect SDK installed:
-
-    -   Follow the
-        [guide](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#)
-        in the nRF Connect SDK documentation to install the nRF Connect SDK
-        v1.5.0. Since command-line tools will be used for building the example,
-        installing SEGGER Embedded Studio is not required.
-
-    -   If you have an older version of the SDK installed, use the following
-        commands to update it to the recommended version. Replace
-        _nrfconnect-dir_ with the path to your nRF Connect SDK installation
-        directory.
+2.  If you do not have the nRF Connect SDK installed, follow the
+    [guide](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#)
+    in the nRF Connect SDK documentation to install the latest stable nRF
+    Connect SDK version. Since command-line tools will be used for building the
+    example, installing SEGGER Embedded Studio is not required.
 
-               $ cd nrfconnect-dir/nrf
-               $ git fetch origin
-               $ git checkout v1.5.0
-               $ west update
+    If you have the SDK already installed, continue to the next step and update
+    the nRF Connect SDK after initializing environment variables.
 
 3.  Initialize environment variables referred to by the CHIP and the nRF Connect
     SDK build scripts. Replace _nrfconnect-dir_ with the path to your nRF
@@ -266,6 +257,13 @@ To use the native shell for setup, complete the following steps:
          $ export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
          $ export GNUARMEMB_TOOLCHAIN_PATH=toolchain-dir
 
+4.  Update the nRF Connect SDK to the most recent supported revision by running
+    the following command (replace _chip-dir_ with the path to CHIP repository
+    directory):
+
+         $ cd chip-dir
+         $ python3 scripts/setup/nrfconnect/update_ncs.py --update
+
 Now you can proceed with the [Building](#building) instruction.
 
 <hr>
diff --git a/examples/lock-app/nrfconnect/dts.overlay b/examples/lock-app/nrfconnect/dts.overlay
deleted file mode 100644 (file)
index e3716a4..0000000
+++ /dev/null
@@ -1,27 +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.
- */
-
-/ {
-       /*
-       * In some default configurations within the nRF Connect SDK,
-       * e.g. on nRF52840, the chosen zephyr,entropy node is &cryptocell.
-       * This devicetree overlay ensures that default is overridden wherever it
-       * is set, as this application uses the RNG node for entropy exclusively.
-       */
-       chosen {
-               zephyr,entropy = &rng;
-       };
-};
diff --git a/examples/lock-app/qpg6100/build b/examples/lock-app/qpg6100/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lock-app/qpg6100/src/main.cpp b/examples/lock-app/qpg6100/src/main.cpp
deleted file mode 100644 (file)
index ea78c95..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*\r
- *\r
- *    Copyright (c) 2020 Project CHIP Authors\r
- *    All rights reserved.\r
- *\r
- *    Licensed under the Apache License, Version 2.0 (the "License");\r
- *    you may not use this file except in compliance with the License.\r
- *    You may obtain a copy of the License at\r
- *\r
- *        http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *    Unless required by applicable law or agreed to in writing, software\r
- *    distributed under the License is distributed on an "AS IS" BASIS,\r
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *    See the License for the specific language governing permissions and\r
- *    limitations under the License.\r
- */\r
-/*\r
- * Copyright (c) 2020, Qorvo Inc\r
- *\r
- *\r
- *\r
- * This software is owned by Qorvo Inc\r
- * and protected under applicable copyright laws.\r
- * It is delivered under the terms of the license\r
- * and is intended and supplied for use solely and\r
- * exclusively with products manufactured by\r
- * Qorvo Inc.\r
- *\r
- *\r
- * THIS SOFTWARE IS PROVIDED IN AN "AS IS"\r
- * CONDITION. NO WARRANTIES, WHETHER EXPRESS,\r
- * IMPLIED OR STATUTORY, INCLUDING, BUT NOT\r
- * LIMITED TO, IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A\r
- * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
- * QORVO INC. SHALL NOT, IN ANY\r
- * CIRCUMSTANCES, BE LIABLE FOR SPECIAL,\r
- * INCIDENTAL OR CONSEQUENTIAL DAMAGES,\r
- * FOR ANY REASON WHATSOEVER.\r
- *\r
- * $Change: 154416 $\r
- * $DateTime: 2020/08/21 09:47:42 $\r
- *\r
- */\r
-\r
-/** @file "main.cpp"\r
- *\r
- * Main application.\r
- */\r
-\r
-/*****************************************************************************\r
- *                    Includes Definitions\r
- *****************************************************************************/\r
-\r
-// FreeRTOS\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-\r
-// Qorvo CHIP library\r
-#include "qvCHIP.h"\r
-\r
-// CHIP includes\r
-#include <platform/CHIPDeviceLayer.h>\r
-#include <support/logging/CHIPLogging.h>\r
-\r
-// Application level logic\r
-#include "AppTask.h"\r
-\r
-using namespace ::chip;\r
-using namespace ::chip::Inet;\r
-using namespace ::chip::DeviceLayer;\r
-using namespace ::chip::DeviceLayer::Internal;\r
-\r
-/*****************************************************************************\r
- *                    Macro Definitions\r
- *****************************************************************************/\r
-\r
-#define APP_NAME "Lock-app"\r
-\r
-/*****************************************************************************\r
- *                    External Function Definitions\r
- *****************************************************************************/\r
-\r
-/*****************************************************************************\r
- *                    Application Function Definitions\r
- *****************************************************************************/\r
-\r
-int Application_Init(void)\r
-{\r
-    int ret = CHIP_ERROR_MAX;\r
-\r
-    /* Launch application task */\r
-    ChipLogProgress(NotSpecified, "============================");\r
-    ChipLogProgress(NotSpecified, "Qorvo " APP_NAME " Launching");\r
-    ChipLogProgress(NotSpecified, "============================");\r
-\r
-    ret = GetAppTask().StartAppTask();\r
-    if (ret != CHIP_NO_ERROR)\r
-    {\r
-        ChipLogError(NotSpecified, "GetAppTask().Init() failed");\r
-        return -1;\r
-    }\r
-\r
-    return 0;\r
-}\r
-\r
-int CHIP_Init(void)\r
-{\r
-    int ret = CHIP_ERROR_MAX;\r
-\r
-    ChipLogProgress(NotSpecified, "Init CHIP Stack");\r
-    ret = PlatformMgr().InitChipStack();\r
-    if (ret != CHIP_NO_ERROR)\r
-    {\r
-        ChipLogError(NotSpecified, "PlatformMgr().InitChipStack() failed");\r
-        goto exit;\r
-    }\r
-\r
-    ChipLogProgress(NotSpecified, "Starting Platform Manager Event Loop");\r
-    ret = PlatformMgr().StartEventLoopTask();\r
-    if (ret != CHIP_NO_ERROR)\r
-    {\r
-        ChipLogError(NotSpecified, "PlatformMgr().StartEventLoopTask() failed");\r
-        goto exit;\r
-    }\r
-\r
-exit:\r
-    return ret;\r
-}\r
-\r
-/*****************************************************************************\r
- * --- Main\r
- *****************************************************************************/\r
-\r
-int main(void)\r
-{\r
-    int result;\r
-\r
-    /* Initialize Qorvo stack */\r
-    result = qvCHIP_init();\r
-    if (result < 0)\r
-    {\r
-        goto exit;\r
-    }\r
-\r
-    /* Initialize CHIP stack */\r
-    result = CHIP_Init();\r
-    if (result != CHIP_NO_ERROR)\r
-    {\r
-        goto exit;\r
-    }\r
-\r
-    /* Application task */\r
-    result = Application_Init();\r
-    if (result < 0)\r
-    {\r
-        goto exit;\r
-    }\r
-\r
-    /* Start FreeRTOS */\r
-    vTaskStartScheduler();\r
-\r
-exit:\r
-    return 0;\r
-}\r
diff --git a/examples/minimal-mdns/build b/examples/minimal-mdns/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/pigweed-app/nrf5/README.md b/examples/pigweed-app/nrf5/README.md
deleted file mode 100644 (file)
index 08d5c01..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Pigweed example app
-
-This example app exercises functionalities in third_party/pigweed, to see what
-is needed for integrating Pigweed to CHIP, as well as a precursor to CHIP
-functionalities like on-device testing.
-
-## Currently implemented features
-
-### Echo RPC:
-
-```
-python -m pw_hdlc_lite.rpc_console --device /dev/ttyACM0 -b 115200 -p $CHIP_ROOT/third_party/pigweed/repo/pw_rpc/pw_rpc_protos/echo.proto -o /tmp/pw_rpc.out
-```
-
-will start an interactive python shell where Echo RPC can be invoked as
-
-```
-rpcs.pw.rpc.EchoService.Echo(msg="hi")
-```
index bb95677..eaeb2e3 100644 (file)
@@ -19,13 +19,13 @@ get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connect
 get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH)
 set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo")
 
-set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
+include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
 
+# Load NCS/Zephyr build system
+set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
 if(${BOARD} STREQUAL "nrf52840dongle_nrf52840")
     list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-usb_support.conf)
 endif()
-
-# Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module)
 find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
 
index d41732a..00dc0ef 100644 (file)
@@ -64,7 +64,9 @@ other cases.
 
 ## Requirements
 
-The application requires the nRF Connect SDK v1.5.0 to work correctly.
+The application requires a specific revision of the nRF Connect SDK to work
+correctly. See [Setting up the environment](#setting-up-the-environment) for
+more information.
 
 <a name="supported_devices"></a>
 
@@ -114,9 +116,9 @@ using the following command:
 
         $ git submodule update --init
 
-The example requires the nRF Connect SDK v1.5.0. You can either install it along
-with the related tools directly on your system or use a Docker image that has
-the tools pre-installed.
+The example requires a specific revision of the nRF Connect SDK. You can either
+install it along with the related tools directly on your system or use a Docker
+image that has the tools pre-installed.
 
 If you are a macOS user, you won't be able to use the Docker container to flash
 the application onto a Nordic development kit due to
@@ -158,13 +160,11 @@ To use the Docker container for setup, complete the following steps:
     -   _-e RUNAS=\$(id -u)_ is needed to start the container session as the
         current user instead of root.
 
-4.  Check out or update the nRF Connect SDK to the recommended `v1.5.0` version
-    by running the following command in the Docker container:
+4.  Update the nRF Connect SDK to the most recent supported revision, by running
+    the following command:
 
-         $ setup --ncs v1.5.0
-         /var/ncs repository is empty. Do you wish to check out nRF Connect SDK sources [v1.5.0]? [Y/N] y
-         ...
-         /var/chip repository is initialized, skipping...
+         $ cd /var/chip
+         $ python3 scripts/setup/nrfconnect/update_ncs.py --update
 
 Now you can proceed with the [Building](#building) instruction.
 
@@ -177,23 +177,14 @@ To use the native shell for setup, complete the following steps:
     -   [nRF Command Line Tools](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools)
     -   [GN meta-build system](https://gn.googlesource.com/gn/)
 
-2.  Depending on whether you have the nRF Connect SDK installed:
-
-    -   Follow the
-        [guide](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#)
-        in the nRF Connect SDK documentation to install the nRF Connect SDK
-        v1.5.0. Since command-line tools will be used for building the example,
-        installing SEGGER Embedded Studio is not required.
-
-    -   If you have an older version of the SDK installed, use the following
-        commands to update it to the recommended version. Replace
-        _nrfconnect-dir_ with the path to your nRF Connect SDK installation
-        directory.
+2.  If you do not have the nRF Connect SDK installed, follow the
+    [guide](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#)
+    in the nRF Connect SDK documentation to install the latest stable nRF
+    Connect SDK version. Since command-line tools will be used for building the
+    example, installing SEGGER Embedded Studio is not required.
 
-               $ cd nrfconnect-dir/nrf
-               $ git fetch origin
-               $ git checkout v1.5.0
-               $ west update
+    If you have the SDK already installed, continue to the next step and update
+    the nRF Connect SDK after initializing environment variables.
 
 3.  Initialize environment variables referred to by the CHIP and the nRF Connect
     SDK build scripts. Replace _nrfconnect-dir_ with the path to your nRF
@@ -204,6 +195,13 @@ To use the native shell for setup, complete the following steps:
          $ export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
          $ export GNUARMEMB_TOOLCHAIN_PATH=toolchain-dir
 
+4.  Update the nRF Connect SDK to the most recent supported revision by running
+    the following command (replace _chip-dir_ with the path to CHIP repository
+    directory):
+
+         $ cd chip-dir
+         $ python3 scripts/setup/nrfconnect/update_ncs.py --update
+
 Now you can proceed with the [Building](#building) instruction.
 
 <hr>
diff --git a/examples/pigweed-app/nrfconnect/dts.overlay b/examples/pigweed-app/nrfconnect/dts.overlay
deleted file mode 100644 (file)
index e3716a4..0000000
+++ /dev/null
@@ -1,27 +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.
- */
-
-/ {
-       /*
-       * In some default configurations within the nRF Connect SDK,
-       * e.g. on nRF52840, the chosen zephyr,entropy node is &cryptocell.
-       * This devicetree overlay ensures that default is overridden wherever it
-       * is set, as this application uses the RNG node for entropy exclusively.
-       */
-       chosen {
-               zephyr,entropy = &rng;
-       };
-};
diff --git a/examples/platform/efr32/efr32mg12/BRD4161A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4161A/init_board.c
deleted file mode 100644 (file)
index 75f7074..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-#include "em_cmu.h"
-
-#include "em_cmu.h"
-
-#include "em_usart.h"
-#include "mx25flash_spi.h"
-
-#include "bsp.h"
-
-void initBoard(void)
-{
-
-    // Enable clock for CRYOTIMER
-    CMU_ClockEnable(cmuClock_CRYOTIMER, true);
-#if ((HAL_VCOM_ENABLE == 1) || (HAL_USART3_ENABLE == 1) || (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-#if defined(FEATURE_EXP_HEADER_USART3)
-    // Enable clock for USART3
-    CMU_ClockEnable(cmuClock_USART3, true);
-#elif defined(FEATURE_EXP_HEADER_USART1)
-    // Enable clock for USART1
-    CMU_ClockEnable(cmuClock_USART1, true);
-#else
-    // Enable clock for USART0
-    CMU_ClockEnable(cmuClock_USART0, true);
-#endif
-#endif //(HAL_VCOM_ENABLE == 1)
-#if ((HAL_I2CSENSOR_ENABLE == 1) || (HAL_VCOM_ENABLE == 1) || (HAL_SPIDISPLAY_ENABLE == 1) || (HAL_USART3_ENABLE == 1) ||          \
-     (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-    // Enable clock for PRS
-    CMU_ClockEnable(cmuClock_PRS, true);
-    // Enable GPIO clock source
-    CMU_ClockEnable(cmuClock_GPIO, true);
-#endif /* ((HAL_I2CSENSOR_ENABLE == 1)                                                                                             \
-           || (HAL_VCOM_ENABLE == 1)                                                                                               \
-           || (HAL_SPIDISPLAY_ENABLE == 1)                                                                                         \
-           || (HAL_USART3_ENABLE == 1)                                                                                             \
-           || (HAL_USART1_ENABLE == 1)                                                                                             \
-           || (HAL_USART0_ENABLE == 1)) */
-
-    // Put the SPI flash into Deep Power Down mode for those radio boards where it is available
-    MX25_init();
-    MX25_DP();
-    // We must disable SPI communication
-    MX25_deinit();
-}
-
-void initVcomEnable(void)
-{
-#if defined(HAL_VCOM_ENABLE)
-    // Enable VCOM if requested
-    GPIO_PinModeSet(BSP_VCOM_ENABLE_PORT, BSP_VCOM_ENABLE_PIN, gpioModePushPull, HAL_VCOM_ENABLE);
-#endif // HAL_VCOM_ENABLE
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4161A/init_mcu.c b/examples/platform/efr32/efr32mg12/BRD4161A/init_mcu.c
deleted file mode 100644 (file)
index eabd216..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "em_rtcc.h"
-
-#include "FreeRTOSConfig.h"
-#include "bsp.h"
-#include "init_mcu.h"
-
-// Bit [19] in MODULEINFO is the HFXOCALVAL:
-// 1=No factory cal, use default XO tunning value in FW
-// 0=Factory Cal, use XO tunning value in DI
-#define DEVINFO_MODULEINFO_HFXOCALVAL_MASK 0x00080000UL
-// Calibration value for HFXO CTUNE is at DEVINFO Offset 0x08
-#define DEVINFO_MODULEINFO_CRYSTALOSCCALVAL (*((uint16_t *) (uint32_t)(DEVINFO_BASE + 0x8UL)))
-// [15:9] : (LFXOTUNING) Calibration for LFXO TUNING
-// [8:0]  : (HFXOCTUNE) Calibration for HFXO CTUNE
-#define DEVINFO_HFXOCTUNE_MASK 0x01FFUL
-
-#define set_HFXO_CTUNE(val)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        hfxoInit.ctuneSteadyState = (val);                                                                                         \
-    } while (0)
-
-static void initMcu_clocks(void);
-static void initHFXO(void);
-
-void initMcu(void)
-{
-    // ISR safe FreeRTOS API functions must *only* be called
-    // from interrupts that have been assigned a priority at or below
-    // configMAX_SYSCALL_INTERRUPT_PRIORITY.
-    // Here we init all IRQ prio to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
-    // to make sure no IRQ use default priority of zero as that is the highest possible priority
-    for (IRQn_Type i = 0; i < EXT_IRQ_COUNT; i++)
-    {
-        NVIC_SetPriority(i, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
-    }
-
-    // Device errata
-    CHIP_Init();
-
-    // Set up DC-DC converter
-    EMU_DCDCInit_TypeDef dcdcInit = BSP_DCDC_INIT;
-#if HAL_DCDC_BYPASS
-    dcdcInit.dcdcMode = emuDcdcMode_Bypass;
-#endif
-    EMU_DCDCInit(&dcdcInit);
-
-    // Set up clocks
-    initMcu_clocks();
-
-    RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
-    rtccInit.enable            = true;
-    rtccInit.debugRun          = false;
-    rtccInit.precntWrapOnCCV0  = false;
-    rtccInit.cntWrapOnCCV1     = false;
-    rtccInit.prescMode         = rtccCntTickPresc;
-    rtccInit.presc             = rtccCntPresc_1;
-    rtccInit.enaOSCFailDetect  = false;
-    rtccInit.cntMode           = rtccCntModeNormal;
-    RTCC_Init(&rtccInit);
-
-#if defined(EMU_VSCALE_PRESENT)
-    // Set up EM0, EM1 energy mode configuration
-    EMU_EM01Init_TypeDef em01Init = EMU_EM01INIT_DEFAULT;
-    EMU_EM01Init(&em01Init);
-#endif // EMU_VSCALE_PRESENT
-    // Set up EM2, EM3 energy mode configuration
-    EMU_EM23Init_TypeDef em23init = EMU_EM23INIT_DEFAULT;
-#if defined(EMU_VSCALE_PRESENT)
-    em23init.vScaleEM23Voltage = emuVScaleEM23_LowPower;
-#endif // EMU_VSCALE_PRESENT
-    EMU_EM23Init(&em23init);
-
-#if defined(RMU_PRESENT)
-    // Set reset mode for sysreset back to DEFAULT (extended), this might have
-    // been changed by the bootloader to FULL reset.
-    RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_DEFAULT;
-#endif
-}
-
-static void initMcu_clocks(void)
-{
-    // Initialize HFXO
-    initHFXO();
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-
-    // Enable HFXO oscillator, and wait for it to be stable
-    CMU_OscillatorEnable(cmuOsc_HFXO, true, true);
-
-    // Enable HFXO Autostart only if EM2 voltage scaling is disabled.
-    // In 1.0 V mode the chip does not support frequencies > 21 MHz,
-    // this is why HFXO autostart is not supported in this case.
-#if !defined(_EMU_CTRL_EM23VSCALE_MASK)
-    // Automatically start and select HFXO
-    CMU_HFXOAutostartEnable(0, true, true);
-#else
-    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
-#endif //_EMU_CTRL_EM23VSCALE_MASK
-
-    // HFRCO not needed when using HFXO
-    CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
-
-    // Enabling HFBUSCLKLE clock for LE peripherals
-    CMU_ClockEnable(cmuClock_HFLE, true);
-
-    // Initialize LFXO
-    CMU_LFXOInit_TypeDef lfxoInit = BSP_CLK_LFXO_INIT;
-    lfxoInit.ctune                = BSP_CLK_LFXO_CTUNE;
-    CMU_LFXOInit(&lfxoInit);
-    // Set system LFXO frequency
-    SystemLFXOClockSet(BSP_CLK_LFXO_FREQ);
-
-    // Set LFXO if selected as LFCLK
-    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFXO);
-}
-
-static void initHFXO(void)
-{
-    // Initialize HFXO
-    // Use BSP_CLK_HFXO_INIT as last result (4th)
-    CMU_HFXOInit_TypeDef hfxoInit = BSP_CLK_HFXO_INIT;
-    // if Factory Cal exists in DEVINFO then use it above all (1st)
-    if (0 == (DEVINFO->MODULEINFO & DEVINFO_MODULEINFO_HFXOCALVAL_MASK))
-    {
-#if defined(_SILICON_LABS_32B_SERIES_1)
-        set_HFXO_CTUNE(DEVINFO_MODULEINFO_CRYSTALOSCCALVAL);
-#elif defined(_SILICON_LABS_32B_SERIES_2)
-        set_HFXO_CTUNE(DEVINFO->MODXOCAL & _DEVINFO_MODXOCAL_HFXOCTUNEXIANA_MASK);
-#endif
-    }
-    // if User page has CTUNE from studio use that in 2nd place
-#if (MFG_CTUNE_EN == 1)
-    else if (MFG_CTUNE_VAL != 0xFFFF)
-    {
-        set_HFXO_CTUNE(MFG_CTUNE_VAL);
-    }
-#endif
-    // 3rd option, get data from header defined for product/board
-#if defined(BSP_CLK_HFXO_CTUNE) && BSP_CLK_HFXO_CTUNE >= 0
-    else
-    {
-        set_HFXO_CTUNE(BSP_CLK_HFXO_CTUNE);
-    }
-#endif
-    CMU_HFXOInit(&hfxoInit);
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4163A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4163A/init_board.c
deleted file mode 100644 (file)
index 75f7074..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-#include "em_cmu.h"
-
-#include "em_cmu.h"
-
-#include "em_usart.h"
-#include "mx25flash_spi.h"
-
-#include "bsp.h"
-
-void initBoard(void)
-{
-
-    // Enable clock for CRYOTIMER
-    CMU_ClockEnable(cmuClock_CRYOTIMER, true);
-#if ((HAL_VCOM_ENABLE == 1) || (HAL_USART3_ENABLE == 1) || (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-#if defined(FEATURE_EXP_HEADER_USART3)
-    // Enable clock for USART3
-    CMU_ClockEnable(cmuClock_USART3, true);
-#elif defined(FEATURE_EXP_HEADER_USART1)
-    // Enable clock for USART1
-    CMU_ClockEnable(cmuClock_USART1, true);
-#else
-    // Enable clock for USART0
-    CMU_ClockEnable(cmuClock_USART0, true);
-#endif
-#endif //(HAL_VCOM_ENABLE == 1)
-#if ((HAL_I2CSENSOR_ENABLE == 1) || (HAL_VCOM_ENABLE == 1) || (HAL_SPIDISPLAY_ENABLE == 1) || (HAL_USART3_ENABLE == 1) ||          \
-     (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-    // Enable clock for PRS
-    CMU_ClockEnable(cmuClock_PRS, true);
-    // Enable GPIO clock source
-    CMU_ClockEnable(cmuClock_GPIO, true);
-#endif /* ((HAL_I2CSENSOR_ENABLE == 1)                                                                                             \
-           || (HAL_VCOM_ENABLE == 1)                                                                                               \
-           || (HAL_SPIDISPLAY_ENABLE == 1)                                                                                         \
-           || (HAL_USART3_ENABLE == 1)                                                                                             \
-           || (HAL_USART1_ENABLE == 1)                                                                                             \
-           || (HAL_USART0_ENABLE == 1)) */
-
-    // Put the SPI flash into Deep Power Down mode for those radio boards where it is available
-    MX25_init();
-    MX25_DP();
-    // We must disable SPI communication
-    MX25_deinit();
-}
-
-void initVcomEnable(void)
-{
-#if defined(HAL_VCOM_ENABLE)
-    // Enable VCOM if requested
-    GPIO_PinModeSet(BSP_VCOM_ENABLE_PORT, BSP_VCOM_ENABLE_PIN, gpioModePushPull, HAL_VCOM_ENABLE);
-#endif // HAL_VCOM_ENABLE
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4163A/init_mcu.c b/examples/platform/efr32/efr32mg12/BRD4163A/init_mcu.c
deleted file mode 100644 (file)
index d9982bc..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "em_rtcc.h"
-
-#include "FreeRTOSConfig.h"
-#include "bsp.h"
-#include "init_mcu.h"
-
-// Bit [19] in MODULEINFO is the HFXOCALVAL:
-// 1=No factory cal, use default XO tunning value in FW
-// 0=Factory Cal, use XO tunning value in DI
-#define DEVINFO_MODULEINFO_HFXOCALVAL_MASK 0x00080000UL
-// Calibration value for HFXO CTUNE is at DEVINFO Offset 0x08
-#define DEVINFO_MODULEINFO_CRYSTALOSCCALVAL (*((uint16_t *) (uint32_t)(DEVINFO_BASE + 0x8UL)))
-// [15:9] : (LFXOTUNING) Calibration for LFXO TUNING
-// [8:0]  : (HFXOCTUNE) Calibration for HFXO CTUNE
-#define DEVINFO_HFXOCTUNE_MASK 0x01FFUL
-
-#define set_HFXO_CTUNE(val)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        hfxoInit.ctuneSteadyState = (val);                                                                                         \
-    } while (0)
-
-static void initMcu_clocks(void);
-static void initHFXO(void);
-
-void initMcu(void)
-{
-    // ISR safe FreeRTOS API functions must *only* be called
-    // from interrupts that have been assigned a priority at or below
-    // configMAX_SYSCALL_INTERRUPT_PRIORITY.
-    // Here we init all IRQ prio to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
-    // to make sure no IRQ use default priority of zero as that is the highest possible priority
-    for (IRQn_Type i = 0; i < EXT_IRQ_COUNT; i++)
-    {
-        NVIC_SetPriority(i, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
-    }
-    // Device errata
-    CHIP_Init();
-
-    // Set up DC-DC converter
-    EMU_DCDCInit_TypeDef dcdcInit = BSP_DCDC_INIT;
-#if HAL_DCDC_BYPASS
-    dcdcInit.dcdcMode = emuDcdcMode_Bypass;
-#endif
-    EMU_DCDCInit(&dcdcInit);
-
-    // Set up clocks
-    initMcu_clocks();
-
-    RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
-    rtccInit.enable            = true;
-    rtccInit.debugRun          = false;
-    rtccInit.precntWrapOnCCV0  = false;
-    rtccInit.cntWrapOnCCV1     = false;
-    rtccInit.prescMode         = rtccCntTickPresc;
-    rtccInit.presc             = rtccCntPresc_1;
-    rtccInit.enaOSCFailDetect  = false;
-    rtccInit.cntMode           = rtccCntModeNormal;
-    RTCC_Init(&rtccInit);
-
-#if defined(EMU_VSCALE_PRESENT)
-    // Set up EM0, EM1 energy mode configuration
-    EMU_EM01Init_TypeDef em01Init = EMU_EM01INIT_DEFAULT;
-    EMU_EM01Init(&em01Init);
-#endif // EMU_VSCALE_PRESENT
-    // Set up EM2, EM3 energy mode configuration
-    EMU_EM23Init_TypeDef em23init = EMU_EM23INIT_DEFAULT;
-#if defined(EMU_VSCALE_PRESENT)
-    em23init.vScaleEM23Voltage = emuVScaleEM23_LowPower;
-#endif // EMU_VSCALE_PRESENT
-    EMU_EM23Init(&em23init);
-
-#if defined(RMU_PRESENT)
-    // Set reset mode for sysreset back to DEFAULT (extended), this might have
-    // been changed by the bootloader to FULL reset.
-    RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_DEFAULT;
-#endif
-}
-
-static void initMcu_clocks(void)
-{
-    // Initialize HFXO
-    initHFXO();
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-
-    // Enable HFXO oscillator, and wait for it to be stable
-    CMU_OscillatorEnable(cmuOsc_HFXO, true, true);
-
-    // Enable HFXO Autostart only if EM2 voltage scaling is disabled.
-    // In 1.0 V mode the chip does not support frequencies > 21 MHz,
-    // this is why HFXO autostart is not supported in this case.
-#if !defined(_EMU_CTRL_EM23VSCALE_MASK)
-    // Automatically start and select HFXO
-    CMU_HFXOAutostartEnable(0, true, true);
-#else
-    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
-#endif //_EMU_CTRL_EM23VSCALE_MASK
-
-    // HFRCO not needed when using HFXO
-    CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
-
-    // Enabling HFBUSCLKLE clock for LE peripherals
-    CMU_ClockEnable(cmuClock_HFLE, true);
-
-    // Initialize LFXO
-    CMU_LFXOInit_TypeDef lfxoInit = BSP_CLK_LFXO_INIT;
-    lfxoInit.ctune                = BSP_CLK_LFXO_CTUNE;
-    CMU_LFXOInit(&lfxoInit);
-    // Set system LFXO frequency
-    SystemLFXOClockSet(BSP_CLK_LFXO_FREQ);
-
-    // Set LFXO if selected as LFCLK
-    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFXO);
-}
-
-static void initHFXO(void)
-{
-    // Initialize HFXO
-    // Use BSP_CLK_HFXO_INIT as last result (4th)
-    CMU_HFXOInit_TypeDef hfxoInit = BSP_CLK_HFXO_INIT;
-    // if Factory Cal exists in DEVINFO then use it above all (1st)
-    if (0 == (DEVINFO->MODULEINFO & DEVINFO_MODULEINFO_HFXOCALVAL_MASK))
-    {
-#if defined(_SILICON_LABS_32B_SERIES_1)
-        set_HFXO_CTUNE(DEVINFO_MODULEINFO_CRYSTALOSCCALVAL);
-#elif defined(_SILICON_LABS_32B_SERIES_2)
-        set_HFXO_CTUNE(DEVINFO->MODXOCAL & _DEVINFO_MODXOCAL_HFXOCTUNEXIANA_MASK);
-#endif
-    }
-    // if User page has CTUNE from studio use that in 2nd place
-#if (MFG_CTUNE_EN == 1)
-    else if (MFG_CTUNE_VAL != 0xFFFF)
-    {
-        set_HFXO_CTUNE(MFG_CTUNE_VAL);
-    }
-#endif
-    // 3rd option, get data from header defined for product/board
-#if defined(BSP_CLK_HFXO_CTUNE) && BSP_CLK_HFXO_CTUNE >= 0
-    else
-    {
-        set_HFXO_CTUNE(BSP_CLK_HFXO_CTUNE);
-    }
-#endif
-    CMU_HFXOInit(&hfxoInit);
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4164A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4164A/init_board.c
deleted file mode 100644 (file)
index 75f7074..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-#include "em_cmu.h"
-
-#include "em_cmu.h"
-
-#include "em_usart.h"
-#include "mx25flash_spi.h"
-
-#include "bsp.h"
-
-void initBoard(void)
-{
-
-    // Enable clock for CRYOTIMER
-    CMU_ClockEnable(cmuClock_CRYOTIMER, true);
-#if ((HAL_VCOM_ENABLE == 1) || (HAL_USART3_ENABLE == 1) || (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-#if defined(FEATURE_EXP_HEADER_USART3)
-    // Enable clock for USART3
-    CMU_ClockEnable(cmuClock_USART3, true);
-#elif defined(FEATURE_EXP_HEADER_USART1)
-    // Enable clock for USART1
-    CMU_ClockEnable(cmuClock_USART1, true);
-#else
-    // Enable clock for USART0
-    CMU_ClockEnable(cmuClock_USART0, true);
-#endif
-#endif //(HAL_VCOM_ENABLE == 1)
-#if ((HAL_I2CSENSOR_ENABLE == 1) || (HAL_VCOM_ENABLE == 1) || (HAL_SPIDISPLAY_ENABLE == 1) || (HAL_USART3_ENABLE == 1) ||          \
-     (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-    // Enable clock for PRS
-    CMU_ClockEnable(cmuClock_PRS, true);
-    // Enable GPIO clock source
-    CMU_ClockEnable(cmuClock_GPIO, true);
-#endif /* ((HAL_I2CSENSOR_ENABLE == 1)                                                                                             \
-           || (HAL_VCOM_ENABLE == 1)                                                                                               \
-           || (HAL_SPIDISPLAY_ENABLE == 1)                                                                                         \
-           || (HAL_USART3_ENABLE == 1)                                                                                             \
-           || (HAL_USART1_ENABLE == 1)                                                                                             \
-           || (HAL_USART0_ENABLE == 1)) */
-
-    // Put the SPI flash into Deep Power Down mode for those radio boards where it is available
-    MX25_init();
-    MX25_DP();
-    // We must disable SPI communication
-    MX25_deinit();
-}
-
-void initVcomEnable(void)
-{
-#if defined(HAL_VCOM_ENABLE)
-    // Enable VCOM if requested
-    GPIO_PinModeSet(BSP_VCOM_ENABLE_PORT, BSP_VCOM_ENABLE_PIN, gpioModePushPull, HAL_VCOM_ENABLE);
-#endif // HAL_VCOM_ENABLE
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4164A/init_mcu.c b/examples/platform/efr32/efr32mg12/BRD4164A/init_mcu.c
deleted file mode 100644 (file)
index eabd216..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "em_rtcc.h"
-
-#include "FreeRTOSConfig.h"
-#include "bsp.h"
-#include "init_mcu.h"
-
-// Bit [19] in MODULEINFO is the HFXOCALVAL:
-// 1=No factory cal, use default XO tunning value in FW
-// 0=Factory Cal, use XO tunning value in DI
-#define DEVINFO_MODULEINFO_HFXOCALVAL_MASK 0x00080000UL
-// Calibration value for HFXO CTUNE is at DEVINFO Offset 0x08
-#define DEVINFO_MODULEINFO_CRYSTALOSCCALVAL (*((uint16_t *) (uint32_t)(DEVINFO_BASE + 0x8UL)))
-// [15:9] : (LFXOTUNING) Calibration for LFXO TUNING
-// [8:0]  : (HFXOCTUNE) Calibration for HFXO CTUNE
-#define DEVINFO_HFXOCTUNE_MASK 0x01FFUL
-
-#define set_HFXO_CTUNE(val)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        hfxoInit.ctuneSteadyState = (val);                                                                                         \
-    } while (0)
-
-static void initMcu_clocks(void);
-static void initHFXO(void);
-
-void initMcu(void)
-{
-    // ISR safe FreeRTOS API functions must *only* be called
-    // from interrupts that have been assigned a priority at or below
-    // configMAX_SYSCALL_INTERRUPT_PRIORITY.
-    // Here we init all IRQ prio to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
-    // to make sure no IRQ use default priority of zero as that is the highest possible priority
-    for (IRQn_Type i = 0; i < EXT_IRQ_COUNT; i++)
-    {
-        NVIC_SetPriority(i, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
-    }
-
-    // Device errata
-    CHIP_Init();
-
-    // Set up DC-DC converter
-    EMU_DCDCInit_TypeDef dcdcInit = BSP_DCDC_INIT;
-#if HAL_DCDC_BYPASS
-    dcdcInit.dcdcMode = emuDcdcMode_Bypass;
-#endif
-    EMU_DCDCInit(&dcdcInit);
-
-    // Set up clocks
-    initMcu_clocks();
-
-    RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
-    rtccInit.enable            = true;
-    rtccInit.debugRun          = false;
-    rtccInit.precntWrapOnCCV0  = false;
-    rtccInit.cntWrapOnCCV1     = false;
-    rtccInit.prescMode         = rtccCntTickPresc;
-    rtccInit.presc             = rtccCntPresc_1;
-    rtccInit.enaOSCFailDetect  = false;
-    rtccInit.cntMode           = rtccCntModeNormal;
-    RTCC_Init(&rtccInit);
-
-#if defined(EMU_VSCALE_PRESENT)
-    // Set up EM0, EM1 energy mode configuration
-    EMU_EM01Init_TypeDef em01Init = EMU_EM01INIT_DEFAULT;
-    EMU_EM01Init(&em01Init);
-#endif // EMU_VSCALE_PRESENT
-    // Set up EM2, EM3 energy mode configuration
-    EMU_EM23Init_TypeDef em23init = EMU_EM23INIT_DEFAULT;
-#if defined(EMU_VSCALE_PRESENT)
-    em23init.vScaleEM23Voltage = emuVScaleEM23_LowPower;
-#endif // EMU_VSCALE_PRESENT
-    EMU_EM23Init(&em23init);
-
-#if defined(RMU_PRESENT)
-    // Set reset mode for sysreset back to DEFAULT (extended), this might have
-    // been changed by the bootloader to FULL reset.
-    RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_DEFAULT;
-#endif
-}
-
-static void initMcu_clocks(void)
-{
-    // Initialize HFXO
-    initHFXO();
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-
-    // Enable HFXO oscillator, and wait for it to be stable
-    CMU_OscillatorEnable(cmuOsc_HFXO, true, true);
-
-    // Enable HFXO Autostart only if EM2 voltage scaling is disabled.
-    // In 1.0 V mode the chip does not support frequencies > 21 MHz,
-    // this is why HFXO autostart is not supported in this case.
-#if !defined(_EMU_CTRL_EM23VSCALE_MASK)
-    // Automatically start and select HFXO
-    CMU_HFXOAutostartEnable(0, true, true);
-#else
-    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
-#endif //_EMU_CTRL_EM23VSCALE_MASK
-
-    // HFRCO not needed when using HFXO
-    CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
-
-    // Enabling HFBUSCLKLE clock for LE peripherals
-    CMU_ClockEnable(cmuClock_HFLE, true);
-
-    // Initialize LFXO
-    CMU_LFXOInit_TypeDef lfxoInit = BSP_CLK_LFXO_INIT;
-    lfxoInit.ctune                = BSP_CLK_LFXO_CTUNE;
-    CMU_LFXOInit(&lfxoInit);
-    // Set system LFXO frequency
-    SystemLFXOClockSet(BSP_CLK_LFXO_FREQ);
-
-    // Set LFXO if selected as LFCLK
-    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFXO);
-}
-
-static void initHFXO(void)
-{
-    // Initialize HFXO
-    // Use BSP_CLK_HFXO_INIT as last result (4th)
-    CMU_HFXOInit_TypeDef hfxoInit = BSP_CLK_HFXO_INIT;
-    // if Factory Cal exists in DEVINFO then use it above all (1st)
-    if (0 == (DEVINFO->MODULEINFO & DEVINFO_MODULEINFO_HFXOCALVAL_MASK))
-    {
-#if defined(_SILICON_LABS_32B_SERIES_1)
-        set_HFXO_CTUNE(DEVINFO_MODULEINFO_CRYSTALOSCCALVAL);
-#elif defined(_SILICON_LABS_32B_SERIES_2)
-        set_HFXO_CTUNE(DEVINFO->MODXOCAL & _DEVINFO_MODXOCAL_HFXOCTUNEXIANA_MASK);
-#endif
-    }
-    // if User page has CTUNE from studio use that in 2nd place
-#if (MFG_CTUNE_EN == 1)
-    else if (MFG_CTUNE_VAL != 0xFFFF)
-    {
-        set_HFXO_CTUNE(MFG_CTUNE_VAL);
-    }
-#endif
-    // 3rd option, get data from header defined for product/board
-#if defined(BSP_CLK_HFXO_CTUNE) && BSP_CLK_HFXO_CTUNE >= 0
-    else
-    {
-        set_HFXO_CTUNE(BSP_CLK_HFXO_CTUNE);
-    }
-#endif
-    CMU_HFXOInit(&hfxoInit);
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4166A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4166A/init_board.c
deleted file mode 100644 (file)
index 4a74535..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-#include "em_cmu.h"
-
-#include "em_cmu.h"
-
-#include "em_usart.h"
-#include "mx25flash_spi.h"
-
-#include "bsp.h"
-
-void initBoard(void)
-{
-
-    // Enable clock for CRYOTIMER
-    CMU_ClockEnable(cmuClock_CRYOTIMER, true);
-#if ((HAL_VCOM_ENABLE == 1) || (HAL_USART3_ENABLE == 1) || (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-#if defined(FEATURE_EXP_HEADER_USART3)
-    // Enable clock for USART3
-    CMU_ClockEnable(cmuClock_USART3, true);
-#elif defined(FEATURE_EXP_HEADER_USART1)
-    // Enable clock for USART1
-    CMU_ClockEnable(cmuClock_USART1, true);
-#else
-    // Enable clock for USART0
-    CMU_ClockEnable(cmuClock_USART0, true);
-#endif
-#endif //(HAL_VCOM_ENABLE == 1)
-#if ((HAL_I2CSENSOR_ENABLE == 1) || (HAL_VCOM_ENABLE == 1) || (HAL_SPIDISPLAY_ENABLE == 1) || (HAL_USART3_ENABLE == 1) ||          \
-     (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-    // Enable clock for PRS
-    CMU_ClockEnable(cmuClock_PRS, true);
-    // Enable GPIO clock source
-    CMU_ClockEnable(cmuClock_GPIO, true);
-#endif /* ((HAL_I2CSENSOR_ENABLE == 1)                                                                                             \
-           || (HAL_VCOM_ENABLE == 1)                                                                                               \
-           || (HAL_SPIDISPLAY_ENABLE == 1)                                                                                         \
-           || (HAL_USART3_ENABLE == 1)                                                                                             \
-           || (HAL_USART1_ENABLE == 1)                                                                                             \
-           || (HAL_USART0_ENABLE == 1)) */
-
-    // Put the SPI flash into Deep Power Down mode for those radio boards where it
-    // is available
-    MX25_init();
-    MX25_DP();
-    // We must disable SPI communication
-    MX25_deinit();
-}
-
-void initVcomEnable(void)
-{
-#if (HAL_VCOM_ENABLE == 1)
-    // Enable VCOM if requested
-    GPIO_PinModeSet(BSP_VCOM_ENABLE_PORT, BSP_VCOM_ENABLE_PIN, gpioModePushPull, HAL_VCOM_ENABLE);
-#endif // HAL_VCOM_ENABLE
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4166A/init_mcu.c b/examples/platform/efr32/efr32mg12/BRD4166A/init_mcu.c
deleted file mode 100644 (file)
index a5343fb..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "em_rtcc.h"
-
-#include "bsp.h"
-
-#include "FreeRTOSConfig.h"
-#include "init_mcu.h"
-
-// Bit [19] in MODULEINFO is the HFXOCALVAL:
-// 1=No factory cal, use default XO tunning value in FW
-// 0=Factory Cal, use XO tunning value in DI
-#define DEVINFO_MODULEINFO_HFXOCALVAL_MASK 0x00080000UL
-// Calibration value for HFXO CTUNE is at DEVINFO Offset 0x08
-#define DEVINFO_MODULEINFO_CRYSTALOSCCALVAL (*((uint16_t *) (uint32_t)(DEVINFO_BASE + 0x8UL)))
-// [15:9] : (LFXOTUNING) Calibration for LFXO TUNING
-// [8:0]  : (HFXOCTUNE) Calibration for HFXO CTUNE
-#define DEVINFO_HFXOCTUNE_MASK 0x01FFUL
-
-#define set_HFXO_CTUNE(val)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        hfxoInit.ctuneSteadyState = (val);                                                                                         \
-    } while (0)
-
-static void initMcu_clocks(void);
-static void initHFXO(void);
-
-void initMcu(void)
-{
-    // ISR safe FreeRTOS API functions must *only* be called
-    // from interrupts that have been assigned a priority at or below
-    // configMAX_SYSCALL_INTERRUPT_PRIORITY.
-    // Here we init all IRQ prio to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
-    // to make sure no IRQ use default priority of zero as that is the highest possible priority
-    for (IRQn_Type i = 0; i < EXT_IRQ_COUNT; i++)
-    {
-        NVIC_SetPriority(i, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
-    }
-
-    // Device errata
-    CHIP_Init();
-
-    // Set up DC-DC converter
-    EMU_DCDCInit_TypeDef dcdcInit = BSP_DCDC_INIT;
-#if HAL_DCDC_BYPASS
-    dcdcInit.dcdcMode = emuDcdcMode_Bypass;
-#endif
-    EMU_DCDCInit(&dcdcInit);
-
-    // Set up clocks
-    initMcu_clocks();
-
-    RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
-    rtccInit.enable            = true;
-    rtccInit.debugRun          = false;
-    rtccInit.precntWrapOnCCV0  = false;
-    rtccInit.cntWrapOnCCV1     = false;
-    rtccInit.prescMode         = rtccCntTickPresc;
-    rtccInit.presc             = rtccCntPresc_1;
-    rtccInit.enaOSCFailDetect  = false;
-    rtccInit.cntMode           = rtccCntModeNormal;
-    RTCC_Init(&rtccInit);
-
-#if defined(EMU_VSCALE_PRESENT)
-    // Set up EM0, EM1 energy mode configuration
-    EMU_EM01Init_TypeDef em01Init = EMU_EM01INIT_DEFAULT;
-    EMU_EM01Init(&em01Init);
-#endif // EMU_VSCALE_PRESENT
-    // Set up EM2, EM3 energy mode configuration
-    EMU_EM23Init_TypeDef em23init = EMU_EM23INIT_DEFAULT;
-#if defined(EMU_VSCALE_PRESENT)
-    em23init.vScaleEM23Voltage = emuVScaleEM23_LowPower;
-#endif // EMU_VSCALE_PRESENT
-    EMU_EM23Init(&em23init);
-
-#if defined(RMU_PRESENT)
-    // Set reset mode for sysreset back to DEFAULT (extended), this might have
-    // been changed by the bootloader to FULL reset.
-    RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_DEFAULT;
-#endif
-}
-
-static void initMcu_clocks(void)
-{
-    // Initialize HFXO
-    initHFXO();
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-
-    // Enable HFXO oscillator, and wait for it to be stable
-    CMU_OscillatorEnable(cmuOsc_HFXO, true, true);
-
-    // Enable HFXO Autostart only if EM2 voltage scaling is disabled.
-    // In 1.0 V mode the chip does not support frequencies > 21 MHz,
-    // this is why HFXO autostart is not supported in this case.
-#if !defined(_EMU_CTRL_EM23VSCALE_MASK)
-    // Automatically start and select HFXO
-    CMU_HFXOAutostartEnable(0, true, true);
-#else
-    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
-#endif //_EMU_CTRL_EM23VSCALE_MASK
-
-    // HFRCO not needed when using HFXO
-    CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
-
-    // Enabling HFBUSCLKLE clock for LE peripherals
-    CMU_ClockEnable(cmuClock_HFLE, true);
-
-    // Initialize LFXO
-    CMU_LFXOInit_TypeDef lfxoInit = BSP_CLK_LFXO_INIT;
-    lfxoInit.ctune                = BSP_CLK_LFXO_CTUNE;
-    CMU_LFXOInit(&lfxoInit);
-    // Set system LFXO frequency
-    SystemLFXOClockSet(BSP_CLK_LFXO_FREQ);
-
-    // Set LFXO if selected as LFCLK
-    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFXO);
-    CMU_ClockEnable(cmuClock_GPIO, true);
-}
-
-static void initHFXO(void)
-{
-    // Initialize HFXO
-    // Use BSP_CLK_HFXO_INIT as last result (4th)
-    CMU_HFXOInit_TypeDef hfxoInit = BSP_CLK_HFXO_INIT;
-    // if Factory Cal exists in DEVINFO then use it above all (1st)
-    if (0 == (DEVINFO->MODULEINFO & DEVINFO_MODULEINFO_HFXOCALVAL_MASK))
-    {
-#if defined(_SILICON_LABS_32B_SERIES_1)
-        set_HFXO_CTUNE(DEVINFO_MODULEINFO_CRYSTALOSCCALVAL);
-#elif defined(_SILICON_LABS_32B_SERIES_2)
-        set_HFXO_CTUNE(DEVINFO->MODXOCAL & _DEVINFO_MODXOCAL_HFXOCTUNEXIANA_MASK);
-#endif
-    }
-    // if User page has CTUNE from studio use that in 2nd place
-#if (MFG_CTUNE_EN == 1)
-    else if (MFG_CTUNE_VAL != 0xFFFF)
-    {
-        set_HFXO_CTUNE(MFG_CTUNE_VAL);
-    }
-#endif
-    // 3rd option, get data from header defined for product/board
-#if defined(BSP_CLK_HFXO_CTUNE) && BSP_CLK_HFXO_CTUNE >= 0
-    else
-    {
-        set_HFXO_CTUNE(BSP_CLK_HFXO_CTUNE);
-    }
-#endif
-    CMU_HFXOInit(&hfxoInit);
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4170A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4170A/init_board.c
deleted file mode 100644 (file)
index 75f7074..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-#include "em_cmu.h"
-
-#include "em_cmu.h"
-
-#include "em_usart.h"
-#include "mx25flash_spi.h"
-
-#include "bsp.h"
-
-void initBoard(void)
-{
-
-    // Enable clock for CRYOTIMER
-    CMU_ClockEnable(cmuClock_CRYOTIMER, true);
-#if ((HAL_VCOM_ENABLE == 1) || (HAL_USART3_ENABLE == 1) || (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-#if defined(FEATURE_EXP_HEADER_USART3)
-    // Enable clock for USART3
-    CMU_ClockEnable(cmuClock_USART3, true);
-#elif defined(FEATURE_EXP_HEADER_USART1)
-    // Enable clock for USART1
-    CMU_ClockEnable(cmuClock_USART1, true);
-#else
-    // Enable clock for USART0
-    CMU_ClockEnable(cmuClock_USART0, true);
-#endif
-#endif //(HAL_VCOM_ENABLE == 1)
-#if ((HAL_I2CSENSOR_ENABLE == 1) || (HAL_VCOM_ENABLE == 1) || (HAL_SPIDISPLAY_ENABLE == 1) || (HAL_USART3_ENABLE == 1) ||          \
-     (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-    // Enable clock for PRS
-    CMU_ClockEnable(cmuClock_PRS, true);
-    // Enable GPIO clock source
-    CMU_ClockEnable(cmuClock_GPIO, true);
-#endif /* ((HAL_I2CSENSOR_ENABLE == 1)                                                                                             \
-           || (HAL_VCOM_ENABLE == 1)                                                                                               \
-           || (HAL_SPIDISPLAY_ENABLE == 1)                                                                                         \
-           || (HAL_USART3_ENABLE == 1)                                                                                             \
-           || (HAL_USART1_ENABLE == 1)                                                                                             \
-           || (HAL_USART0_ENABLE == 1)) */
-
-    // Put the SPI flash into Deep Power Down mode for those radio boards where it is available
-    MX25_init();
-    MX25_DP();
-    // We must disable SPI communication
-    MX25_deinit();
-}
-
-void initVcomEnable(void)
-{
-#if defined(HAL_VCOM_ENABLE)
-    // Enable VCOM if requested
-    GPIO_PinModeSet(BSP_VCOM_ENABLE_PORT, BSP_VCOM_ENABLE_PIN, gpioModePushPull, HAL_VCOM_ENABLE);
-#endif // HAL_VCOM_ENABLE
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4170A/init_mcu.c b/examples/platform/efr32/efr32mg12/BRD4170A/init_mcu.c
deleted file mode 100644 (file)
index eabd216..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "em_rtcc.h"
-
-#include "FreeRTOSConfig.h"
-#include "bsp.h"
-#include "init_mcu.h"
-
-// Bit [19] in MODULEINFO is the HFXOCALVAL:
-// 1=No factory cal, use default XO tunning value in FW
-// 0=Factory Cal, use XO tunning value in DI
-#define DEVINFO_MODULEINFO_HFXOCALVAL_MASK 0x00080000UL
-// Calibration value for HFXO CTUNE is at DEVINFO Offset 0x08
-#define DEVINFO_MODULEINFO_CRYSTALOSCCALVAL (*((uint16_t *) (uint32_t)(DEVINFO_BASE + 0x8UL)))
-// [15:9] : (LFXOTUNING) Calibration for LFXO TUNING
-// [8:0]  : (HFXOCTUNE) Calibration for HFXO CTUNE
-#define DEVINFO_HFXOCTUNE_MASK 0x01FFUL
-
-#define set_HFXO_CTUNE(val)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        hfxoInit.ctuneSteadyState = (val);                                                                                         \
-    } while (0)
-
-static void initMcu_clocks(void);
-static void initHFXO(void);
-
-void initMcu(void)
-{
-    // ISR safe FreeRTOS API functions must *only* be called
-    // from interrupts that have been assigned a priority at or below
-    // configMAX_SYSCALL_INTERRUPT_PRIORITY.
-    // Here we init all IRQ prio to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
-    // to make sure no IRQ use default priority of zero as that is the highest possible priority
-    for (IRQn_Type i = 0; i < EXT_IRQ_COUNT; i++)
-    {
-        NVIC_SetPriority(i, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
-    }
-
-    // Device errata
-    CHIP_Init();
-
-    // Set up DC-DC converter
-    EMU_DCDCInit_TypeDef dcdcInit = BSP_DCDC_INIT;
-#if HAL_DCDC_BYPASS
-    dcdcInit.dcdcMode = emuDcdcMode_Bypass;
-#endif
-    EMU_DCDCInit(&dcdcInit);
-
-    // Set up clocks
-    initMcu_clocks();
-
-    RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
-    rtccInit.enable            = true;
-    rtccInit.debugRun          = false;
-    rtccInit.precntWrapOnCCV0  = false;
-    rtccInit.cntWrapOnCCV1     = false;
-    rtccInit.prescMode         = rtccCntTickPresc;
-    rtccInit.presc             = rtccCntPresc_1;
-    rtccInit.enaOSCFailDetect  = false;
-    rtccInit.cntMode           = rtccCntModeNormal;
-    RTCC_Init(&rtccInit);
-
-#if defined(EMU_VSCALE_PRESENT)
-    // Set up EM0, EM1 energy mode configuration
-    EMU_EM01Init_TypeDef em01Init = EMU_EM01INIT_DEFAULT;
-    EMU_EM01Init(&em01Init);
-#endif // EMU_VSCALE_PRESENT
-    // Set up EM2, EM3 energy mode configuration
-    EMU_EM23Init_TypeDef em23init = EMU_EM23INIT_DEFAULT;
-#if defined(EMU_VSCALE_PRESENT)
-    em23init.vScaleEM23Voltage = emuVScaleEM23_LowPower;
-#endif // EMU_VSCALE_PRESENT
-    EMU_EM23Init(&em23init);
-
-#if defined(RMU_PRESENT)
-    // Set reset mode for sysreset back to DEFAULT (extended), this might have
-    // been changed by the bootloader to FULL reset.
-    RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_DEFAULT;
-#endif
-}
-
-static void initMcu_clocks(void)
-{
-    // Initialize HFXO
-    initHFXO();
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-
-    // Enable HFXO oscillator, and wait for it to be stable
-    CMU_OscillatorEnable(cmuOsc_HFXO, true, true);
-
-    // Enable HFXO Autostart only if EM2 voltage scaling is disabled.
-    // In 1.0 V mode the chip does not support frequencies > 21 MHz,
-    // this is why HFXO autostart is not supported in this case.
-#if !defined(_EMU_CTRL_EM23VSCALE_MASK)
-    // Automatically start and select HFXO
-    CMU_HFXOAutostartEnable(0, true, true);
-#else
-    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
-#endif //_EMU_CTRL_EM23VSCALE_MASK
-
-    // HFRCO not needed when using HFXO
-    CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
-
-    // Enabling HFBUSCLKLE clock for LE peripherals
-    CMU_ClockEnable(cmuClock_HFLE, true);
-
-    // Initialize LFXO
-    CMU_LFXOInit_TypeDef lfxoInit = BSP_CLK_LFXO_INIT;
-    lfxoInit.ctune                = BSP_CLK_LFXO_CTUNE;
-    CMU_LFXOInit(&lfxoInit);
-    // Set system LFXO frequency
-    SystemLFXOClockSet(BSP_CLK_LFXO_FREQ);
-
-    // Set LFXO if selected as LFCLK
-    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFXO);
-}
-
-static void initHFXO(void)
-{
-    // Initialize HFXO
-    // Use BSP_CLK_HFXO_INIT as last result (4th)
-    CMU_HFXOInit_TypeDef hfxoInit = BSP_CLK_HFXO_INIT;
-    // if Factory Cal exists in DEVINFO then use it above all (1st)
-    if (0 == (DEVINFO->MODULEINFO & DEVINFO_MODULEINFO_HFXOCALVAL_MASK))
-    {
-#if defined(_SILICON_LABS_32B_SERIES_1)
-        set_HFXO_CTUNE(DEVINFO_MODULEINFO_CRYSTALOSCCALVAL);
-#elif defined(_SILICON_LABS_32B_SERIES_2)
-        set_HFXO_CTUNE(DEVINFO->MODXOCAL & _DEVINFO_MODXOCAL_HFXOCTUNEXIANA_MASK);
-#endif
-    }
-    // if User page has CTUNE from studio use that in 2nd place
-#if (MFG_CTUNE_EN == 1)
-    else if (MFG_CTUNE_VAL != 0xFFFF)
-    {
-        set_HFXO_CTUNE(MFG_CTUNE_VAL);
-    }
-#endif
-    // 3rd option, get data from header defined for product/board
-#if defined(BSP_CLK_HFXO_CTUNE) && BSP_CLK_HFXO_CTUNE >= 0
-    else
-    {
-        set_HFXO_CTUNE(BSP_CLK_HFXO_CTUNE);
-    }
-#endif
-    CMU_HFXOInit(&hfxoInit);
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4304A/init_board.c b/examples/platform/efr32/efr32mg12/BRD4304A/init_board.c
deleted file mode 100644 (file)
index e57a373..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-#include "em_cmu.h"
-
-#include "em_cmu.h"
-
-#include "em_usart.h"
-#include "mx25flash_spi.h"
-
-#include "fem-control.h"
-
-#include "bsp.h"
-
-void initBoard(void)
-{
-
-    // Enable clock for CRYOTIMER
-    CMU_ClockEnable(cmuClock_CRYOTIMER, true);
-#if ((HAL_VCOM_ENABLE == 1) || (HAL_USART3_ENABLE == 1) || (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-#if defined(FEATURE_EXP_HEADER_USART3)
-    // Enable clock for USART3
-    CMU_ClockEnable(cmuClock_USART3, true);
-#elif defined(FEATURE_EXP_HEADER_USART1)
-    // Enable clock for USART1
-    CMU_ClockEnable(cmuClock_USART1, true);
-#else
-    // Enable clock for USART0
-    CMU_ClockEnable(cmuClock_USART0, true);
-#endif
-#endif //(HAL_VCOM_ENABLE == 1)
-#if ((HAL_I2CSENSOR_ENABLE == 1) || (HAL_VCOM_ENABLE == 1) || (HAL_SPIDISPLAY_ENABLE == 1) || (HAL_USART3_ENABLE == 1) ||          \
-     (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-    // Enable clock for PRS
-    CMU_ClockEnable(cmuClock_PRS, true);
-    // Enable GPIO clock source
-    CMU_ClockEnable(cmuClock_GPIO, true);
-#endif /* ((HAL_I2CSENSOR_ENABLE == 1)                                                                                             \
-           || (HAL_VCOM_ENABLE == 1)                                                                                               \
-           || (HAL_SPIDISPLAY_ENABLE == 1)                                                                                         \
-           || (HAL_USART3_ENABLE == 1)                                                                                             \
-           || (HAL_USART1_ENABLE == 1)                                                                                             \
-           || (HAL_USART0_ENABLE == 1)) */
-
-    // Put the SPI flash into Deep Power Down mode for those radio boards where it is available
-    MX25_init();
-    MX25_DP();
-    // We must disable SPI communication
-    MX25_deinit();
-
-    // Initialize FEM
-    // initFem();
-}
-
-void initVcomEnable(void)
-{
-#if defined(HAL_VCOM_ENABLE)
-    // Enable VCOM if requested
-    GPIO_PinModeSet(BSP_VCOM_ENABLE_PORT, BSP_VCOM_ENABLE_PIN, gpioModePushPull, HAL_VCOM_ENABLE);
-#endif // HAL_VCOM_ENABLE
-}
diff --git a/examples/platform/efr32/efr32mg12/BRD4304A/init_mcu.c b/examples/platform/efr32/efr32mg12/BRD4304A/init_mcu.c
deleted file mode 100644 (file)
index eabd216..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "em_rtcc.h"
-
-#include "FreeRTOSConfig.h"
-#include "bsp.h"
-#include "init_mcu.h"
-
-// Bit [19] in MODULEINFO is the HFXOCALVAL:
-// 1=No factory cal, use default XO tunning value in FW
-// 0=Factory Cal, use XO tunning value in DI
-#define DEVINFO_MODULEINFO_HFXOCALVAL_MASK 0x00080000UL
-// Calibration value for HFXO CTUNE is at DEVINFO Offset 0x08
-#define DEVINFO_MODULEINFO_CRYSTALOSCCALVAL (*((uint16_t *) (uint32_t)(DEVINFO_BASE + 0x8UL)))
-// [15:9] : (LFXOTUNING) Calibration for LFXO TUNING
-// [8:0]  : (HFXOCTUNE) Calibration for HFXO CTUNE
-#define DEVINFO_HFXOCTUNE_MASK 0x01FFUL
-
-#define set_HFXO_CTUNE(val)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        hfxoInit.ctuneSteadyState = (val);                                                                                         \
-    } while (0)
-
-static void initMcu_clocks(void);
-static void initHFXO(void);
-
-void initMcu(void)
-{
-    // ISR safe FreeRTOS API functions must *only* be called
-    // from interrupts that have been assigned a priority at or below
-    // configMAX_SYSCALL_INTERRUPT_PRIORITY.
-    // Here we init all IRQ prio to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
-    // to make sure no IRQ use default priority of zero as that is the highest possible priority
-    for (IRQn_Type i = 0; i < EXT_IRQ_COUNT; i++)
-    {
-        NVIC_SetPriority(i, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
-    }
-
-    // Device errata
-    CHIP_Init();
-
-    // Set up DC-DC converter
-    EMU_DCDCInit_TypeDef dcdcInit = BSP_DCDC_INIT;
-#if HAL_DCDC_BYPASS
-    dcdcInit.dcdcMode = emuDcdcMode_Bypass;
-#endif
-    EMU_DCDCInit(&dcdcInit);
-
-    // Set up clocks
-    initMcu_clocks();
-
-    RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
-    rtccInit.enable            = true;
-    rtccInit.debugRun          = false;
-    rtccInit.precntWrapOnCCV0  = false;
-    rtccInit.cntWrapOnCCV1     = false;
-    rtccInit.prescMode         = rtccCntTickPresc;
-    rtccInit.presc             = rtccCntPresc_1;
-    rtccInit.enaOSCFailDetect  = false;
-    rtccInit.cntMode           = rtccCntModeNormal;
-    RTCC_Init(&rtccInit);
-
-#if defined(EMU_VSCALE_PRESENT)
-    // Set up EM0, EM1 energy mode configuration
-    EMU_EM01Init_TypeDef em01Init = EMU_EM01INIT_DEFAULT;
-    EMU_EM01Init(&em01Init);
-#endif // EMU_VSCALE_PRESENT
-    // Set up EM2, EM3 energy mode configuration
-    EMU_EM23Init_TypeDef em23init = EMU_EM23INIT_DEFAULT;
-#if defined(EMU_VSCALE_PRESENT)
-    em23init.vScaleEM23Voltage = emuVScaleEM23_LowPower;
-#endif // EMU_VSCALE_PRESENT
-    EMU_EM23Init(&em23init);
-
-#if defined(RMU_PRESENT)
-    // Set reset mode for sysreset back to DEFAULT (extended), this might have
-    // been changed by the bootloader to FULL reset.
-    RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_DEFAULT;
-#endif
-}
-
-static void initMcu_clocks(void)
-{
-    // Initialize HFXO
-    initHFXO();
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-
-    // Enable HFXO oscillator, and wait for it to be stable
-    CMU_OscillatorEnable(cmuOsc_HFXO, true, true);
-
-    // Enable HFXO Autostart only if EM2 voltage scaling is disabled.
-    // In 1.0 V mode the chip does not support frequencies > 21 MHz,
-    // this is why HFXO autostart is not supported in this case.
-#if !defined(_EMU_CTRL_EM23VSCALE_MASK)
-    // Automatically start and select HFXO
-    CMU_HFXOAutostartEnable(0, true, true);
-#else
-    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
-#endif //_EMU_CTRL_EM23VSCALE_MASK
-
-    // HFRCO not needed when using HFXO
-    CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
-
-    // Enabling HFBUSCLKLE clock for LE peripherals
-    CMU_ClockEnable(cmuClock_HFLE, true);
-
-    // Initialize LFXO
-    CMU_LFXOInit_TypeDef lfxoInit = BSP_CLK_LFXO_INIT;
-    lfxoInit.ctune                = BSP_CLK_LFXO_CTUNE;
-    CMU_LFXOInit(&lfxoInit);
-    // Set system LFXO frequency
-    SystemLFXOClockSet(BSP_CLK_LFXO_FREQ);
-
-    // Set LFXO if selected as LFCLK
-    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFXO);
-}
-
-static void initHFXO(void)
-{
-    // Initialize HFXO
-    // Use BSP_CLK_HFXO_INIT as last result (4th)
-    CMU_HFXOInit_TypeDef hfxoInit = BSP_CLK_HFXO_INIT;
-    // if Factory Cal exists in DEVINFO then use it above all (1st)
-    if (0 == (DEVINFO->MODULEINFO & DEVINFO_MODULEINFO_HFXOCALVAL_MASK))
-    {
-#if defined(_SILICON_LABS_32B_SERIES_1)
-        set_HFXO_CTUNE(DEVINFO_MODULEINFO_CRYSTALOSCCALVAL);
-#elif defined(_SILICON_LABS_32B_SERIES_2)
-        set_HFXO_CTUNE(DEVINFO->MODXOCAL & _DEVINFO_MODXOCAL_HFXOCTUNEXIANA_MASK);
-#endif
-    }
-    // if User page has CTUNE from studio use that in 2nd place
-#if (MFG_CTUNE_EN == 1)
-    else if (MFG_CTUNE_VAL != 0xFFFF)
-    {
-        set_HFXO_CTUNE(MFG_CTUNE_VAL);
-    }
-#endif
-    // 3rd option, get data from header defined for product/board
-#if defined(BSP_CLK_HFXO_CTUNE) && BSP_CLK_HFXO_CTUNE >= 0
-    else
-    {
-        set_HFXO_CTUNE(BSP_CLK_HFXO_CTUNE);
-    }
-#endif
-    CMU_HFXOInit(&hfxoInit);
-}
diff --git a/examples/platform/efr32/efr32mg21/BRD4180A/init_board.c b/examples/platform/efr32/efr32mg21/BRD4180A/init_board.c
deleted file mode 100644 (file)
index 0d05740..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-#include "em_cmu.h"
-
-#include "bsp.h"
-
-void initBoard(void)
-{
-
-    // Enable clock for BURTC
-    CMU_ClockEnable(cmuClock_BURTC, true);
-#if ((HAL_VCOM_ENABLE == 1) || (HAL_USART3_ENABLE == 1) || (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-#if defined(FEATURE_EXP_HEADER_USART3)
-    // Enable clock for USART3
-    CMU_ClockEnable(cmuClock_USART3, true);
-#elif defined(FEATURE_EXP_HEADER_USART1)
-    // Enable clock for USART1
-    CMU_ClockEnable(cmuClock_USART1, true);
-#else
-    // Enable clock for USART0
-    CMU_ClockEnable(cmuClock_USART0, true);
-#endif
-#endif //(HAL_VCOM_ENABLE == 1)
-#if ((HAL_I2CSENSOR_ENABLE == 1) || (HAL_VCOM_ENABLE == 1) || (HAL_SPIDISPLAY_ENABLE == 1) || (HAL_USART3_ENABLE == 1) ||          \
-     (HAL_USART1_ENABLE == 1) || (HAL_USART0_ENABLE == 1))
-    // Enable clock for PRS
-    CMU_ClockEnable(cmuClock_PRS, true);
-    // Enable GPIO clock source
-    CMU_ClockEnable(cmuClock_GPIO, true);
-#endif /* ((HAL_I2CSENSOR_ENABLE == 1)                                                                                             \
-           || (HAL_VCOM_ENABLE == 1)                                                                                               \
-           || (HAL_SPIDISPLAY_ENABLE == 1)                                                                                         \
-           || (HAL_USART3_ENABLE == 1)                                                                                             \
-           || (HAL_USART1_ENABLE == 1)                                                                                             \
-           || (HAL_USART0_ENABLE == 1)) */
-}
-
-void initVcomEnable(void)
-{
-
-// "WARNING: This radio board uses the same GPIO pin to enable the VCOM port, the LCD display and the temperature sensor! Enabling
-// any of these features might disrupt the serial pins of the EXP header!"
-#if defined(HAL_I2CSENSOR_ENABLE) || defined(HAL_SPIDISPLAY_ENABLE) || defined(HAL_VCOM_ENABLE)
-#if HAL_I2CSENSOR_ENABLE || HAL_SPIDISPLAY_ENABLE || HAL_VCOM_ENABLE
-#define COMMON_ENABLE 1
-#else
-#define COMMON_ENABLE 0
-#endif
-
-#if defined(BSP_I2CSENSOR_ENABLE_PORT)
-#define ENABLE_PORT BSP_I2CSENSOR_ENABLE_PORT
-#define ENABLE_PIN BSP_I2CSENSOR_ENABLE_PIN
-#elif defined(BSP_SPIDISPLAY_ENABLE_PORT)
-#define ENABLE_PORT BSP_SPIDISPLAY_ENABLE_PORT
-#define ENABLE_PIN BSP_SPIDISPLAY_ENABLE_PIN
-#else
-#define ENABLE_PORT BSP_VCOM_ENABLE_PORT
-#define ENABLE_PIN BSP_VCOM_ENABLE_PIN
-#endif
-
-    // Enable if requested
-    GPIO_PinModeSet(ENABLE_PORT, ENABLE_PIN, gpioModePushPull, COMMON_ENABLE);
-
-#endif
-}
diff --git a/examples/platform/efr32/efr32mg21/BRD4180A/init_mcu.c b/examples/platform/efr32/efr32mg21/BRD4180A/init_mcu.c
deleted file mode 100644 (file)
index c868244..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.c
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#if defined(HAL_CONFIG)
-#include "bsphalconfig.h"
-#include "hal-config.h"
-#else
-#include "bspconfig.h"
-#endif
-
-#include "board_features.h"
-
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "em_rtcc.h"
-
-#include "FreeRTOSConfig.h"
-#include "bsp.h"
-#include "init_mcu.h"
-
-// Bit [19] in MODULEINFO is the HFXOCALVAL:
-// 1=No factory cal, use default XO tunning value in FW
-// 0=Factory Cal, use XO tunning value in DI
-#define DEVINFO_MODULEINFO_HFXOCALVAL_MASK 0x00080000UL
-// Calibration value for HFXO CTUNE is at DEVINFO Offset 0x08
-#define DEVINFO_MODULEINFO_CRYSTALOSCCALVAL (*((uint16_t *) (uint32_t)(DEVINFO_BASE + 0x8UL)))
-// [15:9] : (LFXOTUNING) Calibration for LFXO TUNING
-// [8:0]  : (HFXOCTUNE) Calibration for HFXO CTUNE
-#define DEVINFO_HFXOCTUNE_MASK 0x01FFUL
-
-#define set_HFXO_CTUNE(val)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        hfxoInit.ctuneXoAna = (val);                                                                                               \
-        hfxoInit.ctuneXiAna = (val);                                                                                               \
-    } while (0)
-
-static void initMcu_clocks(void);
-static void initHFXO(void);
-
-void initMcu(void)
-{
-    // ISR safe FreeRTOS API functions must *only* be called
-    // from interrupts that have been assigned a priority at or below
-    // configMAX_SYSCALL_INTERRUPT_PRIORITY.
-    // Here we init all IRQ prio to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
-    // to make sure no IRQ use default priority of zero as that is the highest possible priority
-    for (IRQn_Type i = 0; i < EXT_IRQ_COUNT; i++)
-    {
-        NVIC_SetPriority(i, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
-    }
-    // Device errata
-    CHIP_Init();
-
-    // Set up clocks
-    initMcu_clocks();
-
-    RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
-    rtccInit.enable            = true;
-    rtccInit.debugRun          = false;
-    rtccInit.precntWrapOnCCV0  = false;
-    rtccInit.cntWrapOnCCV1     = false;
-    rtccInit.prescMode         = rtccCntTickPresc;
-    rtccInit.presc             = rtccCntPresc_1;
-    RTCC_Init(&rtccInit);
-
-#if defined(EMU_VSCALE_PRESENT)
-    // Set up EM0, EM1 energy mode configuration
-    EMU_EM01Init_TypeDef em01Init = EMU_EM01INIT_DEFAULT;
-    EMU_EM01Init(&em01Init);
-#endif // EMU_VSCALE_PRESENT
-    // Set up EM2, EM3 energy mode configuration
-    EMU_EM23Init_TypeDef em23init = EMU_EM23INIT_DEFAULT;
-#if defined(EMU_VSCALE_PRESENT)
-    em23init.vScaleEM23Voltage = emuVScaleEM23_LowPower;
-#endif // EMU_VSCALE_PRESENT
-    EMU_EM23Init(&em23init);
-
-#if defined(RMU_PRESENT)
-    // Set reset mode for sysreset back to DEFAULT (extended), this might have
-    // been changed by the bootloader to FULL reset.
-    RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_SYSRMODE_MASK) | RMU_CTRL_SYSRMODE_DEFAULT;
-#endif
-}
-
-static void initMcu_clocks(void)
-{
-    // Initialize HFXO
-    initHFXO();
-
-    // Set system HFXO frequency
-    SystemHFXOClockSet(BSP_CLK_HFXO_FREQ);
-
-    CMU_HFRCODPLLBandSet(cmuHFRCODPLLFreq_80M0Hz);
-    CMU_ClockSelectSet(cmuClock_SYSCLK, cmuSelect_HFRCODPLL);
-
-    // Initialize LFXO
-    CMU_LFXOInit_TypeDef lfxoInit = BSP_CLK_LFXO_INIT;
-    lfxoInit.capTune              = BSP_CLK_LFXO_CTUNE;
-    CMU_LFXOInit(&lfxoInit);
-    // Set system LFXO frequency
-    SystemLFXOClockSet(BSP_CLK_LFXO_FREQ);
-
-    // Select LFXO as low frequency clock source
-    CMU_ClockSelectSet(cmuClock_RTCC, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_EM23GRPACLK, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_EM4GRPACLK, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_WDOG0, cmuSelect_LFXO);
-    CMU_ClockSelectSet(cmuClock_WDOG1, cmuSelect_LFXO);
-}
-
-static void initHFXO(void)
-{
-    // Initialize HFXO
-    // Use BSP_CLK_HFXO_INIT as last result (4th)
-    CMU_HFXOInit_TypeDef hfxoInit = BSP_CLK_HFXO_INIT;
-    // if Factory Cal exists in DEVINFO then use it above all (1st)
-    if (0 == (DEVINFO->MODULEINFO & DEVINFO_MODULEINFO_HFXOCALVAL_MASK))
-    {
-#if defined(_SILICON_LABS_32B_SERIES_1)
-        set_HFXO_CTUNE(DEVINFO_MODULEINFO_CRYSTALOSCCALVAL);
-#elif defined(_SILICON_LABS_32B_SERIES_2)
-        set_HFXO_CTUNE(DEVINFO->MODXOCAL & _DEVINFO_MODXOCAL_HFXOCTUNEXIANA_MASK);
-#endif
-    }
-    // if User page has CTUNE from studio use that in 2nd place
-#if (MFG_CTUNE_EN == 1)
-    else if (MFG_CTUNE_VAL != 0xFFFF)
-    {
-        set_HFXO_CTUNE(MFG_CTUNE_VAL);
-    }
-#endif
-    // 3rd option, get data from header defined for product/board
-#if defined(BSP_CLK_HFXO_CTUNE) && BSP_CLK_HFXO_CTUNE >= 0
-    else
-    {
-        set_HFXO_CTUNE(BSP_CLK_HFXO_CTUNE);
-    }
-#endif
-    CMU_HFXOInit(&hfxoInit);
-}
diff --git a/examples/platform/efr32/init_board.h b/examples/platform/efr32/init_board.h
deleted file mode 100644 (file)
index 74581d4..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_board.h
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "stdbool.h"
-
-void initBoard(void);
-void initVcomEnable(void);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/examples/platform/efr32/init_mcu.h b/examples/platform/efr32/init_mcu.h
deleted file mode 100644 (file)
index 18f1bfe..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-/*******************************************************************************
- * @file
- * @brief init_mcu.h
- *******************************************************************************
- * # License
- * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "board_features.h"
-#include "hal-config-board.h"
-
-/*
- * If Studio is allowed to use the CTUNE value from EEPROM on Silicon Labs radio board,
- * it will store it in the User page memory on the MFG_CTUNE_ADDR address.
- * If not, for example user already storing a value there, then the MFG_CTUNE_EN
- * must be set to 0, to avoid wrong value to be read out.
- * Studio can only read out the CTUNE value from the EEPROM if that is a
- * Silicon Labs radio board.
- * Please verify that CTUNE value is stored at the MFG_CTUNE_ADDR of
- * the User page, if want to overwrite the default MFG_CTUNE_EN define
- * for self use on custom boards.
- */
-
-// This is a Silicon Labs radio board, the CTUNE value can be read out from EEPROM
-#define MFG_CTUNE_EN 1
-
-// Address for CTUNE in User page
-#define MFG_CTUNE_ADDR 0x0FE00100UL
-// Value of the CTUNE in User page
-#define MFG_CTUNE_VAL (*((uint16_t *) (MFG_CTUNE_ADDR)))
-
-void initMcu(void);
-
-void initOtSysEFR(void);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/examples/platform/efr32/init_otSystem.c b/examples/platform/efr32/init_otSystem.c
deleted file mode 100644 (file)
index 50d6f35..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2019 Google LLC.
- *    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/CHIPPlatformMemory.h>
-
-#include <mbedtls/platform.h>
-#include <openthread/cli.h>
-#include <openthread/dataset.h>
-#include <openthread/error.h>
-#include <openthread/heap.h>
-#include <openthread/icmp6.h>
-#include <openthread/instance.h>
-#include <openthread/link.h>
-#include <openthread/platform/openthread-system.h>
-#include <openthread/platform/uart.h>
-#include <openthread/tasklet.h>
-#include <openthread/thread.h>
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-#include <string.h>
-
-#include "common/logging.hpp"
-
-#include "bsp.h"
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_emu.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "rail.h"
-#include "sl_mpu.h"
-#include "sl_sleeptimer.h"
-
-#include "platform-efr32.h"
-
-#if (HAL_FEM_ENABLE)
-#include "fem-control.h"
-#endif
-
-#if DISPLAY_ENABLED
-#include "lcd.h"
-#endif
-
-void halInitChipSpecific(void);
-
-void initOtSysEFR(void)
-{
-    sl_status_t status;
-    uint32_t PrioGoupPos = 0;
-    uint32_t SubPrio     = 0;
-#if defined(EFR32MG21)
-    // FreeRTOS recommends a lower configuration for CortexM3 and asserts
-    // in some places if using default PRIGROUP_POSITION.
-    SubPrio = 1;
-#endif
-
-    __disable_irq();
-
-#undef FIXED_EXCEPTION
-#define FIXED_EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler)
-#define EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler, priorityLevel, subpriority)                            \
-    PrioGoupPos = PRIGROUP_POSITION - SubPrio;                                                                                     \
-    NVIC_SetPriority(deviceIrqn, NVIC_EncodePriority(PrioGoupPos, priorityLevel, subpriority));
-#include NVIC_CONFIG
-#undef EXCEPTION
-
-    NVIC_SetPriorityGrouping(PrioGoupPos);
-    CHIP_Init();
-    halInitChipSpecific();
-#if DISPLAY_ENABLED
-    initLCD();
-#endif
-    BSP_Init(BSP_INIT_BCC);
-
-#if defined(EFR32MG12)
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFRCO);
-    CMU_ClockEnable(cmuClock_CORELE, true);
-#elif defined(EFR32MG21)
-    CMU_OscillatorEnable(cmuOsc_LFRCO, true, true);
-#else
-#error "Enable Clocks for the used board"
-#endif /* EFR32 PLATFORM */
-    CMU_ClockEnable(cmuClock_RTCC, true);
-    status = sl_sleeptimer_init();
-    assert(status == SL_STATUS_OK);
-
-#if (HAL_FEM_ENABLE)
-    initFem();
-    wakeupFem();
-#endif
-
-    __enable_irq();
-
-#if EFR32_LOG_ENABLED
-    efr32LogInit();
-#endif
-    efr32RadioInit();
-    efr32AlarmInit();
-    efr32MiscInit();
-#ifndef EFR32MG21
-    efr32RandomInit();
-#endif /* EFR32 PLATFORM */
-    otHeapSetCAllocFree(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
-}
diff --git a/examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.c b/examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.c
deleted file mode 100644 (file)
index 67b20a3..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Google LLC.
- *    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 "FreeRtosMbedtlsMutex.h"
-
-#include "FreeRTOS.h"
-#include "semphr.h"
-
-#include <assert.h>
-
-static inline void mutex_init(mbedtls_threading_mutex_t * p_mutex)
-{
-    assert(p_mutex != NULL);
-    *p_mutex = xSemaphoreCreateMutex();
-    assert(*p_mutex != NULL);
-}
-
-static inline void mutex_free(mbedtls_threading_mutex_t * p_mutex)
-{
-    assert(p_mutex != NULL);
-    assert(*p_mutex != NULL);
-    vSemaphoreDelete(*p_mutex);
-}
-
-static inline int mutex_lock(mbedtls_threading_mutex_t * p_mutex)
-{
-    assert(p_mutex != NULL);
-    assert(*p_mutex != NULL);
-    return xSemaphoreTake(*p_mutex, portMAX_DELAY) != pdTRUE;
-}
-
-static inline int mutex_unlock(mbedtls_threading_mutex_t * p_mutex)
-{
-    assert(p_mutex != NULL);
-    assert(*p_mutex != NULL);
-    return xSemaphoreGive(*p_mutex) != pdTRUE;
-}
-
-void freertos_mbedtls_mutex_init(void)
-{
-    mbedtls_threading_set_alt(mutex_init, mutex_free, mutex_lock, mutex_unlock);
-}
-
-void freertos_mbedtls_mutex_free(void)
-{
-    mbedtls_threading_free_alt();
-}
diff --git a/examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.h b/examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.h
deleted file mode 100644 (file)
index a27f72d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Nest Labs, 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
-
-typedef void * mbedtls_threading_mutex_t;
-
-extern void mbedtls_threading_set_alt(void (*mutex_init)(mbedtls_threading_mutex_t *),
-                                      void (*mutex_free)(mbedtls_threading_mutex_t *),
-                                      int (*mutex_lock)(mbedtls_threading_mutex_t *),
-                                      int (*mutex_unlock)(mbedtls_threading_mutex_t *));
-
-extern void mbedtls_threading_free_alt(void);
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for initializing alternative MbedTLS mutexes to enable the usage of the FreeRTOS implementation. */
-void freertos_mbedtls_mutex_init(void);
-
-/**@brief Function for releasing MbedTLS alternative mutexes. */
-void freertos_mbedtls_mutex_free(void);
-
-#ifdef __cplusplus
-}
-#endif
index a8ff80f..56a0449 100644 (file)
@@ -64,17 +64,3 @@ void freertos_mbedtls_mutex_free(void)
 {
     mbedtls_threading_free_alt();
 }
-
-void * pvPortCallocRtos(size_t num, size_t size)
-{
-    size_t totalAllocSize = (size_t)(num * size);
-
-    void * p = pvPortMalloc(totalAllocSize);
-
-    if (p)
-    {
-        memset(p, 0, totalAllocSize);
-    }
-
-    return p;
-}
diff --git a/examples/platform/k32w/doc/images/debg-conf.JPG b/examples/platform/k32w/doc/images/debg-conf.JPG
deleted file mode 100644 (file)
index 087e711..0000000
Binary files a/examples/platform/k32w/doc/images/debg-conf.JPG and /dev/null differ
diff --git a/examples/platform/nrfconnect/doc/images/nrf52840-dk.jpg b/examples/platform/nrfconnect/doc/images/nrf52840-dk.jpg
deleted file mode 100755 (executable)
index 0231be5..0000000
Binary files a/examples/platform/nrfconnect/doc/images/nrf52840-dk.jpg and /dev/null differ
diff --git a/examples/platform/nrfconnect/pw_sys_io/include/pw_sys_io_nrfconnect/init.h b/examples/platform/nrfconnect/pw_sys_io/include/pw_sys_io_nrfconnect/init.h
deleted file mode 100644 (file)
index 9f375ed..0000000
+++ /dev/null
@@ -1,27 +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 "pw_preprocessor/util.h"
-
-PW_EXTERN_C_START
-
-// The actual implement of PreMainInit() in sys_io_BACKEND.
-void pw_sys_io_Init();
-
-PW_EXTERN_C_END
diff --git a/examples/platform/qpg6100/util/streamer/streamer_qpg6100.cpp b/examples/platform/qpg6100/util/streamer/streamer_qpg6100.cpp
deleted file mode 100644 (file)
index 7ac4315..0000000
+++ /dev/null
@@ -1,63 +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.
- */
-
-/**
- *    @file
- *      Source implementation of an input / output stream for QPG6100 targets.
- */
-
-#include <lib/shell/shell.h>
-
-#ifdef QPG6100_SHELL_STREAMER
-
-#include "qvCHIP.h"
-
-namespace chip {
-namespace Shell {
-
-int streamer_qpg6100_init(streamer_t * streamer)
-{
-    qvCHIP_UartInit();
-    return 0;
-}
-
-int streamer_qpg6100_read(streamer_t * streamer, char * buf, size_t len)
-{
-    return qvCHIP_UartReadRxData(len, buf);
-}
-
-int streamer_qpg6100_write(streamer_t * streamer, const char * buf, size_t len)
-{
-    qvCHIP_UartTxData(len, buf);
-    return len;
-}
-
-static streamer_t streamer_qpg6100 = {
-    .init_cb  = streamer_qpg6100_init,
-    .read_cb  = streamer_qpg6100_read,
-    .write_cb = streamer_qpg6100_write,
-};
-
-streamer_t * streamer_get(void)
-{
-    return &streamer_qpg6100;
-}
-
-} // namespace Shell
-} // namespace chip
-
-#endif //#ifdef QPG6100_SHELL_STREAMER
index 696ab03..47d79d0 100644 (file)
@@ -34,6 +34,7 @@ Done
 -   [exit](#exit)
 -   [help](#help)
 -   [otcli](README_OTCLI.md)
+-   [ping](#ping)
 -   [rand](#rand)
 -   [version](#version)
 
@@ -51,6 +52,7 @@ Display a list of all top-level commands supported and a brief description.
   base64          Base64 encode / decode utilities
   device          Device Layer commands
   otcli           Dispatch OpenThread CLI command
+  ping            Using Echo Protocol to measure packet loss across network paths
   exit            Exit the shell application
   help            List out all top level commands
   version         Output the software version
index 31220b0..3438795 100644 (file)
@@ -33,3 +33,5 @@
 
 // Enable support functions for parsing command-line arguments
 #define CHIP_CONFIG_ENABLE_ARG_PARSER 1
+
+#define CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING 1
index 117eef2..d1e95b9 100644 (file)
@@ -18,9 +18,10 @@ cmake_minimum_required(VERSION 3.13.1)
 get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH)
 get_filename_component(APP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. REALPATH)
 
-set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
+include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
 
 # Load NCS/Zephyr build system
+set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf)
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module)
 find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
 
diff --git a/examples/shell/qpg6100/.gn b/examples/shell/qpg6100/.gn
deleted file mode 100644 (file)
index 89dc9a6..0000000
+++ /dev/null
@@ -1,26 +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.
-
-# The location of the build configuration file.
-buildconfig = "//build/config/BUILDCONFIG.gn"
-
-# CHIP uses angle bracket includes.
-check_system_includes = true
-
-default_args = {
-  target_cpu = "arm"
-  target_os = "freertos"
-
-  import("//args.gni")
-}
diff --git a/examples/shell/qpg6100/BUILD.gn b/examples/shell/qpg6100/BUILD.gn
deleted file mode 100644 (file)
index c634817..0000000
+++ /dev/null
@@ -1,83 +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.
-
-import("//build/config/defaults.gni")
-import("//build_overrides/chip.gni")
-import("//build_overrides/qpg6100_sdk.gni")
-import("${qpg6100_sdk_build_root}/qpg6100_executable.gni")
-import("${qpg6100_sdk_build_root}/qpg6100_sdk.gni")
-
-assert(current_os == "freertos")
-
-examples_plat_dir = "${chip_root}/examples/platform/qpg6100"
-
-qpg6100_sdk("sdk") {
-  include_dirs = [
-    "${chip_root}/src/platform/qpg6100",
-    "${examples_plat_dir}/project_include",
-    "${chip_root}/src/app/util",
-  ]
-
-  sources = [ "${examples_plat_dir}/project_include/CHIPProjectConfig.h" ]
-
-  defines = []
-  if (is_debug) {
-    defines += [ "BUILD_RELEASE=0" ]
-  } else {
-    defines += [ "BUILD_RELEASE=1" ]
-  }
-}
-
-qpg6100_executable("shell_qpg6100") {
-  include_dirs = []
-  defines = []
-  output_name = "shell-qpg6100.out"
-
-  public_deps = [
-    ":sdk",
-    "${chip_root}/examples/shell/shell_common",
-    "${chip_root}/src/lib",
-    "${chip_root}/src/lib/shell",
-    "${chip_root}/src/setup_payload",
-
-    #    OpenThread to be enabled
-    #    https://github.com/project-chip/connectedhomeip/issues/293
-  ]
-
-  include_dirs += [ "${chip_root}/src/app/util" ]
-
-  sources = [
-    "${examples_plat_dir}/project_include/CHIPProjectConfig.h",
-    "${examples_plat_dir}/util/streamer/streamer_qpg6100.cpp",
-    "main.cpp",
-  ]
-
-  output_dir = root_out_dir
-
-  ldscript = "${qpg6100_sdk_root}/qpg6100/ldscripts/chip-qpg6100-example.ld"
-
-  ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
-  defines = [
-    "QPG6100_SHELL_STREAMER",
-    "SHELL_STREAMER_APP_SPECIFIC",
-  ]
-}
-
-group("qpg6100") {
-  deps = [ ":shell_qpg6100" ]
-}
-
-group("default") {
-  deps = [ ":qpg6100" ]
-}
diff --git a/examples/shell/qpg6100/README.md b/examples/shell/qpg6100/README.md
deleted file mode 100644 (file)
index 3519f4d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# CHIP QPG6100 Shell Application
-
-A [chip-shell](../README.md) project for the Qorvo QPG6100 development kit.
-
-## Building
-
-The Shell Application builds and flashes like any other QPG6100 example
-application. Further information can be found in
-[this](../../lock-app/qpg6100/README.md) README.
diff --git a/examples/shell/qpg6100/args.gni b/examples/shell/qpg6100/args.gni
deleted file mode 100644 (file)
index 38f955b..0000000
+++ /dev/null
@@ -1,18 +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.
-
-import("//build_overrides/chip.gni")
-import("${chip_root}/examples/platform/qpg6100/args.gni")
-
-qpg6100_sdk_target = get_label_info(":sdk", "label_no_toolchain")
diff --git a/examples/shell/qpg6100/build b/examples/shell/qpg6100/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/shell/qpg6100/build_overrides b/examples/shell/qpg6100/build_overrides
deleted file mode 120000 (symlink)
index e578e73..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../build_overrides
\ No newline at end of file
diff --git a/examples/shell/qpg6100/main.cpp b/examples/shell/qpg6100/main.cpp
deleted file mode 100644 (file)
index bc14524..0000000
+++ /dev/null
@@ -1,100 +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.
- */
-
-#include "FreeRTOS.h"
-#include "task.h"
-
-#include <lib/shell/shell.h>
-
-#include <lib/core/CHIPCore.h>
-#include <lib/support/Base64.h>
-#include <lib/support/CHIPArgParser.hpp>
-#include <lib/support/CodeUtils.h>
-#include <lib/support/RandUtils.h>
-#include <support/logging/CHIPLogging.h>
-
-#include <ChipShellCollection.h>
-
-#include "qvCHIP.h"
-
-#if CHIP_ENABLE_OPENTHREAD
-extern "C" {
-#include <openthread/platform/platform-softdevice.h>
-}
-#endif // CHIP_ENABLE_OPENTHREAD
-
-using namespace chip;
-using namespace chip::Shell;
-
-namespace {
-
-const size_t kShellTaskStackSize = 2048;
-const int kShellTaskPriority     = 1;
-TaskHandle_t sShellTaskHandle;
-
-void ShellCLIMain(void * pvParameter)
-{
-    // Initialize the default streamer that was linked.
-    const int rc = streamer_init(streamer_get());
-
-    if (rc != 0)
-    {
-        ChipLogError(Shell, "Streamer initialization failed: %d", rc);
-        return;
-    }
-
-    ChipLogDetail(Shell, "Initializing CHIP shell commands: %d", rc);
-
-    cmd_device_init();
-    cmd_base64_init();
-    cmd_misc_init();
-    cmd_btp_init();
-    cmd_otcli_init();
-
-    ChipLogDetail(Shell, "Run CHIP shell Task: %d", rc);
-
-    shell_task(nullptr);
-}
-
-} // namespace
-
-int StartShellTask(void)
-{
-    int ret = 0;
-
-    // Start Shell task.
-    if (xTaskCreate(ShellCLIMain, "SHELL", kShellTaskStackSize / sizeof(StackType_t), NULL, kShellTaskPriority,
-                    &sShellTaskHandle) != pdPASS)
-    {
-        ret = -1;
-    }
-
-    return ret;
-}
-
-int main(void)
-{
-    /* Initialize platform */
-    qvCHIP_init();
-
-    /* Launch shell task */
-    StartShellTask();
-
-    /* Start FreeRTOS */
-    vTaskStartScheduler();
-    return 0;
-}
diff --git a/examples/shell/qpg6100/third_party/connectedhomeip b/examples/shell/qpg6100/third_party/connectedhomeip
deleted file mode 120000 (symlink)
index c866b86..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../..
\ No newline at end of file
index d11a5ae..29674db 100644 (file)
@@ -36,12 +36,18 @@ static_library("shell_common") {
     "cmd_device.cpp",
     "cmd_misc.cpp",
     "cmd_otcli.cpp",
+    "cmd_ping.cpp",
   ]
 
   public_deps = [
     "${chip_root}/src/lib",
+    "${chip_root}/src/lib/core",
     "${chip_root}/src/lib/shell",
+    "${chip_root}/src/lib/support",
+    "${chip_root}/src/platform",
+    "${chip_root}/src/protocols",
     "${chip_root}/src/setup_payload",
+    "${chip_root}/src/system",
   ]
 
   if (chip_enable_openthread &&
diff --git a/examples/shell/shell_common/cmd_ping.cpp b/examples/shell/shell_common/cmd_ping.cpp
new file mode 100644 (file)
index 0000000..bb0101c
--- /dev/null
@@ -0,0 +1,483 @@
+/*
+ *
+ *    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 <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <core/CHIPCore.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>
+#include <transport/raw/TCP.h>
+#include <transport/raw/UDP.h>
+
+#include <ChipShellCollection.h>
+
+using namespace chip;
+using namespace Shell;
+using namespace Logging;
+
+constexpr size_t kMaxTcpActiveConnectionCount = 4;
+constexpr size_t kMaxTcpPendingPackets        = 4;
+constexpr size_t kNetworkSleepTimeMsecs       = (100 * 1000);
+constexpr size_t kDecimalDigitsForUint64      = 20;
+
+namespace {
+
+class PingArguments
+{
+public:
+    void Reset()
+    {
+        mMaxEchoCount       = 3;
+        mEchoInterval       = 1000;
+        mLastEchoTime       = 0;
+        mEchoCount          = 0;
+        mEchoRespCount      = 0;
+        mWaitingForEchoResp = false;
+        mUsingTCP           = false;
+        mUsingCRMP          = true;
+        mEchoPort           = CHIP_PORT;
+    }
+
+    uint64_t GetLastEchoTime() const { return mLastEchoTime; }
+    void SetLastEchoTime(uint64_t value) { mLastEchoTime = value; }
+
+    uint64_t GetEchoCount() const { return mEchoCount; }
+    void SetEchoCount(uint64_t value) { mEchoCount = value; }
+    void IncrementEchoCount() { mEchoCount++; }
+
+    uint64_t GetEchoRespCount() const { return mEchoRespCount; }
+    void SetEchoRespCount(uint64_t value) { mEchoRespCount = value; }
+    void IncrementEchoRespCount() { mEchoRespCount++; }
+
+    uint32_t GetMaxEchoCount() const { return mMaxEchoCount; }
+    void SetMaxEchoCount(uint32_t id) { mMaxEchoCount = id; }
+
+    uint32_t GetEchoInterval() const { return mEchoInterval; }
+    void SetEchoInterval(uint32_t value) { mEchoInterval = value; }
+
+    uint16_t GetEchoPort() const { return mEchoPort; }
+    void SetEchoPort(uint16_t value) { mEchoPort = value; }
+
+    bool IsWaitingForEchoResp() const { return mWaitingForEchoResp; }
+    void SetWaitingForEchoResp(bool value) { mWaitingForEchoResp = value; }
+
+    bool IsUsingTCP() const { return mUsingTCP; }
+    void SetUsingTCP(bool value) { mUsingTCP = value; }
+
+    bool IsUsingCRMP() const { return mUsingCRMP; }
+    void SetUsingCRMP(bool value) { mUsingCRMP = value; }
+
+private:
+    // The last time a echo request was attempted to be sent.
+    uint64_t mLastEchoTime;
+
+    // Count of the number of echo requests sent.
+    uint64_t mEchoCount;
+
+    // Count of the number of echo responses received.
+    uint64_t mEchoRespCount;
+
+    // Max value for the number of echo requests sent.
+    uint32_t mMaxEchoCount;
+
+    // The CHIP Echo interval time in milliseconds.
+    uint32_t mEchoInterval;
+
+    uint16_t mEchoPort;
+
+    // True, if the echo client is waiting for an echo response
+    // after sending an echo request, false otherwise.
+    bool mWaitingForEchoResp;
+
+    bool mUsingTCP;
+    bool mUsingCRMP;
+} gPingArguments;
+
+constexpr Transport::AdminId gAdminId = 0;
+
+Protocols::Echo::EchoClient gEchoClient;
+TransportMgr<Transport::UDP> gUDPManager;
+TransportMgr<Transport::TCP<kMaxTcpActiveConnectionCount, kMaxTcpPendingPackets>> gTCPManager;
+Messaging::ExchangeManager gExchangeManager;
+SecureSessionMgr gSessionManager;
+Inet::IPAddress gDestAddr;
+
+bool EchoIntervalExpired(void)
+{
+    uint64_t now = System::Timer::GetCurrentEpoch();
+
+    return (now >= gPingArguments.GetLastEchoTime() + gPingArguments.GetEchoInterval());
+}
+
+CHIP_ERROR SendEchoRequest(streamer_t * stream)
+{
+    CHIP_ERROR err = CHIP_NO_ERROR;
+
+    Messaging::SendFlags sendFlags;
+    const char kRequestFormat[] = "Echo Message %" PRIu64 "\n";
+    char requestData[(sizeof kRequestFormat) + kDecimalDigitsForUint64];
+    snprintf(requestData, sizeof requestData, kRequestFormat, gPingArguments.GetEchoCount());
+    System::PacketBufferHandle payloadBuf = MessagePacketBuffer::NewWithData(requestData, strlen(requestData));
+
+    if (gPingArguments.IsUsingCRMP())
+    {
+        sendFlags.Set(Messaging::SendMessageFlags::kNone);
+    }
+    else
+    {
+        sendFlags.Set(Messaging::SendMessageFlags::kNoAutoRequestAck);
+    }
+
+    if (payloadBuf.IsNull())
+    {
+        streamer_printf(stream, "Unable to allocate packet buffer\n");
+        return CHIP_ERROR_NO_MEMORY;
+    }
+
+    gPingArguments.SetLastEchoTime(System::Timer::GetCurrentEpoch());
+
+    streamer_printf(stream, "\nSend echo request message to Node: %" PRIu64 "\n", kTestDeviceNodeId);
+
+    err = gEchoClient.SendEchoRequest(std::move(payloadBuf), sendFlags);
+
+    if (err == CHIP_NO_ERROR)
+    {
+        gPingArguments.SetWaitingForEchoResp(true);
+        gPingArguments.IncrementEchoCount();
+    }
+    else
+    {
+        streamer_printf(stream, "Send echo request failed, err: %s\n", ErrorStr(err));
+    }
+
+    return err;
+}
+
+CHIP_ERROR EstablishSecureSession(streamer_t * stream)
+{
+    CHIP_ERROR err = CHIP_NO_ERROR;
+
+    Optional<Transport::PeerAddress> peerAddr;
+    SecurePairingUsingTestSecret * testSecurePairingSecret = chip::Platform::New<SecurePairingUsingTestSecret>();
+    VerifyOrExit(testSecurePairingSecret != nullptr, err = CHIP_ERROR_NO_MEMORY);
+
+    if (gPingArguments.IsUsingTCP())
+    {
+        peerAddr = Optional<Transport::PeerAddress>::Value(Transport::PeerAddress::TCP(gDestAddr, gPingArguments.GetEchoPort()));
+    }
+    else
+    {
+        peerAddr = Optional<Transport::PeerAddress>::Value(
+            Transport::PeerAddress::UDP(gDestAddr, gPingArguments.GetEchoPort(), INET_NULL_INTERFACEID));
+    }
+
+    // Attempt to connect to the peer.
+    err = gSessionManager.NewPairing(peerAddr, kTestDeviceNodeId, testSecurePairingSecret,
+                                     SecureSessionMgr::PairingDirection::kInitiator, gAdminId);
+
+exit:
+    if (err != CHIP_NO_ERROR)
+    {
+        streamer_printf(stream, "Establish secure session failed, err: %s\n", ErrorStr(err));
+        gPingArguments.SetLastEchoTime(System::Timer::GetCurrentEpoch());
+    }
+    else
+    {
+        streamer_printf(stream, "Establish secure session succeeded\n");
+    }
+
+    return err;
+}
+
+void HandleEchoResponseReceived(Messaging::ExchangeContext * ec, System::PacketBufferHandle payload)
+{
+    uint32_t respTime    = System::Timer::GetCurrentEpoch();
+    uint32_t transitTime = respTime - gPingArguments.GetLastEchoTime();
+    streamer_t * sout    = streamer_get();
+
+    gPingArguments.SetWaitingForEchoResp(false);
+    gPingArguments.IncrementEchoRespCount();
+
+    streamer_printf(sout, "Echo Response: %" PRIu64 "/%" PRIu64 "(%.2f%%) len=%u time=%.3fms\n", gPingArguments.GetEchoRespCount(),
+                    gPingArguments.GetEchoCount(),
+                    static_cast<double>(gPingArguments.GetEchoRespCount()) * 100 / gPingArguments.GetEchoCount(),
+                    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;
+
+    Transport::AdminPairingTable admins;
+    Transport::AdminPairingInfo * adminInfo = nullptr;
+    uint32_t maxEchoCount                   = 0;
+
+    if (!Inet::IPAddress::FromString(destination, gDestAddr))
+    {
+        streamer_printf(stream, "Invalid Echo Server IP address: %s\n", destination);
+        ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT);
+    }
+
+    adminInfo = admins.AssignAdminId(gAdminId, kTestControllerNodeId);
+    VerifyOrExit(adminInfo != nullptr, err = CHIP_ERROR_NO_MEMORY);
+
+    err = gTCPManager.Init(Transport::TcpListenParameters(&DeviceLayer::InetLayer)
+                               .SetAddressType(Inet::kIPAddressType_IPv4)
+                               .SetListenPort(gPingArguments.GetEchoPort() + 1));
+    VerifyOrExit(err == CHIP_NO_ERROR, streamer_printf(stream, "Failed to init TCP manager error: %s\r\n", ErrorStr(err)));
+
+    err = gUDPManager.Init(Transport::UdpListenParameters(&DeviceLayer::InetLayer)
+                               .SetAddressType(Inet::kIPAddressType_IPv4)
+                               .SetListenPort(gPingArguments.GetEchoPort() + 1));
+    VerifyOrExit(err == CHIP_NO_ERROR, streamer_printf(stream, "Failed to init UDP manager error: %s\r\n", ErrorStr(err)));
+
+    if (gPingArguments.IsUsingTCP())
+    {
+        err = gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gTCPManager, &admins);
+        SuccessOrExit(err);
+
+        err = gExchangeManager.Init(kTestControllerNodeId, &gTCPManager, &gSessionManager);
+        SuccessOrExit(err);
+    }
+    else
+    {
+        err = gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gUDPManager, &admins);
+        SuccessOrExit(err);
+
+        err = gExchangeManager.Init(kTestControllerNodeId, &gUDPManager, &gSessionManager);
+        SuccessOrExit(err);
+    }
+
+    // Start the CHIP connection to the CHIP echo responder.
+    err = EstablishSecureSession(stream);
+    SuccessOrExit(err);
+
+    // TODO: temprary create a SecureSessionHandle from node id to unblock end-to-end test. Complete solution is tracked in PR:4451
+    err = gEchoClient.Init(&gExchangeManager, { kTestDeviceNodeId, 0, gAdminId });
+    SuccessOrExit(err);
+
+    // Arrange to get a callback whenever an Echo Response is received.
+    gEchoClient.SetEchoResponseReceived(HandleEchoResponseReceived);
+
+    maxEchoCount = gPingArguments.GetMaxEchoCount();
+
+    // Connection has been established. Now send the EchoRequests.
+    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));
+            break;
+        }
+
+        // Wait for response until the Echo interval.
+        while (!EchoIntervalExpired())
+        {
+            DriveIO(stream);
+        }
+
+        // Check if expected response was received.
+        if (gPingArguments.IsWaitingForEchoResp())
+        {
+            streamer_printf(stream, "No response received\n");
+            gPingArguments.SetWaitingForEchoResp(false);
+        }
+    }
+
+    gEchoClient.Shutdown();
+    gExchangeManager.Shutdown();
+    gSessionManager.Shutdown();
+
+exit:
+    if ((err != CHIP_NO_ERROR))
+    {
+        streamer_printf(stream, "Ping failed with error: %s\n", ErrorStr(err));
+    }
+}
+
+void PrintUsage(streamer_t * stream)
+{
+    streamer_printf(stream, "Usage: ping [options] <destination>\n\nOptions:\n");
+
+    streamer_printf(stream,
+                    "  -h              print help information\n"
+                    "  -u              use UDP (default)\n"
+                    "  -t              use TCP\n"
+                    "  -p  <port>      echo server port\n"
+                    "  -i  <interval>  ping interval time in seconds\n"
+                    "  -c  <count>     stop after <count> replies\n"
+                    "  -r  <1|0>       enalbe/disable CRMP\n");
+}
+
+int cmd_ping(int argc, char ** argv)
+{
+    streamer_t * sout = streamer_get();
+    int ret           = 0;
+    int optIndex      = 0;
+
+    gPingArguments.Reset();
+
+    while (optIndex < argc && argv[optIndex][0] == '-')
+    {
+        switch (argv[optIndex][1])
+        {
+        case 'h':
+            PrintUsage(sout);
+            return 0;
+        case 'u':
+            gPingArguments.SetUsingTCP(false);
+            break;
+        case 't':
+            gPingArguments.SetUsingTCP(true);
+            break;
+        case 'i':
+            if (++optIndex >= argc || argv[optIndex][0] == '-')
+            {
+                streamer_printf(sout, "Invalid argument specified for -i\n");
+                return -1;
+            }
+            else
+            {
+                gPingArguments.SetEchoInterval(atol(argv[optIndex]) * 1000);
+            }
+            break;
+        case 'c':
+            if (++optIndex >= argc || argv[optIndex][0] == '-')
+            {
+                streamer_printf(sout, "Invalid argument specified for -c\n");
+                return -1;
+            }
+            else
+            {
+                gPingArguments.SetMaxEchoCount(atol(argv[optIndex]));
+            }
+            break;
+        case 'p':
+            if (++optIndex >= argc || argv[optIndex][0] == '-')
+            {
+                streamer_printf(sout, "Invalid argument specified for -c\n");
+                return -1;
+            }
+            else
+            {
+                gPingArguments.SetEchoPort(atol(argv[optIndex]));
+            }
+            break;
+        case 'r':
+            if (++optIndex >= argc || argv[optIndex][0] == '-')
+            {
+                streamer_printf(sout, "Invalid argument specified for -r\n");
+                return -1;
+            }
+            else
+            {
+                int arg = atoi(argv[optIndex]);
+
+                if (arg == 0)
+                {
+                    gPingArguments.SetUsingCRMP(false);
+                }
+                else if (arg == 1)
+                {
+                    gPingArguments.SetUsingCRMP(true);
+                }
+                else
+                {
+                    ret = -1;
+                }
+            }
+            break;
+        default:
+            ret = -1;
+        }
+
+        optIndex++;
+    }
+
+    if (optIndex >= argc)
+    {
+        streamer_printf(sout, "Missing IP address\n");
+        ret = -1;
+    }
+
+    if (ret == 0)
+    {
+        streamer_printf(sout, "IP address: %s\n", argv[optIndex]);
+        StartPinging(sout, argv[optIndex]);
+    }
+
+    return ret;
+}
+
+} // namespace
+
+static shell_command_t cmds_ping[] = {
+    { &cmd_ping, "ping", "Using Echo Protocol to measure packet loss across network paths" },
+};
+
+void cmd_ping_init()
+{
+    shell_register(cmds_ping, ArraySize(cmds_ping));
+}
index 3306a4c..1e837d7 100644 (file)
@@ -24,4 +24,5 @@ void cmd_btp_init(void);
 void cmd_device_init(void);
 void cmd_misc_init(void);
 void cmd_otcli_init(void);
+void cmd_ping_init(void);
 }
diff --git a/examples/shell/standalone/build b/examples/shell/standalone/build
deleted file mode 120000 (symlink)
index d56ed62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-third_party/connectedhomeip/build
\ No newline at end of file
index a6a14f3..9642f33 100644 (file)
@@ -46,6 +46,10 @@ int main()
     cmd_btp_init();
     cmd_otcli_init();
 
+#ifndef CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING
+    cmd_ping_init();
+#endif
+
     shell_task(nullptr);
     return 0;
 }
index f5f88af..fc5ea3b 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -696,10 +734,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -710,6 +744,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index 14a3742..d028079 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,6 +34,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
index 6f791a0..29ae867 100644 (file)
@@ -48,10 +48,19 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @interface CHIPBasic : CHIPCluster
 
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler;
-
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler;
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler;
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
 
 @end
index 86769de..6329098 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -319,7 +365,148 @@ private:
     return &_cppCluster;
 }
 
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
+- (void)readAttributeInteractionModelVersion:(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.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorID:(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.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductID:(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.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -334,7 +521,105 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersion:(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.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -342,9 +627,9 @@ private:
     }
 }
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -357,7 +642,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -365,9 +650,10 @@ private:
     }
 }
 
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -380,7 +666,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
index a0006c7..c9e3366 100644 (file)
@@ -39,30 +39,6 @@ namespace app {
 
 namespace clusters {
 
-namespace Basic {
-
-void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfBasicClusterResetToFactoryDefaultsCallback();
-            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_BASIC_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace Basic
-
 } // namespace clusters
 
 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
@@ -73,9 +49,6 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
     Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
     switch (aClusterId)
     {
-    case ZCL_BASIC_CLUSTER_ID:
-        clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
-        break;
     default:
         // Unrecognized cluster ID, error status will apply.
         // TODO: Encode response for Cluster not found
index 8802797..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Low Power
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index 82d19ea..edceae4 100644 (file)
@@ -71,7 +71,8 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
         switch (cmd->apsFrame->clusterId)
         {
         case ZCL_BASIC_CLUSTER_ID:
-            result = emberAfBasicClusterServerCommandParse(cmd);
+            // No commands are enabled for cluster Basic
+            result = status(false, true, cmd->mfgSpecific);
             break;
         case ZCL_TEMP_MEASUREMENT_CLUSTER_ID:
             // No commands are enabled for cluster Temperature Measurement
@@ -86,24 +87,3 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
 }
 
 // Cluster specific command parsing
-
-EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            wasHandled = emberAfBasicClusterResetToFactoryDefaultsCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
index c76cbcc..b999d83 100644 (file)
@@ -196,12 +196,6 @@ void emberAfTemperatureMeasurementClusterServerTickCallback(chip::EndpointId end
 
 // Cluster Commands Callback
 
-/**
- * @brief Basic Cluster ResetToFactoryDefaults Command callback
- */
-
-bool emberAfBasicClusterResetToFactoryDefaultsCallback();
-
 //
 // Non-Cluster Related Callbacks
 //
index 97de7f6..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for Sleep
+ *
+ * Command: Sleep
+ */
+#define emberAfFillCommandLow                                                                                                      \
+    PowerClusterSleep() emberAfFillExternalBuffer(mask,                                                                            \
+                                                                                                                                   \
+                                                  ZCL_SLEEP_COMMAND_ID, "", );
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
index 99de14e..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Low Power
+#define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
index d31a267..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Low Power
+#define ZCL_SLEEP_COMMAND_ID (0x00)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
index ea33170..f701c1c 100644 (file)
 #if BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 32 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                  \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 64 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 96 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 112 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 176 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 180 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */                 \
     }
 
 #else // !BIGENDIAN_CPU
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
+        /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 32 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 64 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 96 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 112 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 176 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 180 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */              \
     }
 
 #endif // BIGENDIAN_CPU
 
-#define GENERATED_DEFAULTS_COUNT (0)
+#define GENERATED_DEFAULTS_COUNT (7)
 
 #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
 #define ZAP_LONG_DEFAULTS_INDEX(index)                                                                                             \
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 7
+#define GENERATED_ATTRIBUTE_COUNT 16
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
-        { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },          /* Basic (server): cluster revision */                     \
-            { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x08 } },    /* Basic (server): ZCL version */                          \
-            { 0x0007, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0x00 } },    /* Basic (server): power source */                         \
+        { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 } }, /* Basic (server): cluster revision */  \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }       \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(32) }      \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(64) } }, /* Basic (server): UserLabel */                                       \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(96) } }, /* Basic (server): Location */                                        \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(112) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(176) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(180) }     \
+            },                                                          /* Basic (server): SoftwareVersionString */                \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },      /* Temperature Measurement (server): cluster revision */   \
             { 0x0000, ZAP_TYPE(INT16S), 2, 0, { (uint8_t *) 0x8000 } }, /* Temperature Measurement (server): measured value */     \
             { 0x0001, ZAP_TYPE(INT16S), 2, 0, { (uint8_t *) 0x8000 } }, /* Temperature Measurement (server): min measured value */ \
 #define GENERATED_CLUSTER_COUNT 2
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, ZAP_ATTRIBUTE_INDEX(0), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 1, Cluster: Basic (server) */       \
+        { 0x0028, ZAP_ATTRIBUTE_INDEX(0), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 1, Cluster: Basic (server) */    \
             {                                                                                                                      \
-                0x0402, ZAP_ATTRIBUTE_INDEX(3), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL                                               \
+                0x0402, ZAP_ATTRIBUTE_INDEX(12), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */                                                        \
     }
 
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 2, 12 },                                                                                           \
+        { ZAP_CLUSTER_INDEX(0), 2, 262 },                                                                                          \
     }
 
 // Largest attribute size is needed for various buffers
-#define ATTRIBUTE_LARGEST (3)
+#define ATTRIBUTE_LARGEST (64)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (0)
+#define ATTRIBUTE_SINGLETONS_SIZE (254)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (12)
+#define ATTRIBUTE_MAX_SIZE (262)
 
 // 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 (1)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (3)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Basic (server): ResetToFactoryDefaults */                          \
+        { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) },     /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
     }
 
 // Array of EmberAfManufacturerCodeEntry structures for commands.
index 86a2a27..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #define CHIP_PRINTCLUSTER_IAS_WD_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_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
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
index 6ced702..2342fb2 100644 (file)
       "clusters": [
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "commands": [
-            {
-              "name": "ResetToFactoryDefaults",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 0
-            }
-          ],
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
@@ -62,7 +53,7 @@
               "side": "client",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "3",
               "reportable": 0,
         },
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "3",
               "reportable": 0,
               "reportableChange": 0
             },
             {
-              "name": "ZCL version",
+              "name": "InteractionModelVersion",
               "code": 0,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x08",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "power source",
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
               "code": 7,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
-              "singleton": 0,
+              "singleton": 1,
               "bounded": 0,
               "defaultValue": "0x00",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             }
-          ],
-          "commands": []
+          ]
         },
         {
           "name": "Power Configuration",
index 7aacff9..c4a6c90 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -738,10 +776,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -752,6 +786,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index 83df5b3..2fc3557 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,6 +34,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
index f01449b..e4f190a 100644 (file)
@@ -99,10 +99,19 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @interface CHIPBasic : CHIPCluster
 
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler;
-
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler;
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler;
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
 
 @end
@@ -496,7 +505,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 - (void)setHolidaySchedule:(uint8_t)scheduleId
                 localStartTime:(uint32_t)localStartTime
                   localEndTime:(uint32_t)localEndTime
@@ -505,12 +514,12 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler;
 - (void)setWeekdaySchedule:(uint8_t)scheduleId
@@ -526,8 +535,8 @@ NS_ASSUME_NONNULL_BEGIN
             localStartTime:(uint32_t)localStartTime
               localEndTime:(uint32_t)localEndTime
          completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 
 - (void)readAttributeLockState:(ResponseHandler)completionHandler;
 - (void)configureAttributeLockState:(uint16_t)minInterval
@@ -560,7 +569,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 - (void)setHolidaySchedule:(uint8_t)scheduleId
                 localStartTime:(uint32_t)localStartTime
                   localEndTime:(uint32_t)localEndTime
@@ -569,12 +578,12 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler;
 - (void)setWeekdaySchedule:(uint8_t)scheduleId
@@ -590,8 +599,8 @@ NS_ASSUME_NONNULL_BEGIN
             localStartTime:(uint32_t)localStartTime
               localEndTime:(uint32_t)localEndTime
          completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 
 - (void)readAttributeLockState:(ResponseHandler)completionHandler;
 - (void)configureAttributeLockState:(uint16_t)minInterval
@@ -610,8 +619,10 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @interface CHIPGroups : CHIPCluster
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroupIfIdentifying:(uint16_t)groupId
+                    groupName:(NSString *)groupName
+            completionHandler:(ResponseHandler)completionHandler;
 - (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler;
 - (void)removeAllGroups:(ResponseHandler)completionHandler;
 - (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler;
@@ -758,7 +769,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
index 76ef09f..6647078 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -379,8 +425,8 @@ private:
 
 - (void)readAttributeVendorName:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -426,8 +472,8 @@ private:
 
 - (void)readAttributeApplicationName:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -473,8 +519,8 @@ private:
 
 - (void)readAttributeApplicationId:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -923,7 +969,148 @@ private:
     return &_cppCluster;
 }
 
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
+- (void)readAttributeInteractionModelVersion:(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.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeVendorID:(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.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeProductID:(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.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -938,7 +1125,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -946,9 +1135,10 @@ private:
     }
 }
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -961,7 +1151,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -969,9 +1159,105 @@ private:
     }
 }
 
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    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;
+    }
+
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersion:(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.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
+{
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(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.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -984,7 +1270,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1723,8 +2009,8 @@ private:
 
 - (void)readAttributeCompensationText:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3806,8 +4092,8 @@ private:
 
 - (void)readAttributeCompensationText:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -5585,7 +5871,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -5601,7 +5887,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -5638,7 +5926,7 @@ private:
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
@@ -5654,7 +5942,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, pin);
+    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -5664,7 +5954,7 @@ private:
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
@@ -5680,7 +5970,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, id);
+    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -5766,7 +6058,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -5782,14 +6074,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -5804,7 +6098,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds, pin);
+    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -6267,7 +6563,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -6283,7 +6579,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -6320,7 +6618,7 @@ private:
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
@@ -6336,7 +6634,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, pin);
+    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -6346,7 +6646,7 @@ private:
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
@@ -6362,7 +6662,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, id);
+    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -6448,7 +6750,7 @@ private:
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
         = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -6464,14 +6766,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -6486,7 +6790,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds, pin);
+    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -6641,7 +6947,7 @@ private:
     return &_cppCluster;
 }
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
 {
     CHIPGroupsClusterAddGroupResponseCallbackBridge * onSuccess
         = new CHIPGroupsClusterAddGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
@@ -6657,14 +6963,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -6679,7 +6987,9 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -7947,7 +8257,7 @@ private:
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
@@ -7967,8 +8277,10 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddScene(
-        onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, sceneName, clusterId, length, value);
+    CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime,
+        chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]),
+        clusterId, length, value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
index be0aac5..ebe9a25 100644 (file)
@@ -89,30 +89,6 @@ void DispatchServerCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace BarrierControl
 
-namespace Basic {
-
-void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfBasicClusterResetToFactoryDefaultsCallback();
-            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_BASIC_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace Basic
-
 namespace ColorControl {
 
 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -2386,9 +2362,6 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
     case ZCL_BARRIER_CONTROL_CLUSTER_ID:
         clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
-    case ZCL_BASIC_CLUSTER_ID:
-        clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
-        break;
     case ZCL_COLOR_CONTROL_CLUSTER_ID:
         clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
index 3ab0310..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index 2619593..3d35872 100644 (file)
@@ -105,7 +105,8 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
             result = emberAfBarrierControlClusterServerCommandParse(cmd);
             break;
         case ZCL_BASIC_CLUSTER_ID:
-            result = emberAfBasicClusterServerCommandParse(cmd);
+            // No commands are enabled for cluster Basic
+            result = status(false, true, cmd->mfgSpecific);
             break;
         case ZCL_COLOR_CONTROL_CLUSTER_ID:
             result = emberAfColorControlClusterServerCommandParse(cmd);
@@ -187,26 +188,6 @@ EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterComma
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
-EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
-            wasHandled = emberAfBasicClusterResetToFactoryDefaultsCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
index 01fb095..887dabe 100644 (file)
@@ -1435,12 +1435,6 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(uint8_t perce
 bool emberAfBarrierControlClusterBarrierControlStopCallback();
 
 /**
- * @brief Basic Cluster ResetToFactoryDefaults Command callback
- */
-
-bool emberAfBasicClusterResetToFactoryDefaultsCallback();
-
-/**
  * @brief Color Control Cluster MoveColor Command callback
  * @param rateX
  * @param rateY
index c4f2f0a..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
index 2069290..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
index 655425d..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
index 2f2e27f..5e0cee0 100644 (file)
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
         /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ /* 32 */ 0x00, 0x00, 0x00, 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                  \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ /* 64 */ 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ /* 96 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ /* 112 */ 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00,                                                                                                      \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ /* 176 */ 0x00, 0x00, \
+            0x00, 0x00, /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ /* 180 */ 0x00, \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                                    \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ /* 244 */ 0x00, 0x00, \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
-            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                              \
-            /* Default for cluster: "Color Control", attribute: "compensation text". side: server, big-endian */ /* 254 */         \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            /* Default for cluster: "Color Control", attribute: "compensation text". side: server, big-endian */ /* 498 */         \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                        \
-            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, big-endian */ /* 262 */ 0x00, 0x00,    \
+            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, big-endian */ /* 506 */ 0x00, 0x00,    \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                      \
-            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, big-endian */ /* 294 */           \
+            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, big-endian */ /* 538 */           \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
             0x00, /* Default for cluster: "Application Basic", attribute: "application name". side: server, big-endian */          \
-            /* 326 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            /* 570 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
             0x00, /* Default for cluster: "Application Basic", attribute: "application id". side: server, big-endian */            \
     }
 #define GENERATED_DEFAULTS                                                                                                         \
     {                                                                                                                              \
         /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ /* 32 */ 0x00, 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ /* 64 */ 0x00, 0x00, 0x00,   \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                            \
+            /* Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ /* 96 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
+            /* Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ /* 112 */ 0x00, 0x00, 0x00,     \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ /* 176 */          \
+            0x00, 0x00, 0x00, 0x00,                                                                                                \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ /* 180 */ 0x00, 0x00,    \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
+            0x00, 0x00, 0x00, 0x00, 0x00,                                                                                          \
+            /* Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ /* 244 */          \
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                                                    \
             0x00, /* Default for cluster: "Color Control", attribute: "compensation text". side: server, little-endian */          \
-            /* 254 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                              \
-            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, little-endian */ /* 262 */ 0x00, 0x00, \
+            /* 498 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                              \
+            /* Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, little-endian */ /* 506 */ 0x00, 0x00, \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                      \
-            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, little-endian */ /* 294 */        \
+            /* Default for cluster: "Application Basic", attribute: "vendor name". side: server, little-endian */ /* 538 */        \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                \
             0x00, /* Default for cluster: "Application Basic", attribute: "application name". side: server, little-endian */       \
-            /* 326 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
+            /* 570 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  \
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                          \
             0x00, /* Default for cluster: "Application Basic", attribute: "application id". side: server, little-endian */         \
     }
 
 #endif // BIGENDIAN_CPU
 
-#define GENERATED_DEFAULTS_COUNT (5)
+#define GENERATED_DEFAULTS_COUNT (12)
 
 #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
 #define ZAP_LONG_DEFAULTS_INDEX(index)                                                                                             \
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 102
+#define GENERATED_ATTRIBUTE_COUNT 111
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
-        { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 } }, /* Basic (server): cluster revision */  \
-            { 0x0000, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x08 } }, /* Basic (server): ZCL version */ \
-            {                                                                                                                      \
-                0x0007, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                    \
-            },                                                     /* Basic (server): power source */                              \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } }, /* Identify (server): cluster revision */                       \
+        { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 2 } }, /* Identify (server): cluster revision */                           \
             {                                                                                                                      \
                 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) 0x0000 }                                  \
             },                                                          /* Identify (server): identify time */                     \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },      /* Level Control (server): cluster revision */             \
             { 0x0000, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0x00 } },    /* Level Control (server): current level */                \
             {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }                                      \
+            }, /* Basic (server): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 }                                      \
+            }, /* Basic (server): InteractionModelVersion */                                                                       \
+            {                                                                                                                      \
+                0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }       \
+            },                                                                                 /* Basic (server): VendorName */    \
+            { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): VendorID */      \
+            {                                                                                                                      \
+                0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(32) }      \
+            },                                                                                 /* Basic (server): ProductName */   \
+            { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0 } }, /* Basic (server): ProductID */     \
+            { 0x0005,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              32,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(64) } }, /* Basic (server): UserLabel */                                       \
+            { 0x0006,                                                                                                              \
+              ZAP_TYPE(CHAR_STRING),                                                                                               \
+              16,                                                                                                                  \
+              ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE),                                                        \
+              { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(96) } }, /* Basic (server): Location */                                        \
+            {                                                                                                                      \
+                0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 0x00 }                                   \
+            }, /* Basic (server): HardwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(112) }     \
+            }, /* Basic (server): HardwareVersionString */                                                                         \
+            {                                                                                                                      \
+                0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(176) }           \
+            }, /* Basic (server): SoftwareVersion */                                                                               \
+            {                                                                                                                      \
+                0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(180) }     \
+            }, /* Basic (server): SoftwareVersionString */                                                                         \
+            {                                                                                                                      \
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 }                                         \
             },                                                      /* Door Lock (client): cluster revision */                     \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 3 } },  /* Door Lock (server): cluster revision */                     \
             { 0x0004, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x607D } }, /* Color Control (server): current y */                    \
             { 0x0005, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0 } },       /* Color Control (server): drift compensation */           \
             {                                                                                                                      \
-                0x0006, ZAP_TYPE(CHAR_STRING), 254, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(0) }                                  \
+                0x0006, ZAP_TYPE(CHAR_STRING), 254, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(244) }                                \
             },                                                          /* Color Control (server): compensation text */            \
             { 0x0007, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x00FA } }, /* Color Control (server): color temperature */            \
             { 0x0008, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0x01 } },    /* Color Control (server): color mode */                   \
             { 0x0001, ZAP_TYPE(ENUM16), 2, 0, { (uint8_t *) 0 } },      /* IAS Zone (server): zone type */                         \
             { 0x0002, ZAP_TYPE(BITMAP16), 2, 0, { (uint8_t *) 0x0000 } }, /* IAS Zone (server): zone status */                     \
             {                                                                                                                      \
-                0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(254) }      \
+                0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(498) }      \
             },                                                          /* IAS Zone (server): IAS CIE address */                   \
             { 0x0011, ZAP_TYPE(INT8U), 1, 0, { (uint8_t *) 0xff } },    /* IAS Zone (server): Zone ID */                           \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Low Power (server): cluster revision */                 \
+            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Application Basic (server): cluster revision */         \
             {                                                                                                                      \
-                0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(262) }                                \
+                0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(506) }                                \
             },                                                     /* Application Basic (server): vendor name */                   \
             { 0x0001, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } }, /* Application Basic (server): vendor id */                     \
             {                                                                                                                      \
-                0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(294) }                                \
-            },                                                          /* Application Basic (server): application name */         \
-            { 0x0003, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Application Basic (server): product id */               \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Application Basic (server): cluster revision */         \
+                0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(538) }                                \
+            },                                                     /* Application Basic (server): application name */              \
+            { 0x0003, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } }, /* Application Basic (server): product id */                    \
             {                                                                                                                      \
-                0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(326) }                                \
+                0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, { (uint8_t *) ZAP_LONG_DEFAULTS_INDEX(570) }                                \
             },                                                          /* Application Basic (server): application id */           \
             { 0x0006, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Application Basic (server): catalog vendor id */        \
             { 0x0007, ZAP_TYPE(ENUM8), 1, 0, { (uint8_t *) 0x01 } },    /* Application Basic (server): application satus */        \
-            { 0x0000, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Media Playback (server): current state */               \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Media Playback (server): cluster revision */            \
+            { 0x0000, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0 } },      /* Media Playback (server): current state */               \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, { (uint8_t *) 0x0001 } }, /* Content Launch (server): cluster revision */            \
     }
 
 #define GENERATED_CLUSTER_COUNT 18
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, ZAP_ATTRIBUTE_INDEX(0), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 1, Cluster: Basic (server) */       \
-            { 0x0003,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(3),                                                                                              \
-              2,                                                                                                                   \
-              4,                                                                                                                   \
-              ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION),           \
-              chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */                                         \
+        { 0x0003,                                                                                                                  \
+          ZAP_ATTRIBUTE_INDEX(0),                                                                                                  \
+          2,                                                                                                                       \
+          4,                                                                                                                       \
+          ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION),               \
+          chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */                                             \
             { 0x0004,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(5),                                                                                              \
+              ZAP_ATTRIBUTE_INDEX(2),                                                                                              \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayGroupsServer }, /* Endpoint: 1, Cluster: Groups (server) */                                             \
             { 0x0005,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(7),                                                                                              \
+              ZAP_ATTRIBUTE_INDEX(4),                                                                                              \
               6,                                                                                                                   \
               8,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayScenesServer }, /* Endpoint: 1, Cluster: Scenes (server) */                                             \
             { 0x0006,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(13),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(10),                                                                                             \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/off (server) */                                              \
             { 0x0008,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(15),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(12),                                                                                             \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */                                \
             {                                                                                                                      \
-                0x0101, ZAP_ATTRIBUTE_INDEX(17), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
+                0x0028, ZAP_ATTRIBUTE_INDEX(14), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
+            }, /* Endpoint: 1, Cluster: Basic (server) */                                                                          \
+            {                                                                                                                      \
+                0x0101, ZAP_ATTRIBUTE_INDEX(26), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
             }, /* Endpoint: 1, Cluster: Door Lock (client) */                                                                      \
             { 0x0101,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(18),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(27),                                                                                             \
               4,                                                                                                                   \
               5,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION),                                             \
               chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */                                        \
             {                                                                                                                      \
-                0x0103, ZAP_ATTRIBUTE_INDEX(22), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
+                0x0103, ZAP_ATTRIBUTE_INDEX(31), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
             }, /* Endpoint: 1, Cluster: Barrier Control (client) */                                                                \
             {                                                                                                                      \
-                0x0103, ZAP_ATTRIBUTE_INDEX(23), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0x0103, ZAP_ATTRIBUTE_INDEX(32), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Barrier Control (server) */                                                                \
             {                                                                                                                      \
-                0x0300, ZAP_ATTRIBUTE_INDEX(28), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
+                0x0300, ZAP_ATTRIBUTE_INDEX(37), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
             }, /* Endpoint: 1, Cluster: Color Control (client) */                                                                  \
             { 0x0300,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(29),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(38),                                                                                             \
               51,                                                                                                                  \
               336,                                                                                                                 \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */                                \
             {                                                                                                                      \
-                0x0402, ZAP_ATTRIBUTE_INDEX(80), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0x0402, ZAP_ATTRIBUTE_INDEX(89), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */                                                        \
             { 0x0500,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(84),                                                                                             \
+              ZAP_ATTRIBUTE_INDEX(93),                                                                                             \
               6,                                                                                                                   \
               16,                                                                                                                  \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) |      \
                   ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION),                                                                         \
               chipFuncArrayIasZoneServer }, /* Endpoint: 1, Cluster: IAS Zone (server) */                                          \
             {                                                                                                                      \
-                0x0508, ZAP_ATTRIBUTE_INDEX(90), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0x0508, ZAP_ATTRIBUTE_INDEX(99), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
             }, /* Endpoint: 1, Cluster: Low Power (server) */                                                                      \
             {                                                                                                                      \
-                0x050D, ZAP_ATTRIBUTE_INDEX(91), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL                                            \
+                0x050D, ZAP_ATTRIBUTE_INDEX(100), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
             }, /* Endpoint: 1, Cluster: Application Basic (server) */                                                              \
             {                                                                                                                      \
-                0xF001, ZAP_ATTRIBUTE_INDEX(99), 2, 4, ZAP_CLUSTER_MASK(SERVER), NULL                                              \
+                0xF001, ZAP_ATTRIBUTE_INDEX(108), 2, 4, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
             }, /* Endpoint: 1, Cluster: Media Playback (server) */                                                                 \
             {                                                                                                                      \
-                0xF002, ZAP_ATTRIBUTE_INDEX(101), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
+                0xF002, ZAP_ATTRIBUTE_INDEX(110), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
             }, /* Endpoint: 1, Cluster: Content Launch (server) */                                                                 \
     }
 
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 18, 516 },                                                                                         \
+        { ZAP_CLUSTER_INDEX(0), 18, 766 },                                                                                         \
     }
 
 // Largest attribute size is needed for various buffers
 #define ATTRIBUTE_LARGEST (254)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (4)
+#define ATTRIBUTE_SINGLETONS_SIZE (254)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (516)
+#define ATTRIBUTE_MAX_SIZE (766)
 
 // 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 (139)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (141)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, 0x00,                                                                                                            \
-          ZAP_COMMAND_MASK(INCOMING_SERVER) | ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* Basic (server): ResetToFactoryDefaults */    \
-            { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },                   /* Identify (server): Identify */               \
-            { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) },                   /* Identify (server): IdentifyQueryResponse */  \
-            { 0x0003, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) },                   /* Identify (server): IdentifyQuery */          \
-            { 0x0004, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },                   /* Groups (server): AddGroup */                 \
-            { 0x0004, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) },                   /* Groups (server): AddGroupResponse */         \
-            { 0x0004, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) },                   /* Groups (server): ViewGroup */                \
-            { 0x0004, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) },                   /* Groups (server): ViewGroupResponse */        \
-            { 0x0004, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) },                   /* Groups (server): GetGroupMembership */       \
+        { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (server): Identify */                                 \
+            { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Identify (server): IdentifyQueryResponse */                    \
+            { 0x0003, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (server): IdentifyQuery */                            \
+            { 0x0004, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Groups (server): AddGroup */                                   \
+            { 0x0004, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Groups (server): AddGroupResponse */                           \
+            { 0x0004, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Groups (server): ViewGroup */                                  \
+            { 0x0004, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Groups (server): ViewGroupResponse */                          \
+            { 0x0004, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Groups (server): GetGroupMembership */                         \
             { 0x0004, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Groups (server): GetGroupMembershipResponse */                 \
             { 0x0004, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Groups (server): RemoveGroup */                                \
             { 0x0004, 0x03, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Groups (server): RemoveGroupResponse */                        \
             { 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): MoveWithOnOff */                       \
             { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StepWithOnOff */                       \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StopWithOnOff */                       \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */                                       \
             { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (client): LockDoor */                                \
             { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Door Lock (client): LockDoorResponse */                        \
             { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (server): LockDoor */                                \
index 1ea3151..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
index 0b35602..af07b1a 100644 (file)
       "clusters": [
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "commands": [
-            {
-              "name": "ResetToFactoryDefaults",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
-          ],
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
         },
         {
           "name": "Basic",
-          "code": 0,
+          "code": 40,
           "mfgCode": null,
           "define": "BASIC_CLUSTER",
           "side": "server",
           "enabled": 1,
-          "commands": [],
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "reportableChange": 0
             },
             {
-              "name": "ZCL version",
+              "name": "InteractionModelVersion",
               "code": 0,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 1,
               "bounded": 0,
-              "defaultValue": "0x08",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "power source",
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
               "code": 7,
               "mfgCode": null,
               "side": "server",
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             }
           ]
         },
       "networkId": 1
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/scripts/examples/esp_echo_app.sh b/scripts/examples/esp_echo_app.sh
deleted file mode 100755 (executable)
index 344d130..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-
-#
-#    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.
-#
-
-set -x
-env
-
-root=examples/all-clusters-app/esp32/
-
-# shellcheck source=/dev/null
-source "$root"/idf.sh
-
-rm -f "$root"/sdkconfig
-SDKCONFIG_DEFAULTS=sdkconfig_devkit.defaults idf make -j8 -C "$root" defconfig "$@"
-idf make -j8 -C "$root" "$@" || {
-    echo 'build DevKit-C failed'
-    exit 1
-}
-
-rm -f "$root"/sdkconfig
-SDKCONFIG_DEFAULTS=sdkconfig_m5stack.defaults idf make -j8 -C "$root" defconfig "$@"
-idf make -j8 -C "$root" "$@" || {
-    echo 'build M5Stack failed'
-    exit 1
-}
diff --git a/scripts/setup/install_packages.sh b/scripts/setup/install_packages.sh
deleted file mode 100755 (executable)
index ed41958..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-
-#
-#    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.
-#
-
-set -x
-env
diff --git a/scripts/setup/nrfconnect/update_ncs.py b/scripts/setup/nrfconnect/update_ncs.py
new file mode 100755 (executable)
index 0000000..fdd2998
--- /dev/null
@@ -0,0 +1,114 @@
+#!/usr/bin/env python3
+
+#
+# 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.
+#
+
+import argparse
+import os
+import subprocess
+import sys
+
+def get_repository_commit_sha(repository_location):
+    command = ['git', '-C', repository_location, 'rev-parse', 'HEAD']
+    process = subprocess.run(command, check=True, stdout=subprocess.PIPE)
+    return process.stdout.decode('ascii').strip()
+
+def update_ncs(repository_location, revision):
+    # Fetch sdk-nrf to the desired revision.
+    command = ['git', '-C', repository_location, 'fetch']
+    subprocess.run(command, check=True)
+
+    # Checkout sdk-nrf to the desired revision.
+    command = ['git', '-C', repository_location, 'checkout', revision]
+    subprocess.run(command, check=True)
+
+    # Call west update command to update all projects and submodules used by sdk-nrf.
+    command = ['west', 'update', '-r']
+    subprocess.run(command, check=True)
+
+def get_ncs_recommended_revision():
+    chip_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.normpath('../../..')))
+
+    # Read recommended revision saved in the .nrfconnect-recommended-revision file.
+    try:
+        with open(os.path.join(chip_root, 'config/nrfconnect/.nrfconnect-recommended-revision'), 'r') as f:
+            return f.readline().strip()
+    except:
+        raise RuntimeError("Encountered problem when trying to read .nrfconnect-recommended-revision file.")
+
+def print_messages(messages : list, yellow_text :  bool):
+    # Add colour formatting if yellow text was set
+    if yellow_text:
+        messages = [f"\33[33m{message}\x1b[0m" for message in messages]
+
+    for message in messages:
+        print(message)
+
+def print_check_revision_warning_message(current_revision, recommended_revision):
+    current_revision_message = f"WARNING: Your current NCS revision ({current_revision})"
+    recommended_revision_message = f"differs from the recommended ({recommended_revision})."
+    allowed_message = "Please be aware that it may lead to encountering unexpected problems."
+    update_message = "Consider updating NCS to the recommended revision, by calling:"
+    call_command_message = os.path.abspath(__file__) + " --update"
+
+    # Get the longest message lenght, to fit warning frame size.
+    longest_message_len = max([len(current_revision_message), len(recommended_revision_message), len(allowed_message), len(update_message), len(call_command_message)])
+
+    # To keep right frame shape the space characters are added to messages shorter than the longest one.
+    fmt = "# {:<%s}#" % (longest_message_len)
+
+    print_messages([(longest_message_len+3)*'#', fmt.format(current_revision_message), fmt.format(recommended_revision_message), fmt.format(''),
+                    fmt.format(allowed_message), fmt.format(update_message), fmt.format(call_command_message), (longest_message_len+3)*'#'], sys.stdout.isatty())
+
+def main():
+
+    try:
+        zephyr_base = os.getenv("ZEPHYR_BASE")
+        if not zephyr_base:
+            raise RuntimeError("No ZEPHYR_BASE environment variable found, please set ZEPHYR_BASE to a zephyr repository path.")
+
+        parser = argparse.ArgumentParser(description='Script helping to update nRF Connect SDK to currently recommended revision.')
+        parser.add_argument("-c", "--check", help="Check if your current nRF Connect SDK revision is the same as recommended one.", action="store_true")
+        parser.add_argument("-u", "--update", help="Update your nRF Connect SDK to currently recommended revision.", action="store_true")
+        parser.add_argument("-q", "--quiet", help="Don't print any message if the check succeeds.", action="store_true")
+        args = parser.parse_args()
+
+        ncs_base = os.path.join(zephyr_base, '../nrf')
+        recommended_revision = get_ncs_recommended_revision()
+
+        if args.check:
+            if not args.quiet:
+                print("Checking current nRF Connect SDK revision...")
+
+            current_revision = get_repository_commit_sha(ncs_base)
+
+            if current_revision != recommended_revision:
+                print_check_revision_warning_message(current_revision, recommended_revision)
+                sys.exit(1)
+
+            if not args.quiet:
+                print("Your current version is up to date with the recommended one.")
+
+        if args.update:
+            print("Updating nRF Connect SDK to recommended revision...")
+            update_ncs(ncs_base, recommended_revision)
+
+    except (RuntimeError, subprocess.CalledProcessError) as e:
+        print(e)
+        sys.exit(1)
+
+if __name__ == '__main__':
+    main()
diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/EnterWifiNetworkFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/EnterWifiNetworkFragment.kt
deleted file mode 100644 (file)
index 1c0f38a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.google.chip.chiptool.provisioning
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.Toast
-import androidx.fragment.app.Fragment
-import com.google.chip.chiptool.ChipClient
-import com.google.chip.chiptool.R
-import kotlinx.android.synthetic.main.enter_wifi_network_fragment.*
-import kotlinx.android.synthetic.main.enter_wifi_network_fragment.view.*
-
-class EnterWifiNetworkFragment : Fragment() {
-
-  override fun onCreateView(
-      inflater: LayoutInflater,
-      container: ViewGroup?,
-      savedInstanceState: Bundle?
-  ): View {
-    return inflater.inflate(R.layout.enter_wifi_network_fragment, container, false).apply {
-      saveNetworkBtn.setOnClickListener { onSaveNetworkClicked() }
-    }
-  }
-
-  private fun onSaveNetworkClicked() {
-    val ssid = ssidEd.text
-    val pwd = pwdEd.text
-
-    if (ssid.isNullOrBlank() || pwd.isNullOrBlank()) {
-      Toast.makeText(requireContext(), "Ssid and password required.", Toast.LENGTH_SHORT).show()
-      return
-    }
-
-    ChipClient.getDeviceController().apply {
-      sendWiFiCredentials(ssid.toString(), pwd.toString())
-    }
-  }
-
-  companion object {
-    fun newInstance() = EnterWifiNetworkFragment()
-  }
-
-}
\ No newline at end of file
index 1109996..432e39b 100644 (file)
@@ -152,18 +152,10 @@ chip::TLV::TLVWriter & Command::CreateCommandDataElementTLVWriter()
     return mCommandDataWriter;
 }
 
-CHIP_ERROR Command::AddCommand(chip::EndpointId aEndpintId, chip::GroupId aGroupId, chip::ClusterId aClusterId,
-                               chip::CommandId aCommandId, uint8_t aFlags)
+CHIP_ERROR Command::AddCommand(chip::EndpointId aEndpointId, chip::GroupId aGroupId, chip::ClusterId aClusterId,
+                               chip::CommandId aCommandId, BitFlags<CommandPathFlags> aFlags)
 {
-    CommandParams commandParams;
-
-    memset(&commandParams, 0, sizeof(CommandParams));
-
-    commandParams.EndpointId = aEndpintId;
-    commandParams.GroupId    = aGroupId;
-    commandParams.ClusterId  = aClusterId;
-    commandParams.CommandId  = aCommandId;
-    commandParams.Flags      = aFlags;
+    CommandParams commandParams(aEndpointId, aGroupId, aClusterId, aCommandId, aFlags);
 
     return AddCommand(commandParams);
 }
@@ -191,12 +183,12 @@ CHIP_ERROR Command::AddCommand(CommandParams & aCommandParams)
         CommandDataElement::Builder commandDataElement =
             mInvokeCommandBuilder.GetCommandListBuilder().CreateCommandDataElementBuilder();
         CommandPath::Builder commandPath = commandDataElement.CreateCommandPathBuilder();
-        if (aCommandParams.Flags & kCommandPathFlag_EndpointIdValid)
+        if (aCommandParams.Flags.Has(CommandPathFlags::kEndpointIdValid))
         {
             commandPath.EndpointId(aCommandParams.EndpointId);
         }
 
-        if (aCommandParams.Flags & kCommandPathFlag_GroupIdValid)
+        if (aCommandParams.Flags.Has(CommandPathFlags::kGroupIdValid))
         {
             commandPath.GroupId(aCommandParams.GroupId);
         }
index 19ebc7d..5103e05 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    All rights reserved.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,6 +29,7 @@
 #include <messaging/ExchangeMgr.h>
 #include <messaging/Flags.h>
 #include <protocols/Protocols.h>
+#include <support/BitFlags.h>
 #include <support/CodeUtils.h>
 #include <support/DLLUtil.h>
 #include <support/logging/CHIPLogging.h>
@@ -59,25 +60,31 @@ public:
         Sending,           //< The invoke command message  has sent out the invoke command
     };
 
+    enum class CommandPathFlags : uint8_t
+    {
+        kEndpointIdValid = 0x01, /**< Set when the EndpointId field is valid */
+        kGroupIdValid    = 0x02, /**< Set when the GroupId field is valid */
+    };
+
     /**
      * Encapsulates arguments to be passed into SendCommand().
      *
      */
     struct CommandParams
     {
+        CommandParams(chip::EndpointId endpointId, chip::GroupId groupId, chip::ClusterId clusterId, chip::CommandId commandId,
+                      const BitFlags<CommandPathFlags> & flags) :
+            EndpointId(endpointId),
+            GroupId(groupId), ClusterId(clusterId), CommandId(commandId), Flags(flags)
+        {}
+
         chip::EndpointId EndpointId;
         chip::GroupId GroupId;
         chip::ClusterId ClusterId;
         chip::CommandId CommandId;
-        uint8_t Flags;
+        BitFlags<CommandPathFlags> Flags;
     };
 
-    enum CommandPathFlags
-    {
-        kCommandPathFlag_EndpointIdValid = 0x0001, /**< Set when the EndpointId field is valid */
-        kCommandPathFlag_GroupIdValid    = 0x0002, /**< Set when the GroupId field is valid */
-    } CommandPathFlags;
-
     /**
      *  Initialize the Command object. Within the lifetime
      *  of this instance, this method is invoked once after object
@@ -110,7 +117,7 @@ public:
 
     chip::TLV::TLVWriter & CreateCommandDataElementTLVWriter();
     CHIP_ERROR AddCommand(chip::EndpointId aEndpintId, chip::GroupId aGroupId, chip::ClusterId aClusterId,
-                          chip::CommandId aCommandId, uint8_t Flags);
+                          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,
                              const chip::ClusterId aClusterId);
diff --git a/src/app/MessageDef.cpp b/src/app/MessageDef.cpp
deleted file mode 100644 (file)
index 7c5f7cd..0000000
+++ /dev/null
@@ -1,3505 +0,0 @@
-/**
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2018 Google LLC.
- *    Copyright (c) 2016-2017 Nest Labs, Inc.
- *    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.
- */
-/**
- *    @file
- *      This file defines CHIP interaction model message parsers and encoders
- *      Interaction model profile.
- *
- */
-
-// __STDC_FORMAT_MACROS must be defined for PRIX64 to be defined for pre-C++11 clib
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif // __STDC_FORMAT_MACROS
-
-// __STDC_LIMIT_MACROS must be defined for UINT8_MAX and INT32_MAX to be defined for pre-C++11 clib
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS
-#endif // __STDC_LIMIT_MACROS
-
-// __STDC_CONSTANT_MACROS must be defined for INT64_C and UINT64_C to be defined for pre-C++11 clib
-#ifndef __STDC_CONSTANT_MACROS
-#define __STDC_CONSTANT_MACROS
-#endif // __STDC_CONSTANT_MACROS
-
-#include "MessageDef.h"
-#include <algorithm>
-#include <inttypes.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-using namespace chip;
-using namespace chip::TLV;
-
-#ifndef CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-#define CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK 1
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-namespace chip {
-namespace app {
-
-#if CHIP_DETAIL_LOGGING
-
-namespace {
-// this is used to run in signle thread for IM message debug purpose
-uint32_t gPrettyPrintingDepthLevel = 0;
-char gLineBuffer[256];
-size_t gCurLineBufferSize = 0;
-} // namespace
-
-class PrettyPrintCheckpoint
-{
-public:
-    PrettyPrintCheckpoint() { mLevel = gPrettyPrintingDepthLevel; }
-    ~PrettyPrintCheckpoint() { gPrettyPrintingDepthLevel = mLevel; }
-
-private:
-    uint32_t mLevel;
-};
-#define PRETTY_PRINT_CHECKPOINT() PrettyPrintCheckpoint lPrettyPrintCheckpoint;
-
-#define PRETTY_PRINT(fmt, ...)                                                                                                     \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        PrettyPrintIM(true, fmt, ##__VA_ARGS__);                                                                                   \
-    } while (0)
-#define PRETTY_PRINT_SAMELINE(fmt, ...)                                                                                            \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        PrettyPrintIM(false, fmt, ##__VA_ARGS__);                                                                                  \
-    } while (0)
-#define PRETTY_PRINT_INCDEPTH()                                                                                                    \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        gPrettyPrintingDepthLevel++;                                                                                               \
-    } while (0)
-#define PRETTY_PRINT_DECDEPTH()                                                                                                    \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        gPrettyPrintingDepthLevel--;                                                                                               \
-    } while (0)
-
-static void PrettyPrintIM(bool aIsNewLine, const char * aFmt, ...)
-{
-    va_list args;
-    size_t ret;
-    size_t sizeLeft;
-
-    va_start(args, aFmt);
-
-    if (aIsNewLine)
-    {
-        if (gCurLineBufferSize)
-        {
-            // Don't need to explicitly NULL-terminate the string because
-            // snprintf takes care of that.
-            ChipLogDetail(DataManagement, "%s", gLineBuffer);
-            gCurLineBufferSize = 0;
-        }
-
-        for (uint32_t i = 0; i < gPrettyPrintingDepthLevel; i++)
-        {
-            if (sizeof(gLineBuffer) > gCurLineBufferSize)
-            {
-                sizeLeft = sizeof(gLineBuffer) - gCurLineBufferSize;
-                ret      = (size_t)(snprintf(gLineBuffer + gCurLineBufferSize, sizeLeft, "\t"));
-                if (ret > 0)
-                {
-                    gCurLineBufferSize += std::min(ret, sizeLeft);
-                }
-            }
-        }
-    }
-
-    if (sizeof(gLineBuffer) > gCurLineBufferSize)
-    {
-        sizeLeft = sizeof(gLineBuffer) - gCurLineBufferSize;
-        ret      = (size_t)(vsnprintf(gLineBuffer + gCurLineBufferSize, sizeLeft, aFmt, args));
-        if (ret > 0)
-        {
-            gCurLineBufferSize += std::min(ret, sizeLeft);
-        }
-    }
-
-    va_end(args);
-}
-#else // CHIP_DETAIL_LOGGING
-#define PRETTY_PRINT_CHECKPOINT()
-#define PRETTY_PRINT(fmt, ...)
-#define PRETTY_PRINT(fmt, ...)
-#define PRETTY_PRINT_INCDEPTH()
-#define PRETTY_PRINT_DECDEPTH()
-#endif // CHIP_DETAIL_LOGGING
-
-Parser::Parser() : mOuterContainerType(chip::TLV::kTLVType_NotSpecified) {}
-
-void Parser::Init(const chip::TLV::TLVReader & aReader, chip::TLV::TLVType aOuterContainerType)
-{
-    mReader.Init(aReader);
-    mOuterContainerType = aOuterContainerType;
-}
-
-CHIP_ERROR Parser::GetReaderOnTag(const uint64_t aTagToFind, chip::TLV::TLVReader * const apReader) const
-{
-    return mReader.FindElementWithTag(aTagToFind, *apReader);
-}
-
-template <typename T>
-CHIP_ERROR Parser::GetUnsignedInteger(const uint8_t aContextTag, T * const apLValue) const
-{
-    return GetSimpleValue(aContextTag, chip::TLV::kTLVType_UnsignedInteger, apLValue);
-}
-
-template <typename T>
-CHIP_ERROR Parser::GetSimpleValue(const uint8_t aContextTag, const chip::TLV::TLVType aTLVType, T * const apLValue) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    *apLValue = 0;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(aContextTag), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(aTLVType == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = reader.Get(*apLValue);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-void Parser::GetReader(chip::TLV::TLVReader * const apReader)
-{
-    apReader->Init(mReader);
-}
-
-ListParser::ListParser() {}
-
-CHIP_ERROR ListParser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Array == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-CHIP_ERROR ListParser::InitIfPresent(const chip::TLV::TLVReader & aReader, const uint8_t aContextTagToFind)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(aContextTagToFind), reader);
-    SuccessOrExit(err);
-
-    err = Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR ListParser::Next()
-{
-    CHIP_ERROR err = mReader.Next();
-
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-Builder::Builder() : mError(CHIP_ERROR_INCORRECT_STATE), mpWriter(NULL), mOuterContainerType(chip::TLV::kTLVType_NotSpecified) {}
-
-void Builder::Init(chip::TLV::TLVWriter * const apWriter, chip::TLV::TLVType aOuterContainerType)
-{
-    mpWriter            = apWriter;
-    mOuterContainerType = aOuterContainerType;
-}
-
-void Builder::ResetError()
-{
-    ResetError(CHIP_NO_ERROR);
-}
-
-void Builder::ResetError(CHIP_ERROR aErr)
-{
-    mError              = aErr;
-    mOuterContainerType = chip::TLV::kTLVType_NotSpecified;
-}
-
-void Builder::EndOfContainer()
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->EndContainer(mOuterContainerType);
-    SuccessOrExit(mError);
-
-    // we've just closed properly
-    // mark it so we do not panic when the build object destructor is called
-    mOuterContainerType = chip::TLV::kTLVType_NotSpecified;
-
-exit:;
-}
-
-CHIP_ERROR Builder::InitAnonymousStructure(chip::TLV::TLVWriter * const apWriter)
-{
-    mpWriter            = apWriter;
-    mOuterContainerType = chip::TLV::kTLVType_NotSpecified;
-    mError              = mpWriter->StartContainer(chip::TLV::AnonymousTag, chip::TLV::kTLVType_Structure, mOuterContainerType);
-    ChipLogFunctError(mError);
-
-    return mError;
-}
-
-ListBuilder::ListBuilder() {}
-
-CHIP_ERROR ListBuilder::Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse)
-{
-    mpWriter = apWriter;
-    mError   = mpWriter->StartContainer(chip::TLV::ContextTag(aContextTagToUse), chip::TLV::kTLVType_Array, mOuterContainerType);
-    ChipLogFunctError(mError);
-
-    return mError;
-}
-
-CHIP_ERROR ListBuilder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    mpWriter = apWriter;
-    mError   = mpWriter->StartContainer(chip::TLV::AnonymousTag, chip::TLV::kTLVType_Array, mOuterContainerType);
-    ChipLogFunctError(mError);
-
-    return mError;
-}
-
-CHIP_ERROR AttributePath::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Path == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType dummyContainerType;
-    // enter into the Path
-    err = mReader.EnterContainer(dummyContainerType);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR AttributePath::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("AttributePath =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the Path reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-        switch (chip::TLV::TagNumFromTag(reader.GetTag()))
-        {
-        case kCsTag_NodeId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_NodeId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_NodeId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t nodeId;
-                reader.Get(nodeId);
-                PRETTY_PRINT("\tNodeId = 0x%" PRIx64 ",", nodeId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_EndpointId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_EndpointId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_EndpointId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                uint16_t endpointId;
-                reader.Get(endpointId);
-                PRETTY_PRINT("\tEndpointId = 0x%" PRIx16 ",", endpointId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_NamespacedClusterId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_NamespacedClusterId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_NamespacedClusterId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            if (chip::TLV::kTLVType_UnsignedInteger == reader.GetType())
-            {
-                chip::ClusterId namespacedClusterId;
-                reader.Get(namespacedClusterId);
-                PRETTY_PRINT("\tNamespacedClusterId = 0x%" PRIx32 ",", namespacedClusterId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_FieldId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_FieldId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_FieldId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                uint8_t fieldTag;
-                reader.Get(fieldTag);
-                PRETTY_PRINT("\tFieldTag = 0x%" PRIx8 ",", fieldTag);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_ListIndex:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_ListIndex)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_ListIndex);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            if (chip::TLV::kTLVType_UnsignedInteger == reader.GetType())
-            {
-                uint16_t listIndex;
-                reader.Get(listIndex);
-                PRETTY_PRINT("\tListIndex = 0x%" PRIx16 ",", listIndex);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        default:
-            ExitNow(err = CHIP_ERROR_INVALID_TLV_TAG);
-        }
-    }
-
-    PRETTY_PRINT("}");
-    PRETTY_PRINT("\t");
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        const uint16_t RequiredFields = (1 << kCsTag_EndpointId) | (1 << kCsTag_NamespacedClusterId);
-
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH;
-        }
-    }
-    SuccessOrExit(err);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR AttributePath::Parser::GetNodeId(chip::NodeId * const apNodeId) const
-{
-    return GetUnsignedInteger(kCsTag_NodeId, apNodeId);
-}
-
-CHIP_ERROR AttributePath::Parser::GetEndpointId(chip::EndpointId * const apEndpointId) const
-{
-    return GetUnsignedInteger(kCsTag_EndpointId, apEndpointId);
-}
-
-CHIP_ERROR AttributePath::Parser::GetNamespacedClusterId(chip::ClusterId * const apClusterId) const
-{
-    return GetUnsignedInteger(kCsTag_NamespacedClusterId, apClusterId);
-}
-
-CHIP_ERROR AttributePath::Parser::GetFieldId(uint8_t * const apFieldId) const
-{
-    return GetUnsignedInteger(kCsTag_FieldId, apFieldId);
-}
-
-CHIP_ERROR AttributePath::Parser::GetListIndex(uint16_t * const apListIndex) const
-{
-    return GetUnsignedInteger(kCsTag_ListIndex, apListIndex);
-}
-
-CHIP_ERROR AttributePath::Builder::_Init(chip::TLV::TLVWriter * const apWriter, const uint64_t aTag)
-{
-    mpWriter = apWriter;
-    mError   = mpWriter->StartContainer(aTag, chip::TLV::kTLVType_Path, mOuterContainerType);
-    SuccessOrExit(mError);
-
-exit:
-    ChipLogFunctError(mError);
-    return mError;
-}
-
-CHIP_ERROR AttributePath::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return _Init(apWriter, chip::TLV::AnonymousTag);
-}
-
-CHIP_ERROR AttributePath::Builder::Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse)
-{
-    return _Init(apWriter, chip::TLV::ContextTag(aContextTagToUse));
-}
-
-AttributePath::Builder & AttributePath::Builder::NodeId(const uint64_t aNodeId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_NodeId), aNodeId);
-    ChipLogFunctError(mError);
-
-exit:
-
-    return *this;
-}
-
-AttributePath::Builder & AttributePath::Builder::EndpointId(const chip::EndpointId aEndpointId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_EndpointId), aEndpointId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-AttributePath::Builder & AttributePath::Builder::NamespacedClusterId(const chip::ClusterId aClusterId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_NamespacedClusterId), aClusterId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-AttributePath::Builder & AttributePath::Builder::FieldId(const uint8_t aFieldId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_FieldId), aFieldId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-AttributePath::Builder & AttributePath::Builder::ListIndex(const uint16_t aListIndex)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_ListIndex), aListIndex);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-AttributePath::Builder & AttributePath::Builder::EndOfAttributePath()
-{
-    EndOfContainer();
-    return *this;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR AttributePathList::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    size_t NumPath = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("AttributePathList =");
-    PRETTY_PRINT("[");
-
-    // make a copy of the AttributePathList reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
-        VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-        {
-            AttributePath::Parser path;
-            err = path.Init(reader);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_INCDEPTH();
-            err = path.CheckSchemaValidity();
-            SuccessOrExit(err);
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        ++NumPath;
-    }
-
-    PRETTY_PRINT("],");
-    PRETTY_PRINT("\t");
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        err = CHIP_NO_ERROR;
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-// Re-initialize the shared PathBuilder with anonymous tag
-AttributePath::Builder & AttributePathList::Builder::CreateAttributePathBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributePathBuilder.ResetError(mError));
-
-    mError = mAttributePathBuilder.Init(mpWriter);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mAttributePathBuilder would be un-/partial initialized and cannot be used to write anything
-    return mAttributePathBuilder;
-}
-
-// Mark the end of this array and recover the type for outer container
-AttributePathList::Builder & AttributePathList::Builder::EndOfAttributePathList()
-{
-    EndOfContainer();
-
-    return *this;
-}
-
-CHIP_ERROR EventPath::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Path == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType dummyContainerType;
-    // enter into the Path
-    err = mReader.EnterContainer(dummyContainerType);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR EventPath::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("EventPath =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the Path reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-        switch (chip::TLV::TagNumFromTag(reader.GetTag()))
-        {
-        case kCsTag_NodeId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_NodeId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_NodeId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t nodeId;
-                reader.Get(nodeId);
-                PRETTY_PRINT("\tNodeId = 0x%" PRIx64 ",", nodeId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_EndpointId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_EndpointId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_EndpointId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                uint16_t endpointId;
-                reader.Get(endpointId);
-                PRETTY_PRINT("\tEndpointId = 0x%" PRIx16 ",", endpointId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_NamespacedClusterId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_NamespacedClusterId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_NamespacedClusterId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                chip::ClusterId namespacedClusterId;
-                reader.Get(namespacedClusterId);
-                PRETTY_PRINT("\tNamespacedClusterId = 0x%" PRIx32 ",", namespacedClusterId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case chip::app::EventPath::kCsTag_EventId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << chip::app::EventPath::kCsTag_EventId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << chip::app::EventPath::kCsTag_EventId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                chip::EventId eventId;
-                reader.Get(eventId);
-                PRETTY_PRINT("\tEventId = 0x%" PRIx16 ",", eventId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        default:
-            ExitNow(err = CHIP_ERROR_INVALID_TLV_TAG);
-        }
-    }
-
-    PRETTY_PRINT("},");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        const uint16_t RequiredFields = (1 << kCsTag_EndpointId) | (1 << kCsTag_NamespacedClusterId);
-
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH;
-        }
-    }
-    SuccessOrExit(err);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR EventPath::Parser::GetNodeId(chip::NodeId * const apNodeId) const
-{
-    return GetUnsignedInteger(kCsTag_NodeId, apNodeId);
-}
-
-CHIP_ERROR EventPath::Parser::GetEndpointId(chip::EndpointId * const apEndpointID) const
-{
-    return GetUnsignedInteger(kCsTag_EndpointId, apEndpointID);
-}
-
-CHIP_ERROR EventPath::Parser::GetNamespacedClusterId(chip::ClusterId * const apClusterId) const
-{
-    return GetUnsignedInteger(kCsTag_NamespacedClusterId, apClusterId);
-}
-
-CHIP_ERROR EventPath::Parser::GetEventId(chip::EventId * const apEventId) const
-{
-    return GetUnsignedInteger(kCsTag_EventId, apEventId);
-}
-
-CHIP_ERROR EventPath::Builder::_Init(chip::TLV::TLVWriter * const apWriter, const uint64_t aTag)
-{
-    mpWriter = apWriter;
-    mError   = mpWriter->StartContainer(aTag, chip::TLV::kTLVType_Path, mOuterContainerType);
-    SuccessOrExit(mError);
-
-exit:
-    ChipLogFunctError(mError);
-    return mError;
-}
-
-CHIP_ERROR EventPath::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return _Init(apWriter, chip::TLV::AnonymousTag);
-}
-
-CHIP_ERROR EventPath::Builder::Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse)
-{
-    return _Init(apWriter, chip::TLV::ContextTag(aContextTagToUse));
-}
-
-EventPath::Builder & EventPath::Builder::NodeId(const uint64_t aNodeId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_NodeId), aNodeId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventPath::Builder & EventPath::Builder::EndpointId(const chip::EndpointId aEndpointId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_EndpointId), aEndpointId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventPath::Builder & EventPath::Builder::NamespacedClusterId(const chip::ClusterId aClusterId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_NamespacedClusterId), aClusterId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventPath::Builder & EventPath::Builder::EventId(const chip::EventId aEventId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_EventId), aEventId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventPath::Builder & EventPath::Builder::EndOfEventPath()
-{
-    EndOfContainer();
-    return *this;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR EventPathList::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    size_t NumPath = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("EventPathList =");
-    PRETTY_PRINT("[");
-
-    // make a copy of the EventPathList reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
-        VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-        {
-            EventPath::Parser path;
-            err = path.Init(reader);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_INCDEPTH();
-            err = path.CheckSchemaValidity();
-            SuccessOrExit(err);
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        ++NumPath;
-    }
-
-    PRETTY_PRINT("],");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        err = CHIP_NO_ERROR;
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-EventPath::Builder & EventPathList::Builder::CreateEventPathBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mEventPathBuilder.ResetError(mError));
-
-    mError = mEventPathBuilder.Init(mpWriter);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mPathBuilder would be un-/partial initialized and cannot be used to write anything
-    return mEventPathBuilder;
-}
-
-EventPathList::Builder & EventPathList::Builder::EndOfEventPathList()
-{
-    EndOfContainer();
-
-    return *this;
-}
-
-CHIP_ERROR CommandPath::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Path == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType dummyContainerType;
-    // enter into the Path
-    err = mReader.EnterContainer(dummyContainerType);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR CommandPath::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-    PRETTY_PRINT("CommandPath =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the Path reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-        switch (chip::TLV::TagNumFromTag(reader.GetTag()))
-        {
-        case kCsTag_EndpointId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_EndpointId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_EndpointId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint16_t endpointId;
-                reader.Get(endpointId);
-                PRETTY_PRINT("\tEndpointId = 0x%" PRIx16 ",", endpointId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_GroupId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_GroupId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_GroupId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                uint32_t groupId;
-                reader.Get(groupId);
-                PRETTY_PRINT("\tGroupId = 0x%" PRIx64 ",", groupId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_NamespacedClusterId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_NamespacedClusterId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_NamespacedClusterId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                chip::ClusterId namespacedClusterId;
-                reader.Get(namespacedClusterId);
-                PRETTY_PRINT("\tNamespacedClusterId = 0x%" PRIx32 ",", namespacedClusterId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_CommandId:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_CommandId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_CommandId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                chip::CommandId commandId;
-                reader.Get(commandId);
-                PRETTY_PRINT("\tCommandId = 0x%" PRIx16 ",", commandId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        default:
-            ExitNow(err = CHIP_ERROR_INVALID_TLV_TAG);
-        }
-    }
-    PRETTY_PRINT("},");
-    PRETTY_PRINT("");
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        const uint16_t RequiredFields = (1 << kCsTag_CommandId) | (1 << kCsTag_NamespacedClusterId);
-
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_COMMAND_PATH;
-        }
-    }
-    SuccessOrExit(err);
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR CommandPath::Parser::GetEndpointId(chip::EndpointId * const apEndpointID) const
-{
-    return GetUnsignedInteger(kCsTag_EndpointId, apEndpointID);
-}
-
-CHIP_ERROR CommandPath::Parser::GetGroupId(chip::GroupId * const apGroupId) const
-{
-    return GetUnsignedInteger(kCsTag_GroupId, apGroupId);
-}
-
-CHIP_ERROR CommandPath::Parser::GetNamespacedClusterId(chip::ClusterId * const apClusterId) const
-{
-    return GetUnsignedInteger(kCsTag_NamespacedClusterId, apClusterId);
-}
-
-CHIP_ERROR CommandPath::Parser::GetCommandId(chip::CommandId * const apCommandId) const
-{
-    return GetUnsignedInteger(kCsTag_CommandId, apCommandId);
-}
-
-CHIP_ERROR CommandPath::Builder::_Init(chip::TLV::TLVWriter * const apWriter, const uint64_t aTag)
-{
-    mpWriter = apWriter;
-    mError   = mpWriter->StartContainer(aTag, chip::TLV::kTLVType_Path, mOuterContainerType);
-    SuccessOrExit(mError);
-
-exit:
-    ChipLogFunctError(mError);
-    return mError;
-}
-
-CHIP_ERROR CommandPath::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return _Init(apWriter, chip::TLV::AnonymousTag);
-}
-
-CHIP_ERROR CommandPath::Builder::Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse)
-{
-    return _Init(apWriter, chip::TLV::ContextTag(aContextTagToUse));
-}
-
-CommandPath::Builder & CommandPath::Builder::EndpointId(const chip::EndpointId aEndpointId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_EndpointId), aEndpointId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-CommandPath::Builder & CommandPath::Builder::GroupId(const chip::GroupId aGroupId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_GroupId), aGroupId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-CommandPath::Builder & CommandPath::Builder::NamespacedClusterId(const chip::ClusterId aClusterId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_NamespacedClusterId), aClusterId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-CommandPath::Builder & CommandPath::Builder::CommandId(const chip::CommandId aCommandId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_CommandId), aCommandId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-CommandPath::Builder & CommandPath::Builder::EndOfCommandPath()
-{
-    EndOfContainer();
-    return *this;
-}
-
-CHIP_ERROR EventDataElement::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Structure == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-CHIP_ERROR
-EventDataElement::Parser::ParseData(chip::TLV::TLVReader & aReader, int aDepth) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    if (aDepth == 0)
-    {
-        PRETTY_PRINT("EventData = ");
-    }
-    else
-    {
-        if (chip::TLV::IsContextTag(aReader.GetTag()))
-        {
-            PRETTY_PRINT("0x%" PRIx32 " = ", chip::TLV::TagNumFromTag(aReader.GetTag()));
-        }
-        else if (chip::TLV::IsProfileTag(aReader.GetTag()))
-        {
-            PRETTY_PRINT("0x%" PRIx32 "::0x%" PRIx32 " = ", chip::TLV::ProfileIdFromTag(aReader.GetTag()),
-                         chip::TLV::TagNumFromTag(aReader.GetTag()));
-        }
-        else
-        {
-            // Anonymous tag, don't print anything
-        }
-    }
-
-    switch (aReader.GetType())
-    {
-    case chip::TLV::kTLVType_Structure:
-        PRETTY_PRINT("{");
-        break;
-
-    case chip::TLV::kTLVType_Array:
-        PRETTY_PRINT_SAMELINE("[");
-        PRETTY_PRINT("\t\t");
-        break;
-
-    case chip::TLV::kTLVType_SignedInteger: {
-        int64_t value_s64;
-
-        err = aReader.Get(value_s64);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%" PRId64 ", ", value_s64);
-        break;
-    }
-
-    case chip::TLV::kTLVType_UnsignedInteger: {
-        uint64_t value_u64;
-
-        err = aReader.Get(value_u64);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%" PRIu64 ", ", value_u64);
-        break;
-    }
-
-    case chip::TLV::kTLVType_Boolean: {
-        bool value_b;
-
-        err = aReader.Get(value_b);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%s, ", value_b ? "true" : "false");
-        break;
-    }
-
-    case chip::TLV::kTLVType_UTF8String: {
-        char value_s[256];
-
-        err = aReader.GetString(value_s, sizeof(value_s));
-        VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, );
-
-        if (err == CHIP_ERROR_BUFFER_TOO_SMALL)
-        {
-            PRETTY_PRINT_SAMELINE("... (byte string too long) ...");
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            PRETTY_PRINT_SAMELINE("\"%s\", ", value_s);
-        }
-        break;
-    }
-
-    case chip::TLV::kTLVType_ByteString: {
-        uint8_t value_b[256];
-        uint32_t len, readerLen;
-
-        readerLen = aReader.GetLength();
-
-        err = aReader.GetBytes(value_b, sizeof(value_b));
-        VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, );
-
-        PRETTY_PRINT_SAMELINE("[");
-        PRETTY_PRINT("\t\t");
-
-        if (readerLen < sizeof(value_b))
-        {
-            len = readerLen;
-        }
-        else
-        {
-            len = sizeof(value_b);
-        }
-
-        if (err == CHIP_ERROR_BUFFER_TOO_SMALL)
-        {
-            PRETTY_PRINT_SAMELINE("... (byte string too long) ...");
-        }
-        else
-        {
-            for (size_t i = 0; i < len; i++)
-            {
-                PRETTY_PRINT_SAMELINE("0x%" PRIx8 ", ", value_b[i]);
-            }
-        }
-
-        err = CHIP_NO_ERROR;
-        PRETTY_PRINT("\t\t]");
-        break;
-    }
-
-    case chip::TLV::kTLVType_Null:
-        PRETTY_PRINT_SAMELINE("NULL");
-        break;
-
-    default:
-        PRETTY_PRINT_SAMELINE("--");
-        break;
-    }
-
-    if (aReader.GetType() == chip::TLV::kTLVType_Structure || aReader.GetType() == chip::TLV::kTLVType_Array)
-    {
-        const char terminating_char = (aReader.GetType() == chip::TLV::kTLVType_Structure) ? '}' : ']';
-        chip::TLV::TLVType type;
-
-        IgnoreUnusedVariable(terminating_char);
-
-        err = aReader.EnterContainer(type);
-        SuccessOrExit(err);
-
-        while ((err = aReader.Next()) == CHIP_NO_ERROR)
-        {
-            PRETTY_PRINT_INCDEPTH();
-
-            err = ParseData(aReader, aDepth + 1);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        PRETTY_PRINT("%c,", terminating_char);
-
-        err = aReader.ExitContainer(type);
-        SuccessOrExit(err);
-    }
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR EventDataElement::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("EventDataElement =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the Path reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-        switch (chip::TLV::TagNumFromTag(reader.GetTag()))
-        {
-        case kCsTag_EventPath:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_EventPath)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_EventPath);
-
-            VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                EventPath::Parser path;
-                err = path.Init(reader);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = path.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_ImportanceLevel:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_ImportanceLevel)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_ImportanceLevel);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t value;
-                err = reader.Get(value);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tImportanceLevel = 0x%" PRIx64 ",", value);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_Number:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_Number)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_Number);
-
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t value;
-                err = reader.Get(value);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tNumber = 0x%" PRIx64 ",", value);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_UTCTimestamp:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_UTCTimestamp)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_UTCTimestamp);
-
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t value;
-                err = reader.Get(value);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tUTCTimestamp = 0x%" PRIx64 ",", value);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-
-        case kCsTag_SystemTimestamp:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_SystemTimestamp)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_SystemTimestamp);
-
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t value;
-                err = reader.Get(value);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tSystemTimestamp = 0x%" PRIx64 ",", value);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_DeltaUTCTimestamp:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_DeltaUTCTimestamp)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_DeltaUTCTimestamp);
-
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t value;
-                err = reader.Get(value);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tDeltaUTCTimestamp= 0x%" PRIx64 ",", value);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_DeltaSystemTimestamp:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_DeltaSystemTimestamp)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_DeltaSystemTimestamp);
-
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t value;
-                err = reader.Get(value);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tDeltaSystemTimestamp= 0x%" PRIx64 ",", value);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_Data:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_Data)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_Data);
-
-            PRETTY_PRINT_INCDEPTH();
-            err = ParseData(reader, 0);
-            SuccessOrExit(err);
-            PRETTY_PRINT_DECDEPTH();
-            break;
-        default:
-            ExitNow(err = CHIP_ERROR_INVALID_TLV_TAG);
-        }
-    }
-    PRETTY_PRINT("},");
-    PRETTY_PRINT("");
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        const uint16_t RequiredFields =
-            (1 << kCsTag_EventPath) | (1 << kCsTag_ImportanceLevel) | (1 << kCsTag_Number) | (1 << kCsTag_Data);
-
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_EVENT_DATA_ELEMENT;
-        }
-    }
-    SuccessOrExit(err);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR EventDataElement::Parser::GetEventPath(EventPath::Parser * const apEventPath)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_EventPath), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apEventPath->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR EventDataElement::Parser::GetImportanceLevel(uint8_t * const apImportanceLevel)
-{
-    return GetUnsignedInteger(kCsTag_ImportanceLevel, apImportanceLevel);
-}
-
-CHIP_ERROR EventDataElement::Parser::GetNumber(uint64_t * const apNumber)
-{
-    return GetUnsignedInteger(kCsTag_Number, apNumber);
-}
-
-CHIP_ERROR EventDataElement::Parser::GetUTCTimestamp(uint64_t * const apUTCTimestamp)
-{
-    return GetUnsignedInteger(kCsTag_UTCTimestamp, apUTCTimestamp);
-}
-
-CHIP_ERROR EventDataElement::Parser::GetSystemTimestamp(uint64_t * const apSystemTimestamp)
-{
-    return GetUnsignedInteger(kCsTag_SystemTimestamp, apSystemTimestamp);
-}
-
-CHIP_ERROR EventDataElement::Parser::GetDeltaUTCTime(uint64_t * const apDeltaUTCTimestamp)
-{
-    return GetUnsignedInteger(kCsTag_DeltaUTCTimestamp, apDeltaUTCTimestamp);
-}
-
-CHIP_ERROR EventDataElement::Parser::GetDeltaSystemTime(uint64_t * const apDeltaSystemTimestamp)
-{
-    return GetUnsignedInteger(kCsTag_DeltaSystemTimestamp, apDeltaSystemTimestamp);
-}
-
-CHIP_ERROR EventDataElement::Parser::GetData(chip::TLV::TLVReader * const apReader) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_Data), *apReader);
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-CHIP_ERROR EventDataElement::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return InitAnonymousStructure(apWriter);
-}
-
-EventPath::Builder & EventDataElement::Builder::CreateEventPathBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mEventPathBuilder.ResetError(mError));
-
-    mError = mEventPathBuilder.Init(mpWriter, kCsTag_EventPath);
-    ChipLogFunctError(mError);
-
-exit:
-    return mEventPathBuilder;
-}
-
-EventDataElement::Builder EventDataElement::Builder::ImportanceLevel(const uint8_t aImportanceLevel)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_ImportanceLevel), aImportanceLevel);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventDataElement::Builder EventDataElement::Builder::Number(const uint64_t aNumber)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_Number), aNumber);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventDataElement::Builder EventDataElement::Builder::UTCTimestamp(const uint64_t aUTCTimestamp)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_UTCTimestamp), aUTCTimestamp);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventDataElement::Builder EventDataElement::Builder::SystemTimestamp(const uint64_t aSystemTimestamp)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_SystemTimestamp), aSystemTimestamp);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventDataElement::Builder EventDataElement::Builder::DeltaUTCTime(const uint64_t aDeltaUTCTimestamp)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_DeltaUTCTimestamp), aDeltaUTCTimestamp);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-EventDataElement::Builder EventDataElement::Builder::DeltaSystemTime(const uint64_t aDeltaSystemTimestamp)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_DeltaSystemTimestamp), aDeltaSystemTimestamp);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-// Mark the end of this element and recover the type for outer container
-EventDataElement::Builder & EventDataElement::Builder::EndOfEventDataElement()
-{
-    EndOfContainer();
-    return *this;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR EventList::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err        = CHIP_NO_ERROR;
-    size_t NumDataElement = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("EventList =");
-    PRETTY_PRINT("[");
-
-    // make a copy of the EventList reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
-        VerifyOrExit(chip::TLV::kTLVType_Structure == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-        {
-            EventDataElement::Parser event;
-            err = event.Init(reader);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_INCDEPTH();
-            err = event.CheckSchemaValidity();
-            SuccessOrExit(err);
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        ++NumDataElement;
-    }
-
-    PRETTY_PRINT("],");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // if we have at least one data element
-        if (NumDataElement > 0)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        // NOTE: temporarily disable this check, to allow test to continue
-        else
-        {
-            ChipLogError(DataManagement, "PROTOCOL ERROR: Empty event list");
-            err = CHIP_NO_ERROR;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-EventDataElement::Builder & EventList::Builder::CreateEventBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mEventDataElementBuilder.ResetError(mError));
-
-    mError = mEventDataElementBuilder.Init(mpWriter);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mEventDataElementBuilder would be un-/partial initialized and cannot be used to write anything
-    return mEventDataElementBuilder;
-}
-
-EventList::Builder & EventList::Builder::EndOfEventList()
-{
-    EndOfContainer();
-    return *this;
-}
-
-CHIP_ERROR StatusElement::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-    VerifyOrExit(chip::TLV::kTLVType_Array == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-
-CHIP_ERROR StatusElement::Parser::DecodeStatusElement(uint16_t * apGeneralCode, uint32_t * apProtocolId, uint16_t * apProtocolCode,
-                                                      chip::ClusterId * apClusterId) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader lReader;
-
-    lReader.Init(mReader);
-
-    err = lReader.Next();
-    SuccessOrExit(err);
-    VerifyOrExit(lReader.GetType() == chip::TLV::kTLVType_UnsignedInteger, err = CHIP_ERROR_WRONG_TLV_TYPE);
-    err = lReader.Get(*apGeneralCode);
-    SuccessOrExit(err);
-
-    err = lReader.Next();
-    SuccessOrExit(err);
-    VerifyOrExit(lReader.GetType() == chip::TLV::kTLVType_UnsignedInteger, err = CHIP_ERROR_WRONG_TLV_TYPE);
-    err = lReader.Get(*apProtocolId);
-    SuccessOrExit(err);
-
-    err = lReader.Next();
-    SuccessOrExit(err);
-    VerifyOrExit(lReader.GetType() == chip::TLV::kTLVType_UnsignedInteger, err = CHIP_ERROR_WRONG_TLV_TYPE);
-    err = lReader.Get(*apProtocolCode);
-    SuccessOrExit(err);
-
-    err = lReader.Next();
-    SuccessOrExit(err);
-    VerifyOrExit(lReader.GetType() == chip::TLV::kTLVType_UnsignedInteger, err = CHIP_ERROR_WRONG_TLV_TYPE);
-    err = lReader.Get(*apClusterId);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR StatusElement::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("StatusElement =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        // This is an array; all elements are anonymous.
-        VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
-
-        if (!(TagPresenceMask & (1 << kCsTag_GeneralCode)))
-        {
-            TagPresenceMask |= (1 << kCsTag_GeneralCode);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint16_t generalCode;
-                err = reader.Get(generalCode);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tGeneralCode = 0x%" PRIx16 ",", generalCode);
-            }
-#endif // CHIP_DETAIL_LOGGING
-        }
-        else if (!(TagPresenceMask & (1 << kCsTag_ProtocolId)))
-        {
-            TagPresenceMask |= (1 << kCsTag_ProtocolId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint32_t kCsTag_ProtocolId;
-                err = reader.Get(kCsTag_ProtocolId);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tProtocolId = 0x%" PRIx32 ",", kCsTag_ProtocolId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-        }
-        else if (!(TagPresenceMask & (1 << kCsTag_ProtocolCode)))
-        {
-            TagPresenceMask |= (1 << kCsTag_ProtocolCode);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                uint16_t protocolCode;
-                err = reader.Get(protocolCode);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tprotocolCode = 0x%" PRIx16 ",", protocolCode);
-            }
-#endif // CHIP_DETAIL_LOGGING
-        }
-        else if (!(TagPresenceMask & (1 << kCsTag_NamespacedClusterId)))
-        {
-            TagPresenceMask |= (1 << kCsTag_NamespacedClusterId);
-
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                chip::ClusterId namespacedClusterId;
-                err = reader.Get(namespacedClusterId);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tNamespacedClusterId = 0x%" PRIx32 ",", namespacedClusterId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-        }
-        else
-        {
-            PRETTY_PRINT("\tExtra element in StatusElement");
-        }
-    }
-
-    PRETTY_PRINT("},");
-    PRETTY_PRINT("");
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        const uint16_t RequiredFields = (1 << kCsTag_GeneralCode) | (1 << kCsTag_ProtocolId) | (1 << kCsTag_ProtocolCode);
-
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_STATUS_CODE;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR StatusElement::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return ListBuilder::Init(apWriter);
-}
-
-CHIP_ERROR StatusElement::Builder::Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse)
-{
-    return ListBuilder::Init(apWriter, aContextTagToUse);
-}
-
-StatusElement::Builder & StatusElement::Builder::EncodeStatusElement(const uint16_t aGeneralCode, const uint32_t aProtocolId,
-                                                                     const uint16_t aStatusElement,
-                                                                     const chip::ClusterId aNamespacedClusterId)
-{
-    uint64_t tag = chip::TLV::AnonymousTag;
-
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(tag, aGeneralCode);
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(tag, aProtocolId);
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(tag, aStatusElement);
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(tag, aNamespacedClusterId);
-    SuccessOrExit(mError);
-
-exit:
-    ChipLogFunctError(mError);
-    return *this;
-}
-
-StatusElement::Builder & StatusElement::Builder::EndOfStatusElement()
-{
-    EndOfContainer();
-    return *this;
-}
-
-CHIP_ERROR AttributeStatusElement::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return InitAnonymousStructure(apWriter);
-}
-
-AttributePath::Builder & AttributeStatusElement::Builder::CreateAttributePathBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributePathBuilder.ResetError(mError));
-
-    mError = mAttributePathBuilder.Init(mpWriter, kCsTag_AttributePath);
-
-exit:
-    ChipLogFunctError(mError);
-    return mAttributePathBuilder;
-}
-
-StatusElement::Builder & AttributeStatusElement::Builder::CreateStatusElementBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mStatusElementBuilder.ResetError(mError));
-
-    mError = mStatusElementBuilder.Init(mpWriter, kCsTag_StatusElement);
-
-exit:
-    ChipLogFunctError(mError);
-    return mStatusElementBuilder;
-}
-
-AttributeStatusElement::Builder & AttributeStatusElement::Builder::EndOfAttributeStatusElement()
-{
-    EndOfContainer();
-    return *this;
-}
-
-CHIP_ERROR AttributeStatusElement::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-    VerifyOrExit(chip::TLV::kTLVType_Structure == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR AttributeStatusElement::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("AttributeStatusElement =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-        switch (chip::TLV::TagNumFromTag(reader.GetTag()))
-        {
-        case kCsTag_AttributePath:
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_AttributePath)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_AttributePath);
-            {
-                AttributePath::Parser path;
-                err = path.Init(reader);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = path.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-            break;
-        case kCsTag_StatusElement:
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_StatusElement)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_StatusElement);
-            {
-                StatusElement::Parser status;
-                err = status.Init(reader);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = status.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-            break;
-        default:
-            ExitNow(err = CHIP_ERROR_INVALID_TLV_TAG);
-        }
-    }
-
-    PRETTY_PRINT("},");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        const uint16_t RequiredFields = (1 << kCsTag_AttributePath) | (1 << kCsTag_StatusElement);
-
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_STATUS_ELEMENT;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR AttributeStatusElement::Parser::GetAttributePath(AttributePath::Parser * const apAttributePath) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_AttributePath), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apAttributePath->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR AttributeStatusElement::Parser::GetStatusElement(StatusElement::Parser * const apStatusElement) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_StatusElement), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apStatusElement->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-AttributeStatusElement::Builder & AttributeStatusList::Builder::CreateAttributeStatusBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributeStatusBuilder.ResetError(mError));
-
-    mError = mAttributeStatusBuilder.Init(mpWriter);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mAttributeStatusBuilder would be un-/partial initialized and cannot be used to write anything
-    return mAttributeStatusBuilder;
-}
-
-AttributeStatusList::Builder & AttributeStatusList::Builder::EndOfAttributeStatusList()
-{
-    EndOfContainer();
-    return *this;
-}
-
-CHIP_ERROR AttributeStatusList::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err                  = CHIP_NO_ERROR;
-    size_t NumAttributeStateElement = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("AttributeStatusList =");
-    PRETTY_PRINT("[");
-
-    // make a copy of the EventList reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
-        VerifyOrExit(chip::TLV::kTLVType_Structure == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-        {
-            AttributeStatusElement::Parser status;
-            err = status.Init(reader);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_INCDEPTH();
-            err = status.CheckSchemaValidity();
-            SuccessOrExit(err);
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        ++NumAttributeStateElement;
-    }
-
-    PRETTY_PRINT("],");
-    PRETTY_PRINT("");
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // if we have at least one data element
-        if (NumAttributeStateElement > 0)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        // NOTE: temporarily disable this check, to allow test to continue
-        else
-        {
-            ChipLogError(DataManagement, "PROTOCOL ERROR: Empty attribute status list");
-            err = CHIP_NO_ERROR;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-CHIP_ERROR AttributeDataElement::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Structure == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-CHIP_ERROR
-AttributeDataElement::Parser::ParseData(chip::TLV::TLVReader & aReader, int aDepth) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    if (aDepth == 0)
-    {
-        PRETTY_PRINT("\tData = ");
-    }
-    else
-    {
-        if (chip::TLV::IsContextTag(aReader.GetTag()))
-        {
-            PRETTY_PRINT("\t0x%" PRIx32 " = ", chip::TLV::TagNumFromTag(aReader.GetTag()));
-        }
-        else if (chip::TLV::IsProfileTag(aReader.GetTag()))
-        {
-            PRETTY_PRINT("\t0x%" PRIx32 "::0x%" PRIx32 " = ", chip::TLV::ProfileIdFromTag(aReader.GetTag()),
-                         chip::TLV::TagNumFromTag(aReader.GetTag()));
-        }
-        else
-        {
-            // Anonymous tag, don't print anything
-        }
-    }
-
-    switch (aReader.GetType())
-    {
-    case chip::TLV::kTLVType_Structure:
-        PRETTY_PRINT("\t{");
-        break;
-
-    case chip::TLV::kTLVType_Array:
-        PRETTY_PRINT_SAMELINE("[");
-        PRETTY_PRINT("\t\t");
-        break;
-
-    case chip::TLV::kTLVType_SignedInteger: {
-        int64_t value_s64;
-
-        err = aReader.Get(value_s64);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%" PRId64 ", ", value_s64);
-        break;
-    }
-
-    case chip::TLV::kTLVType_UnsignedInteger: {
-        uint64_t value_u64;
-
-        err = aReader.Get(value_u64);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%" PRIu64 ", ", value_u64);
-        break;
-    }
-
-    case chip::TLV::kTLVType_Boolean: {
-        bool value_b;
-
-        err = aReader.Get(value_b);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%s, ", value_b ? "true" : "false");
-        break;
-    }
-
-    case chip::TLV::kTLVType_UTF8String: {
-        char value_s[256];
-
-        err = aReader.GetString(value_s, sizeof(value_s));
-        VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, );
-
-        if (err == CHIP_ERROR_BUFFER_TOO_SMALL)
-        {
-            PRETTY_PRINT_SAMELINE("... (byte string too long) ...");
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            PRETTY_PRINT_SAMELINE("\"%s\", ", value_s);
-        }
-        break;
-    }
-
-    case chip::TLV::kTLVType_ByteString: {
-        uint8_t value_b[256];
-        uint32_t len, readerLen;
-
-        readerLen = aReader.GetLength();
-
-        err = aReader.GetBytes(value_b, sizeof(value_b));
-        VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, );
-
-        PRETTY_PRINT_SAMELINE("[");
-        PRETTY_PRINT("\t\t");
-
-        if (readerLen < sizeof(value_b))
-        {
-            len = readerLen;
-        }
-        else
-        {
-            len = sizeof(value_b);
-        }
-
-        if (err == CHIP_ERROR_BUFFER_TOO_SMALL)
-        {
-            PRETTY_PRINT_SAMELINE("... (byte string too long) ...");
-        }
-        else
-        {
-            for (size_t i = 0; i < len; i++)
-            {
-                PRETTY_PRINT_SAMELINE("0x%" PRIx8 ", ", value_b[i]);
-            }
-        }
-
-        err = CHIP_NO_ERROR;
-        PRETTY_PRINT("\t]");
-        break;
-    }
-
-    case chip::TLV::kTLVType_Null:
-        PRETTY_PRINT_SAMELINE("NULL");
-        break;
-
-    default:
-        PRETTY_PRINT_SAMELINE("--");
-        break;
-    }
-
-    if (aReader.GetType() == chip::TLV::kTLVType_Structure || aReader.GetType() == chip::TLV::kTLVType_Array)
-    {
-        const char terminating_char = (aReader.GetType() == chip::TLV::kTLVType_Structure) ? '}' : ']';
-        chip::TLV::TLVType type;
-
-        IgnoreUnusedVariable(terminating_char);
-
-        err = aReader.EnterContainer(type);
-        SuccessOrExit(err);
-
-        while ((err = aReader.Next()) == CHIP_NO_ERROR)
-        {
-            PRETTY_PRINT_INCDEPTH();
-
-            err = ParseData(aReader, aDepth + 1);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        PRETTY_PRINT("\t%c,", terminating_char);
-
-        err = aReader.ExitContainer(type);
-        SuccessOrExit(err);
-    }
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR AttributeDataElement::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-    uint32_t tagNum = 0;
-
-    PRETTY_PRINT("AttributeDataElement =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-
-        tagNum = chip::TLV::TagNumFromTag(reader.GetTag());
-
-        switch (tagNum)
-        {
-        case kCsTag_AttributePath:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_AttributePath)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_AttributePath);
-            VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-            {
-                AttributePath::Parser path;
-                err = path.Init(reader);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = path.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-
-            break;
-        case kCsTag_DataVersion:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_DataVersion)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_DataVersion);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                chip::DataVersion version;
-                err = reader.Get(version);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tDataElementVersion = 0x%" PRIx64 ",", version);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_Data:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_Data)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_Data);
-
-            err = ParseData(reader, 0);
-            SuccessOrExit(err);
-            break;
-        case kCsTag_MoreClusterDataFlag:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_MoreClusterDataFlag)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_MoreClusterDataFlag);
-            VerifyOrExit(chip::TLV::kTLVType_Boolean == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-#if CHIP_DETAIL_LOGGING
-            {
-                bool flag;
-                err = reader.Get(flag);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT("\tMoreClusterDataFlag = %s,", flag ? "true" : "false");
-            }
-
-#endif // CHIP_DETAIL_LOGGING
-            break;
-
-        default:
-            PRETTY_PRINT("\tUnknown tag num %" PRIu32, tagNum);
-            break;
-        }
-    }
-
-    PRETTY_PRINT("},");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        // Either the data or deleted keys should be present.
-        const uint16_t RequiredFields = (1 << kCsTag_AttributePath) | (1 << kCsTag_DataVersion) | (1 << kCsTag_Data);
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_DATA_ELEMENT;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR AttributeDataElement::Parser::GetAttributePath(AttributePath::Parser * const apAttributePath) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_AttributePath), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apAttributePath->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR AttributeDataElement::Parser::GetDataVersion(chip::DataVersion * const apVersion) const
-{
-    return GetUnsignedInteger(kCsTag_DataVersion, apVersion);
-}
-
-CHIP_ERROR AttributeDataElement::Parser::GetData(chip::TLV::TLVReader * const apReader) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_Data), *apReader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR AttributeDataElement::Parser::GetMoreClusterDataFlag(bool * const apGetMoreClusterDataFlag) const
-{
-    return GetSimpleValue(kCsTag_MoreClusterDataFlag, chip::TLV::kTLVType_Boolean, apGetMoreClusterDataFlag);
-}
-
-CHIP_ERROR AttributeDataElement::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return InitAnonymousStructure(apWriter);
-}
-
-AttributePath::Builder & AttributeDataElement::Builder::CreateAttributePathBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributePathBuilder.ResetError(mError));
-
-    mError = mAttributePathBuilder.Init(mpWriter, kCsTag_AttributePath);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mAttributePathBuilder would be un-/partial initialized and cannot be used to write anything
-    return mAttributePathBuilder;
-}
-
-AttributeDataElement::Builder & AttributeDataElement::Builder::DataVersion(const chip::DataVersion aDataVersion)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_DataVersion), aDataVersion);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-AttributeDataElement::Builder & AttributeDataElement::Builder::MoreClusterData(const bool aMoreClusterData)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    if (aMoreClusterData)
-    {
-        mError = mpWriter->PutBoolean(chip::TLV::ContextTag(kCsTag_MoreClusterDataFlag), true);
-        ChipLogFunctError(mError);
-    }
-
-exit:
-    return *this;
-}
-
-AttributeDataElement::Builder & AttributeDataElement::Builder::EndOfAttributeDataElement()
-{
-    EndOfContainer();
-
-    return *this;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR AttributeDataList::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err        = CHIP_NO_ERROR;
-    size_t NumDataElement = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("AttributeDataList =");
-    PRETTY_PRINT("[");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
-        VerifyOrExit(chip::TLV::kTLVType_Structure == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-        {
-            AttributeDataElement::Parser data;
-            err = data.Init(reader);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_INCDEPTH();
-            err = data.CheckSchemaValidity();
-            SuccessOrExit(err);
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        ++NumDataElement;
-    }
-
-    PRETTY_PRINT("],");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // if we have at least one data element
-        if (NumDataElement > 0)
-        {
-            err = CHIP_NO_ERROR;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-AttributeDataElement::Builder & AttributeDataList::Builder::CreateAttributeDataElementBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributeDataElementBuilder.ResetError(mError));
-
-    mError = mAttributeDataElementBuilder.Init(mpWriter);
-    ChipLogFunctError(mError);
-
-exit:
-
-    // on error, mAttributeDataElementBuilder would be un-/partial initialized and cannot be used to write anything
-    return mAttributeDataElementBuilder;
-}
-
-AttributeDataList::Builder & AttributeDataList::Builder::EndOfAttributeDataList()
-{
-    EndOfContainer();
-
-    return *this;
-}
-
-CHIP_ERROR CommandDataElement::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Structure == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-
-CHIP_ERROR
-CommandDataElement::Parser::ParseData(chip::TLV::TLVReader & aReader, int aDepth) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    if (aDepth == 0)
-    {
-        PRETTY_PRINT("\tCommandDataElement = ");
-    }
-    else
-    {
-        if (chip::TLV::IsContextTag(aReader.GetTag()))
-        {
-            PRETTY_PRINT("\t0x%" PRIx32 " = ", chip::TLV::TagNumFromTag(aReader.GetTag()));
-        }
-        else if (chip::TLV::IsProfileTag(aReader.GetTag()))
-        {
-            PRETTY_PRINT("\t0x%" PRIx32 "::0x%" PRIx32 " = ", chip::TLV::ProfileIdFromTag(aReader.GetTag()),
-                         chip::TLV::TagNumFromTag(aReader.GetTag()));
-        }
-        else
-        {
-            // Anonymous tag, don't print anything
-        }
-    }
-
-    switch (aReader.GetType())
-    {
-    case chip::TLV::kTLVType_Structure:
-        PRETTY_PRINT("\t{");
-        break;
-
-    case chip::TLV::kTLVType_Array:
-        PRETTY_PRINT_SAMELINE("[");
-        PRETTY_PRINT("\t\t");
-        break;
-
-    case chip::TLV::kTLVType_SignedInteger: {
-        int64_t value_s64;
-
-        err = aReader.Get(value_s64);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%" PRId64 ", ", value_s64);
-        break;
-    }
-
-    case chip::TLV::kTLVType_UnsignedInteger: {
-        uint64_t value_u64;
-
-        err = aReader.Get(value_u64);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%" PRIu64 ", ", value_u64);
-        break;
-    }
-
-    case chip::TLV::kTLVType_FloatingPointNumber: {
-        double value_fp;
-
-        err = aReader.Get(value_fp);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%lf, ", value_fp);
-        break;
-    }
-    case chip::TLV::kTLVType_Boolean: {
-        bool value_b;
-
-        err = aReader.Get(value_b);
-        SuccessOrExit(err);
-
-        PRETTY_PRINT_SAMELINE("%s, ", value_b ? "true" : "false");
-        break;
-    }
-
-    case chip::TLV::kTLVType_UTF8String: {
-        char value_s[256];
-
-        err = aReader.GetString(value_s, sizeof(value_s));
-        VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, );
-
-        if (err == CHIP_ERROR_BUFFER_TOO_SMALL)
-        {
-            PRETTY_PRINT_SAMELINE("... (byte string too long) ...");
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            PRETTY_PRINT_SAMELINE("\"%s\", ", value_s);
-        }
-        break;
-    }
-
-    case chip::TLV::kTLVType_ByteString: {
-        uint8_t value_b[256];
-        uint32_t len, readerLen;
-
-        readerLen = aReader.GetLength();
-
-        err = aReader.GetBytes(value_b, sizeof(value_b));
-        VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, );
-
-        PRETTY_PRINT_SAMELINE("[");
-        PRETTY_PRINT("\t\t");
-
-        if (readerLen < sizeof(value_b))
-        {
-            len = readerLen;
-        }
-        else
-        {
-            len = sizeof(value_b);
-        }
-
-        if (err == CHIP_ERROR_BUFFER_TOO_SMALL)
-        {
-            PRETTY_PRINT_SAMELINE("... (byte string too long) ...");
-        }
-        else
-        {
-            for (size_t i = 0; i < len; i++)
-            {
-                PRETTY_PRINT_SAMELINE("0x%" PRIx8 ", ", value_b[i]);
-            }
-        }
-
-        err = CHIP_NO_ERROR;
-        PRETTY_PRINT("]");
-        break;
-    }
-
-    case chip::TLV::kTLVType_Null:
-        PRETTY_PRINT_SAMELINE("NULL");
-        break;
-
-    default:
-        PRETTY_PRINT_SAMELINE("--");
-        break;
-    }
-
-    if (aReader.GetType() == chip::TLV::kTLVType_Structure || aReader.GetType() == chip::TLV::kTLVType_Array)
-    {
-        const char terminating_char = (aReader.GetType() == chip::TLV::kTLVType_Structure) ? '}' : ']';
-        chip::TLV::TLVType type;
-
-        IgnoreUnusedVariable(terminating_char);
-
-        err = aReader.EnterContainer(type);
-        SuccessOrExit(err);
-
-        while ((err = aReader.Next()) == CHIP_NO_ERROR)
-        {
-            PRETTY_PRINT_INCDEPTH();
-
-            err = ParseData(aReader, aDepth + 1);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        PRETTY_PRINT("\t%c,", terminating_char);
-
-        err = aReader.ExitContainer(type);
-        SuccessOrExit(err);
-    }
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR CommandDataElement::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-    uint32_t tagNum = 0;
-
-    PRETTY_PRINT("CommandDataElement =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-
-        tagNum = chip::TLV::TagNumFromTag(reader.GetTag());
-
-        switch (tagNum)
-        {
-        case kCsTag_CommandPath:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_CommandPath)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_CommandPath);
-            VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-            {
-                CommandPath::Parser path;
-                err = path.Init(reader);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = path.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-
-            break;
-        case kCsTag_Data:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_Data)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_Data);
-
-            err = ParseData(reader, 0);
-            SuccessOrExit(err);
-            break;
-        case kCsTag_StatusElement:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_StatusElement)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_StatusElement);
-            VerifyOrExit(chip::TLV::kTLVType_Structure == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-            {
-                StatusElement::Parser status;
-                err = status.Init(reader);
-                SuccessOrExit(err);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = status.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-
-            break;
-        default:
-            PRETTY_PRINT("Unknown tag num %" PRIu32, tagNum);
-            break;
-        }
-    }
-
-    PRETTY_PRINT("},");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // check for required fields:
-        const uint16_t RequiredFields = (1 << kCsTag_CommandPath);
-        if ((TagPresenceMask & RequiredFields) == RequiredFields)
-        {
-            err = CHIP_NO_ERROR;
-        }
-        else
-        {
-            err = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR CommandDataElement::Parser::GetCommandPath(CommandPath::Parser * const apCommandPath) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_CommandPath), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Path == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apCommandPath->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR CommandDataElement::Parser::GetData(chip::TLV::TLVReader * const apReader) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_Data), *apReader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR CommandDataElement::Parser::GetStatusElement(StatusElement::Parser * const apStatusElement) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_StatusElement), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Structure == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apStatusElement->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR CommandDataElement::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return InitAnonymousStructure(apWriter);
-}
-
-CommandPath::Builder & CommandDataElement::Builder::CreateCommandPathBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mCommandPathBuilder.ResetError(mError));
-
-    mError = mCommandPathBuilder.Init(mpWriter, kCsTag_CommandPath);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mAttributePathBuilder would be un-/partial initialized and cannot be used to write anything
-    return mCommandPathBuilder;
-}
-
-StatusElement::Builder & CommandDataElement::Builder::CreateStatusElementBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mStatusElementBuilder.ResetError(mError));
-
-    mError = mStatusElementBuilder.Init(mpWriter, kCsTag_StatusElement);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mStatusElementBuilder would be un-/partial initialized and cannot be used to write anything
-    return mStatusElementBuilder;
-}
-
-CommandDataElement::Builder & CommandDataElement::Builder::EndOfCommandDataElement()
-{
-    EndOfContainer();
-
-    return *this;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR CommandList::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err     = CHIP_NO_ERROR;
-    size_t NumCommands = 0;
-    chip::TLV::TLVReader reader;
-
-    PRETTY_PRINT("CommandList =");
-    PRETTY_PRINT("[");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::AnonymousTag == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG);
-        VerifyOrExit(chip::TLV::kTLVType_Structure == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-        {
-            CommandDataElement::Parser data;
-            err = data.Init(reader);
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_INCDEPTH();
-            err = data.CheckSchemaValidity();
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_DECDEPTH();
-        }
-
-        ++NumCommands;
-    }
-
-    PRETTY_PRINT("],");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // if we have at least one data element
-        if (NumCommands > 0)
-        {
-            err = CHIP_NO_ERROR;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CommandDataElement::Builder & CommandList::Builder::CreateCommandDataElementBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mCommandDataElementBuilder.ResetError(mError));
-
-    mError = mCommandDataElementBuilder.Init(mpWriter);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mCommandDataElementBuilder would be un-/partial initialized and cannot be used to write anything
-    return mCommandDataElementBuilder;
-}
-
-CommandList::Builder & CommandList::Builder::EndOfCommandList()
-{
-    EndOfContainer();
-    return *this;
-}
-
-CHIP_ERROR ReportData::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Structure == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR ReportData::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-    AttributeStatusList::Parser attributeStatusList;
-    AttributeDataList::Parser attributeDataList;
-    EventList::Parser eventList;
-
-    PRETTY_PRINT("ReportData =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        VerifyOrExit(chip::TLV::IsContextTag(reader.GetTag()), err = CHIP_ERROR_INVALID_TLV_TAG);
-
-        switch (chip::TLV::TagNumFromTag(reader.GetTag()))
-        {
-        case kCsTag_RequestResponse:
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_RequestResponse)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_RequestResponse);
-            VerifyOrExit(chip::TLV::kTLVType_Boolean == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                bool RequestResponse;
-                err = reader.Get(RequestResponse);
-                SuccessOrExit(err);
-                PRETTY_PRINT("\tRequestResponse = %s, ", RequestResponse ? "true" : "false");
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_SubscriptionId:
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_SubscriptionId)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_SubscriptionId);
-            VerifyOrExit(chip::TLV::kTLVType_UnsignedInteger == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                uint64_t subscriptionId;
-                err = reader.Get(subscriptionId);
-                SuccessOrExit(err);
-                PRETTY_PRINT("\tSubscriptionId = 0x%" PRIx64 ",", subscriptionId);
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_AttributeStatusList:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_AttributeStatusList)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_AttributeStatusList);
-            VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                attributeStatusList.Init(reader);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = attributeStatusList.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_AttributeDataList:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_AttributeDataList)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_AttributeDataList);
-            VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                attributeDataList.Init(reader);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = attributeDataList.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_EventDataList:
-            // check if this tag has appeared before
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_EventDataList)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_EventDataList);
-            VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                eventList.Init(reader);
-
-                PRETTY_PRINT_INCDEPTH();
-                err = eventList.CheckSchemaValidity();
-                SuccessOrExit(err);
-                PRETTY_PRINT_DECDEPTH();
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        case kCsTag_IsLastReport:
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_IsLastReport)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_IsLastReport);
-            VerifyOrExit(chip::TLV::kTLVType_Boolean == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-#if CHIP_DETAIL_LOGGING
-            {
-                bool isLastReport;
-                err = reader.Get(isLastReport);
-                SuccessOrExit(err);
-                PRETTY_PRINT("\tisLastReport = %s, ", isLastReport ? "true" : "false");
-            }
-#endif // CHIP_DETAIL_LOGGING
-            break;
-        default:
-            ExitNow(err = CHIP_ERROR_INVALID_TLV_TAG);
-        }
-    }
-
-    PRETTY_PRINT("}");
-    PRETTY_PRINT("");
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        err = CHIP_NO_ERROR;
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR ReportData::Parser::GetRequestResponse(bool * const apRequestResponse) const
-{
-    return GetSimpleValue(kCsTag_RequestResponse, chip::TLV::kTLVType_Boolean, apRequestResponse);
-}
-
-CHIP_ERROR ReportData::Parser::GetSubscriptionId(uint64_t * const apSubscriptionId) const
-{
-    return GetUnsignedInteger(kCsTag_SubscriptionId, apSubscriptionId);
-}
-
-CHIP_ERROR ReportData::Parser::GetAttributeStatusList(AttributeStatusList::Parser * const apAttributeStatusList) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_AttributeStatusList), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apAttributeStatusList->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR ReportData::Parser::GetAttributeDataList(AttributeDataList::Parser * const apAttributeDataList) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_AttributeDataList), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apAttributeDataList->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR ReportData::Parser::GetEventDataList(EventList::Parser * const apEventDataList) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_EventDataList), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apEventDataList->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR ReportData::Parser::GetIsLastReport(bool * const apIsLastReport) const
-{
-    return GetSimpleValue(kCsTag_IsLastReport, chip::TLV::kTLVType_Boolean, apIsLastReport);
-}
-
-CHIP_ERROR ReportData::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return InitAnonymousStructure(apWriter);
-}
-
-ReportData::Builder & ReportData::Builder::RequestResponse(const bool aRequestResponse)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->PutBoolean(chip::TLV::ContextTag(kCsTag_RequestResponse), aRequestResponse);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-ReportData::Builder & ReportData::Builder::SubscriptionId(const uint64_t aSubscriptionId)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->Put(chip::TLV::ContextTag(kCsTag_SubscriptionId), aSubscriptionId);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-AttributeStatusList::Builder & ReportData::Builder::CreateAttributeStatusListBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributeStatusListBuilder.ResetError(mError));
-
-    mError = mAttributeStatusListBuilder.Init(mpWriter, kCsTag_AttributeStatusList);
-    ChipLogFunctError(mError);
-
-exit:
-    return mAttributeStatusListBuilder;
-}
-
-AttributeDataList::Builder & ReportData::Builder::CreateAttributeDataListBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributeDataListBuilder.ResetError(mError));
-
-    mError = mAttributeDataListBuilder.Init(mpWriter, kCsTag_AttributeDataList);
-    ChipLogFunctError(mError);
-
-exit:
-    return mAttributeDataListBuilder;
-}
-
-EventList::Builder & ReportData::Builder::CreateEventDataListBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mAttributeDataListBuilder.ResetError(mError));
-
-    mError = mEventDataListBuilder.Init(mpWriter, kCsTag_EventDataList);
-    ChipLogFunctError(mError);
-
-exit:
-    return mEventDataListBuilder;
-}
-
-ReportData::Builder & ReportData::Builder::IsLastReport(const bool aIsLastReport)
-{
-    // skip if error has already been set
-    SuccessOrExit(mError);
-
-    mError = mpWriter->PutBoolean(chip::TLV::ContextTag(kCsTag_IsLastReport), aIsLastReport);
-    ChipLogFunctError(mError);
-
-exit:
-    return *this;
-}
-
-ReportData::Builder & ReportData::Builder::EndOfReportData()
-{
-    EndOfContainer();
-    return *this;
-}
-
-CHIP_ERROR InvokeCommand::Parser::Init(const chip::TLV::TLVReader & aReader)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    // make a copy of the reader here
-    mReader.Init(aReader);
-
-    VerifyOrExit(chip::TLV::kTLVType_Structure == mReader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    // This is just a dummy, as we're not going to exit this container ever
-    chip::TLV::TLVType OuterContainerType;
-    err = mReader.EnterContainer(OuterContainerType);
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-
-#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-CHIP_ERROR InvokeCommand::Parser::CheckSchemaValidity() const
-{
-    CHIP_ERROR err           = CHIP_NO_ERROR;
-    uint16_t TagPresenceMask = 0;
-    chip::TLV::TLVReader reader;
-    CommandList::Parser commandList;
-
-    PRETTY_PRINT("InvokeCommand =");
-    PRETTY_PRINT("{");
-
-    // make a copy of the reader
-    reader.Init(mReader);
-
-    while (CHIP_NO_ERROR == (err = reader.Next()))
-    {
-        const uint64_t tag = reader.GetTag();
-
-        if (chip::TLV::ContextTag(kCsTag_CommandList) == tag)
-        {
-            VerifyOrExit(!(TagPresenceMask & (1 << kCsTag_CommandList)), err = CHIP_ERROR_INVALID_TLV_TAG);
-            TagPresenceMask |= (1 << kCsTag_CommandList);
-            VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-            commandList.Init(reader);
-
-            PRETTY_PRINT_INCDEPTH();
-
-            err = commandList.CheckSchemaValidity();
-            SuccessOrExit(err);
-
-            PRETTY_PRINT_DECDEPTH();
-        }
-        else
-        {
-            PRETTY_PRINT("\tUnknown tag 0x%" PRIx64, tag);
-        }
-    }
-
-    PRETTY_PRINT("}");
-    PRETTY_PRINT("");
-
-    // if we have exhausted this container
-    if (CHIP_END_OF_TLV == err)
-    {
-        // if we have at least the DataList or EventList field
-        if ((TagPresenceMask & (1 << kCsTag_CommandList)))
-        {
-            err = CHIP_NO_ERROR;
-        }
-    }
-
-exit:
-    ChipLogFunctError(err);
-
-    return err;
-}
-#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK
-
-CHIP_ERROR InvokeCommand::Parser::GetCommandList(CommandList::Parser * const apCommandList) const
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    chip::TLV::TLVReader reader;
-
-    err = mReader.FindElementWithTag(chip::TLV::ContextTag(kCsTag_CommandList), reader);
-    SuccessOrExit(err);
-
-    VerifyOrExit(chip::TLV::kTLVType_Array == reader.GetType(), err = CHIP_ERROR_WRONG_TLV_TYPE);
-
-    err = apCommandList->Init(reader);
-    SuccessOrExit(err);
-
-exit:
-    ChipLogIfFalse((CHIP_NO_ERROR == err) || (CHIP_END_OF_TLV == err));
-
-    return err;
-}
-
-CHIP_ERROR InvokeCommand::Builder::Init(chip::TLV::TLVWriter * const apWriter)
-{
-    return InitAnonymousStructure(apWriter);
-}
-
-CommandList::Builder & InvokeCommand::Builder::CreateCommandListBuilder()
-{
-    // skip if error has already been set
-    VerifyOrExit(CHIP_NO_ERROR == mError, mCommandListBuilder.ResetError(mError));
-
-    mError = mCommandListBuilder.Init(mpWriter, kCsTag_CommandList);
-    ChipLogFunctError(mError);
-
-exit:
-    // on error, mCommandListBuilder would be un-/partial initialized and cannot be used to write anything
-    return mCommandListBuilder;
-}
-
-InvokeCommand::Builder & InvokeCommand::Builder::EndOfInvokeCommand()
-{
-    EndOfContainer();
-    return *this;
-}
-
-}; // namespace app
-}; // namespace chip
diff --git a/src/app/MessageDef.h b/src/app/MessageDef.h
deleted file mode 100644 (file)
index 075692e..0000000
+++ /dev/null
@@ -1,1864 +0,0 @@
-/**
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2016-2017 Nest Labs, Inc.
- *
- *    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.
- */
-/**
- *    @file
- *      This file defines CHIP interaction model message parsers and encoders
- *      Interaction model profile.
- *
- */
-
-#pragma once
-
-#ifndef _CHIP_INTERACTION_MODEL_MESSAGE_DEF_H
-#define _CHIP_INTERACTION_MODEL_MESSAGE_DEF_H
-
-#include <core/CHIPCore.h>
-#include <core/CHIPTLV.h>
-#include <support/CodeUtils.h>
-#include <support/logging/CHIPLogging.h>
-#include <util/basic-types.h>
-
-namespace chip {
-namespace app {
-/**
- *  @brief
- *    The CHIP interaction model message types.
- *
- *  These values are called out in CHIP Interaction Model: Encoding Specification
- *
- */
-enum
-{
-    kMsgType_SubscribeRequest      = 0x01,
-    kMsgType_ReadRequest           = 0x02,
-    kMsgType_ReportData            = 0x03,
-    kMsgType_WriteRequest          = 0x04,
-    kMsgType_WriteResponse         = 0x05,
-    kMsgType_InvokeCommandRequest  = 0x06,
-    kMsgType_InvokeCommandResponse = 0x07,
-};
-
-class Parser
-{
-public:
-    /**
-     *  @brief Initialize the Builder object with TLVReader and ContainerType
-     *
-     *  @param [in] aReader TLVReader
-     *  @param [in] aOuterContainerType outer container type
-     *
-     */
-    void Init(const chip::TLV::TLVReader & aReader, chip::TLV::TLVType aOuterContainerType);
-
-    /**
-     *  @brief Initialize a TLVReader to point to the beginning of any tagged element in this request
-     *
-     *  @param [in]  aTagToFind Tag to find in the request
-     *  @param [out] apReader   A pointer to TLVReader, which will be initialized at the specified TLV element
-     *                          on success
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR GetReaderOnTag(const uint64_t aTagToFind, chip::TLV::TLVReader * const apReader) const;
-
-    /**
-     *  @brief Get the TLV Reader
-     *
-     *  @param [in] aReader A pointer to a TLVReader
-     *
-     */
-    void GetReader(chip::TLV::TLVReader * const apReader);
-
-protected:
-    chip::TLV::TLVReader mReader;
-    chip::TLV::TLVType mOuterContainerType;
-    Parser();
-
-    template <typename T>
-    CHIP_ERROR GetUnsignedInteger(const uint8_t aContextTag, T * const apLValue) const;
-
-    template <typename T>
-    CHIP_ERROR GetSimpleValue(const uint8_t aContextTag, const chip::TLV::TLVType aTLVType, T * const apLValue) const;
-};
-
-class ListParser : public chip::app::Parser
-{
-protected:
-    ListParser();
-
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should be on the element of the array element
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Initialize the parser object with TLVReader if context tag exists
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should be on the element of the array element
-     *  @param [in] aContextTagToFind A context tag it tries to find
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR InitIfPresent(const chip::TLV::TLVReader & aReader, const uint8_t aContextTagToFind);
-
-    /**
-     *  @brief Iterate to next element
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Next();
-};
-
-class Builder
-{
-public:
-    /**
-     *  @brief Initialize the Builder object with TLVWriter and ContainerType
-     *
-     *  @param [in] apWriter A pointer to a TLVWriter
-     *  @param [in] aOuterContainerType outer container type
-     *
-     */
-    void Init(chip::TLV::TLVWriter * const apWriter, chip::TLV::TLVType aOuterContainerType);
-
-    /**
-     *  @brief Reset the Error
-     *
-     */
-    void ResetError();
-
-    /**
-     *  @brief Reset the Error with particular aErr.
-     *  @param [in] aErr the Error it would be reset with
-     *
-     */
-    void ResetError(CHIP_ERROR aErr);
-
-    /**
-     *  @brief Get current error
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR GetError() const { return mError; };
-
-    /**
-     *  @brief Get TLV Writer
-     *
-     *  @return #Pointer to the TLVWriter
-     */
-    chip::TLV::TLVWriter * GetWriter() { return mpWriter; };
-
-protected:
-    CHIP_ERROR mError;
-    chip::TLV::TLVWriter * mpWriter;
-    chip::TLV::TLVType mOuterContainerType;
-
-    Builder();
-    void EndOfContainer();
-
-    CHIP_ERROR InitAnonymousStructure(chip::TLV::TLVWriter * const apWriter);
-};
-
-class ListBuilder : public chip::app::Builder
-{
-protected:
-    ListBuilder();
-
-public:
-    /**
-     * Init the TLV array container with an particular context tag.
-     * Required to implement arrays of arrays, and to test ListBuilder.
-     *
-     * @param[in]   apWriter    Pointer to the TLVWriter that is encoding the message.
-     * @param[in]   aContextTagToUse    A contextTag to use.
-     *
-     * @return                  CHIP_ERROR codes returned by Chip::TLV objects.
-     */
-
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse);
-    /**
-     * Init the TLV array container with an anonymous tag.
-     * Required to implement arrays of arrays, and to test ListBuilder.
-     *
-     * @param[in]   apWriter    Pointer to the TLVWriter that is encoding the message.
-     *
-     * @return                  CHIP_ERROR codes returned by Chip::TLV objects.
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-};
-
-namespace AttributePath {
-enum
-{
-    kCsTag_NodeId              = 0,
-    kCsTag_EndpointId          = 1,
-    kCsTag_NamespacedClusterId = 2,
-    kCsTag_FieldId             = 3,
-    kCsTag_ListIndex           = 4,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this AttributePath
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the NodeId. Next() must be called before accessing them.
-     *
-     *  @param [in] apNodeId    A pointer to apNodeId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetNodeId(chip::NodeId * const apNodeId) const;
-
-    /**
-     *  @brief Get a TLVReader for the EndpointId. Next() must be called before accessing them.
-     *
-     *  @param [in] apEndpointId    A pointer to apEndpointId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetEndpointId(chip::EndpointId * const apEndpointId) const;
-
-    /**
-     *  @brief Get a TLVReader for the ClusterId. Next() must be called before accessing them.
-     *
-     *  @param [in] apClusterId    A pointer to apClusterId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetNamespacedClusterId(chip::ClusterId * const apClusterId) const;
-
-    /**
-     *  @brief Get a TLVReader for the FieldId. Next() must be called before accessing them.
-     *
-     *  @param [in] apFieldId    A pointer to apFieldId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetFieldId(uint8_t * const apFieldId) const;
-
-    /**
-     *  @brief Get a TLVReader for the ListIndex. Next() must be called before accessing them.
-     *
-     *  @param [in] apListIndex    A pointer to apListIndex
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetListIndex(uint16_t * const apListIndex) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a AttributePath::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     * Init the AttributePath container with an particular context tag.
-     * Required to implement arrays of arrays, and to test ListBuilder.
-     *
-     * @param[in]   apWriter    Pointer to the TLVWriter that is encoding the message.
-     * @param[in]   aContextTagToUse    A contextTag to use.
-     *
-     * @return                  CHIP_ERROR codes returned by Chip::TLV objects.
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse);
-
-    /**
-     *  @brief Inject NodeId into the TLV stream.
-     *
-     *  @param [in] aNodeId NodeId for this attribute path
-     *
-     *  @return A reference to *this
-     */
-    AttributePath::Builder & NodeId(const chip::NodeId aNodeId);
-
-    /**
-     *  @brief Inject EndpointId into the TLV stream.
-     *
-     *  @param [in] aEndpointId NodeId for this attribute path
-     *
-     *  @return A reference to *this
-     */
-    AttributePath::Builder & EndpointId(const chip::EndpointId aEndpointId);
-
-    /**
-     *  @brief Inject NamespacedClusterId into the TLV stream.
-     *
-     *  @param [in] aNamespacedClusterId NamespacedClusterId for this attribute path
-     *
-     *  @return A reference to *this
-     */
-    AttributePath::Builder & NamespacedClusterId(const chip::ClusterId aNamespacedClusterId);
-
-    /**
-     *  @brief Inject FieldId into the TLV stream.
-     *
-     *  @param [in] aFieldId FieldId for this attribute path
-     *
-     *  @return A reference to *this
-     */
-    AttributePath::Builder & FieldId(const uint8_t aFieldId);
-
-    /**
-     *  @brief Inject NodeId into the TLV stream.
-     *
-     *  @param [in] aListIndex NodeId for this attribute path
-     *
-     *  @return A reference to *this
-     */
-    AttributePath::Builder & ListIndex(const uint16_t aListIndex);
-
-    /**
-     *  @brief Mark the end of this AttributePath
-     *
-     *  @return A reference to *this
-     */
-    AttributePath::Builder & EndOfAttributePath();
-
-private:
-    CHIP_ERROR _Init(chip::TLV::TLVWriter * const apWriter, const uint64_t aTag);
-};
-
-}; // namespace AttributePath
-
-namespace AttributePathList {
-class Parser : public ListParser
-{
-public:
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-};
-
-class Builder : public ListBuilder
-{
-public:
-    /**
-     *  @brief Initialize a AttributePath::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributePath::Builder
-     */
-    AttributePath::Builder & CreateAttributePathBuilder();
-
-    /**
-     *  @brief Mark the end of this AttributePath
-     *
-     *  @return A reference to *this
-     */
-    AttributePathList::Builder & EndOfAttributePathList();
-
-private:
-    AttributePath::Builder mAttributePathBuilder;
-};
-}; // namespace AttributePathList
-
-namespace EventPath {
-enum
-{
-    kCsTag_NodeId              = 0,
-    kCsTag_EndpointId          = 1,
-    kCsTag_NamespacedClusterId = 2,
-    kCsTag_EventId             = 3,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this EventPath
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the NodeId. Next() must be called before accessing them.
-     *
-     *  @param [in] apNodeId    A pointer to apNodeId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetNodeId(chip::NodeId * const apNodeId) const;
-
-    /**
-     *  @brief Get a TLVReader for the EndpointId. Next() must be called before accessing them.
-     *
-     *  @param [in] apEndpointId    A pointer to apEndpointId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetEndpointId(chip::EndpointId * const apEndpointId) const;
-
-    /**
-     *  @brief Get a TLVReader for the NamespacedClusterId. Next() must be called before accessing them.
-     *
-     *  @param [in] apNamespacedClusterId    A pointer to apNamespacedClusterId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetNamespacedClusterId(chip::ClusterId * const apNamespacedClusterId) const;
-
-    /**
-     *  @brief Get a TLVReader for the EventId. Next() must be called before accessing them.
-     *
-     *  @param [in] apEventId    A pointer to apEventId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetEventId(chip::EventId * const apEventId) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a EventPath::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     * Init the EventPath container with an particular context tag.
-     * Required to implement arrays of arrays, and to test ListBuilder.
-     *
-     * @param[in]   apWriter    Pointer to the TLVWriter that is encoding the message.
-     * @param[in]   aContextTagToUse    A contextTag to use.
-     *
-     * @return                  CHIP_ERROR codes returned by Chip::TLV objects.
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse);
-
-    /**
-     *  @brief Inject NodeId into the TLV stream.
-     *
-     *  @param [in] aNodeId NodeId for this event path
-     *
-     *  @return A reference to *this
-     */
-    EventPath::Builder & NodeId(const chip::NodeId aNodeId);
-
-    /**
-     *  @brief Inject EndpointId into the TLV stream.
-     *
-     *  @param [in] aEndpointId EndpointId for this eevent path
-     *
-     *  @return A reference to *this
-     */
-    EventPath::Builder & EndpointId(const chip::EndpointId aEndpointId);
-
-    /**
-     *  @brief Inject NamespacedClusterId into the TLV stream.
-     *
-     *  @param [in] aNamespacedClusterId NamespacedClusterId for this event path
-     *
-     *  @return A reference to *this
-     */
-    EventPath::Builder & NamespacedClusterId(const chip::ClusterId aNamespacedClusterId);
-
-    /**
-     *  @brief Inject EventId into the TLV stream.
-     *
-     *  @param [in] aEventId NamespacedClusterId for this event path
-     *
-     *  @return A reference to *this
-     */
-    EventPath::Builder & EventId(const chip::EventId aEventId);
-
-    /**
-     *  @brief Mark the end of this EventPath
-     *
-     *  @return A reference to *this
-     */
-    EventPath::Builder & EndOfEventPath();
-
-private:
-    CHIP_ERROR _Init(chip::TLV::TLVWriter * const apWriter, const uint64_t aTag);
-};
-}; // namespace EventPath
-
-namespace EventPathList {
-class Parser : public ListParser
-{
-public:
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-};
-
-class Builder : public ListBuilder
-{
-public:
-    /**
-     *  @brief Initialize a EventPath::Builder for writing into the TLV stream
-     *
-     *  @return A reference to EventPath::Builder
-     */
-    EventPath::Builder & CreateEventPathBuilder();
-
-    /**
-     *  @brief Mark the end of this EventPathList
-     *
-     *  @return A reference to *this
-     */
-    EventPathList::Builder & EndOfEventPathList();
-
-private:
-    EventPath::Builder mEventPathBuilder;
-};
-}; // namespace EventPathList
-
-namespace CommandPath {
-enum
-{
-    kCsTag_EndpointId          = 0,
-    kCsTag_GroupId             = 1,
-    kCsTag_NamespacedClusterId = 2,
-    kCsTag_CommandId           = 3,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this CommandPath
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the EndpointId. Next() must be called before accessing them.
-     *
-     *  @param [in] apEndpointId    A pointer to apEndpointId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetEndpointId(chip::EndpointId * const apEndpointId) const;
-
-    /**
-     *  @brief Get a TLVReader for the GroupId. Next() must be called before accessing them.
-     *
-     *  @param [in] apGroupId    A pointer to apGroupId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetGroupId(chip::GroupId * const apGroupId) const;
-
-    /**
-     *  @brief Get a TLVReader for the NamespacedClusterId. Next() must be called before accessing them.
-     *
-     *  @param [in] apEndpointId    A pointer to NamespacedClusterId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetNamespacedClusterId(chip::ClusterId * const apNamespacedClusterId) const;
-
-    /**
-     *  @brief Get a TLVReader for the CommandId. Next() must be called before accessing them.
-     *
-     *  @param [in] apEndpointId    A pointer to CommandId
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetCommandId(chip::CommandId * const apCommandId) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a CommandPath::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     * Init the CommandPath container with an particular context tag.
-     * Required to implement arrays of arrays, and to test ListBuilder.
-     *
-     * @param[in]   apWriter    Pointer to the TLVWriter that is encoding the message.
-     * @param[in]   aContextTagToUse    A contextTag to use.
-     *
-     * @return                  CHIP_ERROR codes returned by Chip::TLV objects.
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse);
-
-    /**
-     *  @brief Inject EndpointId into the TLV stream to indicate the endpointId referenced by the path.
-     *
-     *  @param [in] aEndpointId refer to the ID of the endpoint as described in the descriptor cluster.
-     *
-     *  @return A reference to *this
-     */
-    CommandPath::Builder & EndpointId(const chip::EndpointId aEndpointId);
-
-    /**
-     *  @brief Inject GroupId into the TLV stream to indicate the GroupId referenced by the path.
-     *
-     *  @param [in] aGroupId  Group Id for this Command path
-     *
-     *  @return A reference to *this
-     */
-    CommandPath::Builder & GroupId(const chip::GroupId aGroupId);
-
-    /**
-     *  @brief Inject NamespacedClusterId into the TLV stream.
-     *
-     *  @param [in] aNamespacedClusterId NamespacedClusterId for this command path
-     *
-     *  @return A reference to *this
-     */
-    CommandPath::Builder & NamespacedClusterId(const chip::ClusterId aNamespacedClusterId);
-
-    /**
-     *  @brief Inject CommandId into the TLV stream
-     *
-     *  @param [in] aCommandId Command Id for NamespacedClusterId for this command path
-     *
-     *  @return A reference to *this
-     */
-    CommandPath::Builder & CommandId(const chip::CommandId aCommandId);
-
-    /**
-     *  @brief Mark the end of this CommandPath
-     *
-     *  @return A reference to *this
-     */
-    CommandPath::Builder & EndOfCommandPath();
-
-private:
-    CHIP_ERROR _Init(chip::TLV::TLVWriter * const apWriter, const uint64_t aTag);
-};
-}; // namespace CommandPath
-
-namespace EventDataElement {
-enum
-{
-    kCsTag_EventPath            = 0,
-    kCsTag_ImportanceLevel      = 1,
-    kCsTag_Number               = 2,
-    kCsTag_UTCTimestamp         = 3,
-    kCsTag_SystemTimestamp      = 4,
-    kCsTag_DeltaUTCTimestamp    = 5,
-    kCsTag_DeltaSystemTimestamp = 6,
-    kCsTag_Data                 = 7,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this EventDataElement
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the EventPath. Next() must be called before accessing them.
-     *
-     *  @param [in] apEventPath    A pointer to apEventPath
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Path
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetEventPath(EventPath::Parser * const apEventPath);
-
-    /**
-     *  @brief Get a TLVReader for the Number. Next() must be called before accessing them.
-     *
-     *  @param [in] apImportanceLevel    A pointer to apImportanceLevel
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetImportanceLevel(uint8_t * const apImportanceLevel);
-
-    /**
-     *  @brief Get a TLVReader for the Number. Next() must be called before accessing them.
-     *
-     *  @param [in] apNumber    A pointer to apNumber
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetNumber(uint64_t * const apNumber);
-
-    /**
-     *  @brief Get a TLVReader for the UTCTimestamp. Next() must be called before accessing them.
-     *
-     *  @param [in] apUTCTimestamp    A pointer to apUTCTimestamp
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetUTCTimestamp(uint64_t * const apUTCTimestamp);
-
-    /**
-     *  @brief Get a TLVReader for the SystemTimestamp. Next() must be called before accessing them.
-     *
-     *  @param [in] apSystemTimestamp    A pointer to apSystemTimestamp
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetSystemTimestamp(uint64_t * const apSystemTimestamp);
-
-    /**
-     *  @brief Get a TLVReader for the DeltaUTCTime. Next() must be called before accessing them.
-     *
-     *  @param [in] apDeltaUTCTimestamp   A pointer to apDeltaUTCTime
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetDeltaUTCTime(uint64_t * const apDeltaUTCTime);
-
-    /**
-     *  @brief Get a TLVReader for the DeltaSystemTime. Next() must be called before accessing them.
-     *
-     *  @param [in] apDeltaSystemTimestamp   A pointer to apDeltaSystemTime
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetDeltaSystemTime(uint64_t * const apDeltaSystemTime);
-
-    /**
-     *  @brief Get a TLVReader for the Data. Next() must be called before accessing them.
-     *
-     *  @param [in] apReader    A pointer to apReader
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetData(chip::TLV::TLVReader * const apReader) const;
-
-protected:
-    // A recursively callable function to parse a data element and pretty-print it.
-    CHIP_ERROR ParseData(chip::TLV::TLVReader & aReader, int aDepth) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a EventDataElement::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     *  @brief Initialize a EventPath::Builder for writing into the TLV stream
-     *
-     *  @return A reference to EventPath::Builder
-     */
-    EventPath::Builder & CreateEventPathBuilder();
-
-    /**
-     *  @brief Inject ImportanceLevel into the TLV stream to indicate the importance level associated with
-     *  the cluster that is referenced by the path.
-     *
-     *  @param [in] aImportanceLevel This is an integer representation of the importance level.
-     *
-     *  @return A reference to *this
-     */
-    EventDataElement::Builder ImportanceLevel(const uint8_t aImportanceLevel);
-
-    /**
-     *  @brief Inject Number into the TLV stream to indicate the number associated with
-     *  the cluster that is referenced by the path. The event number is a monotonically increasing number that
-     *  uniquely identifies each emitted event. This number is scoped to the ImportanceLevel.
-     *
-     *  @param [in] aNumber The uint64_t variable to reflectt the event number
-     *
-     *  @return A reference to *this
-     */
-    EventDataElement::Builder Number(const uint64_t aNumber);
-
-    /**
-     *  @brief Inject UTCTimestamp into the TLV stream.
-     *  This is encoded as a 64-bit millisecond number since UNIX epoch (Jan 1 1970 00:00:00 GMT).
-     *
-     *  @param [in] aUTCTimestamp The uint64_t variable to reflect the UTC timestamp of the Event.
-     *
-     *  @return A reference to *this
-     */
-    EventDataElement::Builder UTCTimestamp(const uint64_t aUTCTimestamp);
-
-    /**
-     *  @brief Inject SystemTimestamp into the TLV stream. If UTC time is not available, time since boot
-     *  SHALL be encoded in this field as 64-bit, milliseconds.
-     *
-     *  @param [in] aSystemTimestamp The uint64_t variable to reflect system time
-     *
-     *  @return A reference to *this
-     */
-    EventDataElement::Builder SystemTimestamp(const uint64_t aSystemTimestamp);
-
-    /**
-     *  @brief Inject DataVersion into the TLV stream to indicate the numerical data version associated with
-     *  the cluster that is referenced by the path. When this field is present, the UTC Timestamp field SHALL be omitted.
-     *
-     *  @param [in] aDataVersion The uint64_t variable to reflect DeltaUTCTime
-     *
-     *  @return A reference to *this
-     */
-    EventDataElement::Builder DeltaUTCTime(const uint64_t aDeltaUTCTime);
-
-    /**
-     *  @brief Inject DeltaSystemTimestamp into the TLV stream.
-     *  This field is present if delta encoding of the System timestamp relative to a prior event is desired for compression
-     * reasons. When this field is present, the System Timestamp field SHALL be omitted.
-     *
-     *  @param [in] DeltaSystemTimestamp The uint64_t variable to reflect DeltaSystemTime
-     *
-     *  @return A reference to *this
-     */
-    EventDataElement::Builder DeltaSystemTime(const uint64_t aDeltaSystemTime);
-
-    /**
-     *  @brief Mark the end of this EventDataElement
-     *
-     *  @return A reference to *this
-     */
-    EventDataElement::Builder & EndOfEventDataElement();
-
-private:
-    EventPath::Builder mEventPathBuilder;
-};
-}; // namespace EventDataElement
-
-namespace EventList {
-class Parser : public ListParser
-{
-public:
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-};
-
-class Builder : public ListBuilder
-{
-public:
-    /**
-     *  @brief Initialize a EventDataElement::Builder for writing into the TLV stream
-     *
-     *  @return A reference to EventDataElement::Builder
-     */
-    EventDataElement::Builder & CreateEventBuilder();
-
-    /**
-     *  @brief Mark the end of this EventList
-     *
-     *  @return A reference to *this
-     */
-    EventList::Builder & EndOfEventList();
-
-private:
-    EventDataElement::Builder mEventDataElementBuilder;
-};
-}; // namespace EventList
-
-namespace StatusElement {
-enum
-{
-    kCsTag_GeneralCode         = 1,
-    kCsTag_ProtocolId          = 2,
-    kCsTag_ProtocolCode        = 3,
-    kCsTag_NamespacedClusterId = 4
-};
-
-class Parser : public ListParser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this StatusElement
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-    `* Read the GeneralCode, ProtocolId, ProtocolCode, NamespacedClusterId
-     *
-     * @param[out]   apGeneralCode     Pointer to the storage for the GeneralCode
-     * @param[out]   apProtocolId     Pointer to the storage for the ProtocolId
-     * @param[out]   apProtocolCode   Pointer to the storage for the ProtocolCode
-     * @param[out]   apNamespacedClusterId     Pointer to the storage for the NamespacedClusterId
-     *
-     * @return       CHIP_ERROR codes returned by Chip::TLV objects. CHIP_END_OF_TLV if either
-     *               element is missing. CHIP_ERROR_WRONG_TLV_TYPE if the elements are of the wrong
-     *               type.
-     */
-    CHIP_ERROR DecodeStatusElement(uint16_t * apGeneralCode, uint32_t * apProtocolId, uint16_t * apProtocolCode,
-                                   chip::ClusterId * apNamespacedClusterId) const;
-};
-
-class Builder : public ListBuilder
-{
-public:
-    /**
-     *  @brief Initialize a StatusElement::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     * Init the StatusElement container with an particular context tag.
-     * Required to implement arrays of arrays, and to test ListBuilder.
-     *
-     * @param[in]   apWriter    Pointer to the TLVWriter that is encoding the message.
-     * @param[in]   aContextTagToUse    A contextTag to use.
-     *
-     * @return                  CHIP_ERROR codes returned by Chip::TLV objects.
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse);
-
-    /**
-    `* Read the GeneralCode, ProtocolId, ProtocolCode, NamespacedClusterId
-     *
-     * @param[in]   aGeneralCode    General status code
-     * @param[in]   aProtocolId     A protocol ID (32-bit integer composed of a 16-bit vendor id and 16-bit Scoped id)
-     * @param[in]   aProtocolCode   16-bit protocol-specific error code
-     * @param[in]   aNamespacedClusterId      Cluster Id for ZCL
-     *
-     * @return       CHIP_ERROR codes returned by Chip::TLV objects. CHIP_END_OF_TLV if either
-     *               element is missing. CHIP_ERROR_WRONG_TLV_TYPE if the elements are of the wrong
-     *               type.
-     */
-    StatusElement::Builder & EncodeStatusElement(const uint16_t aGeneralCode, const uint32_t aProtocolId,
-                                                 const uint16_t aProtocolCode, const chip::ClusterId aNamespacedClusterId);
-
-    /**
-     *  @brief Mark the end of this StatusElement
-     *
-     *  @return A reference to *this
-     */
-    StatusElement::Builder & EndOfStatusElement();
-};
-}; // namespace StatusElement
-
-namespace AttributeStatusElement {
-enum
-{
-    kCsTag_AttributePath = 0,
-    kCsTag_StatusElement = 1,
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a AttributeStatusElement::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     *  @brief Initialize a AttributePath::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributePath::Builder
-     */
-    AttributePath::Builder & CreateAttributePathBuilder();
-
-    /**
-     *  @brief Initialize a StatusElement::Builder for writing into the TLV stream
-     *
-     *  @return A reference to StatusElement::Builder
-     */
-    StatusElement::Builder & CreateStatusElementBuilder();
-
-    /**
-     *  @brief Mark the end of this AttributeStatusElement
-     *
-     *  @return A reference to *this
-     */
-    AttributeStatusElement::Builder & EndOfAttributeStatusElement();
-
-private:
-    AttributePath::Builder mAttributePathBuilder;
-    StatusElement::Builder mStatusElementBuilder;
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this AttributeStatusElement
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the AttributePath. Next() must be called before accessing them.
-     *
-     *  @param [in] apAttributePath    A pointer to apAttributePath
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Path
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetAttributePath(AttributePath::Parser * const apAttributePath) const;
-
-    /**
-     *  @brief Get a TLVReader for the StatusElement. Next() must be called before accessing them.
-     *
-     *  @param [in] apStatusElement    A pointer to apStatusElement
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Path
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetStatusElement(StatusElement::Parser * const apStatusElement) const;
-};
-}; // namespace AttributeStatusElement
-
-namespace AttributeStatusList {
-class Builder : public ListBuilder
-{
-public:
-    /**
-     *  @brief Initialize a AttributeStatus::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributeStatus::Builder
-     */
-    AttributeStatusElement::Builder & CreateAttributeStatusBuilder();
-
-    /**
-     *  @brief Mark the end of this AttributeStatusList
-     *
-     *  @return A reference to *this
-     */
-    AttributeStatusList::Builder & EndOfAttributeStatusList();
-
-private:
-    AttributeStatusElement::Builder mAttributeStatusBuilder;
-};
-
-class Parser : public ListParser
-{
-public:
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-};
-}; // namespace AttributeStatusList
-
-namespace AttributeDataElement {
-enum
-{
-    kCsTag_AttributePath       = 0,
-    kCsTag_DataVersion         = 1,
-    kCsTag_Data                = 2,
-    kCsTag_MoreClusterDataFlag = 3,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this AttributeDataElement
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the AttributePath. Next() must be called before accessing them.
-     *
-     *  @param [in] apAttributePath    A pointer to apAttributePath
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Path
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetAttributePath(AttributePath::Parser * const apAttributePath) const;
-
-    /**
-     *  @brief Get a TLVReader for the DataVersion. Next() must be called before accessing them.
-     *
-     *  @param [in] apVersion    A pointer to apVersion
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetDataVersion(chip::DataVersion * const apVersion) const;
-
-    /**
-     *  @brief Get a TLVReader for the Data. Next() must be called before accessing them.
-     *
-     *  @param [in] apReader    A pointer to apReader
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetData(chip::TLV::TLVReader * const apReader) const;
-
-    /**
-     *  @brief Check whether it need more cluster data Next() must be called before accessing them.
-     *
-     *  @param [in] apMoreClusterDataFlag    A pointer to apMoreClusterDataFlag
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetMoreClusterDataFlag(bool * const apMoreClusterDataFlag) const;
-
-protected:
-    // A recursively callable function to parse a data element and pretty-print it.
-    CHIP_ERROR ParseData(chip::TLV::TLVReader & aReader, int aDepth) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a AttributeDataElement::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     *  @brief Initialize a AttributePath::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributePath::Builder
-     */
-    AttributePath::Builder & CreateAttributePathBuilder();
-
-    /**
-     *  @brief Inject DataVersion into the TLV stream to indicate the numerical data version associated with
-     *  the cluster that is referenced by the path.
-     *
-     *  @param [in] aDataVersion The boolean variable to indicate if AttributeDataElement has version
-     *
-     *  @return A reference to *this
-     */
-    AttributeDataElement::Builder & DataVersion(const chip::DataVersion aDataVersion);
-
-    /**
-     *  @brief Inject aMoreClusterData into the TLV stream to indicate whether there is more cluster data.
-     *  This is present when there is more than one AttributeDataElement as part of a logical Changeset,
-     *  and the entire set needs to be applied ‘atomically’ on the receiver.
-     *
-     *  @param [in] aMoreClusterData The boolean variable to indicate if more cluster data is needed.
-     *
-     *  @return A reference to *this
-     */
-    AttributeDataElement::Builder & MoreClusterData(const bool aMoreClusterData);
-
-    /**
-     *  @brief Mark the end of this AttributeDataElement
-     *
-     *  @return A reference to *this
-     */
-    AttributeDataElement::Builder & EndOfAttributeDataElement();
-
-private:
-    AttributePath::Builder mAttributePathBuilder;
-};
-}; // namespace AttributeDataElement
-
-namespace AttributeDataList {
-class Parser : public ListParser
-{
-public:
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-};
-
-class Builder : public ListBuilder
-{
-public:
-    /**
-     *  @brief Initialize a AttributeDataElement::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributeDataElement::Builder
-     */
-    AttributeDataElement::Builder & CreateAttributeDataElementBuilder();
-
-    /**
-     *  @brief Mark the end of this AttributeDataList
-     *
-     *  @return A reference to *this
-     */
-    AttributeDataList::Builder & EndOfAttributeDataList();
-
-private:
-    AttributeDataElement::Builder mAttributeDataElementBuilder;
-};
-}; // namespace AttributeDataList
-
-namespace CommandDataElement {
-enum
-{
-    kCsTag_CommandPath   = 0,
-    kCsTag_Data          = 1,
-    kCsTag_StatusElement = 2,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this CommandDataElement
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the CommandPath. Next() must be called before accessing them.
-     *
-     *  @param [in] apCommandPath    A pointer to apCommandPath
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Path
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetCommandPath(CommandPath::Parser * const apCommandPath) const;
-
-    /**
-     *  @brief Get a TLVReader for the Data. Next() must be called before accessing them.
-     *
-     *  @param [in] apReader    A pointer to apReader
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetData(chip::TLV::TLVReader * const apReader) const;
-
-    /**
-     *  @brief Get a TLVReader for the Data. Next() must be called before accessing them.
-     *
-     *  @param [in] apStatusElement    A pointer to apStatusElement
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          # CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a structure
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetStatusElement(StatusElement::Parser * const apStatusElement) const;
-
-protected:
-    // A recursively callable function to parse a data element and pretty-print it.
-    CHIP_ERROR ParseData(chip::TLV::TLVReader & aReader, int aDepth) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a AttributeDataList::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     *  @brief Initialize a CommandPath::Builder for writing into the TLV stream
-     *
-     *  @return A reference to CommandPath::Builder
-     */
-    CommandPath::Builder & CreateCommandPathBuilder();
-
-    /**
-     *  @brief Initialize a StatusElement::Builder for writing into the TLV stream
-     *
-     *  @return A reference to StatusElement::Builder
-     */
-    StatusElement::Builder & CreateStatusElementBuilder();
-
-    /**
-     *  @brief Mark the end of this CommandDataElement
-     *
-     *  @return A reference to *this
-     */
-    CommandDataElement::Builder & EndOfCommandDataElement();
-
-private:
-    CommandPath::Builder mCommandPathBuilder;
-    StatusElement::Builder mStatusElementBuilder;
-};
-}; // namespace CommandDataElement
-
-namespace CommandList {
-class Parser : public ListParser
-{
-public:
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-};
-
-class Builder : public ListBuilder
-{
-public:
-    /**
-     *  @brief Initialize a CommandDataElement::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributeDataList::Builder
-     */
-    CommandDataElement::Builder & CreateCommandDataElementBuilder();
-
-    /**
-     *  @brief Mark the end of this CommandList
-     *
-     *  @return A reference to *this
-     */
-    CommandList::Builder & EndOfCommandList();
-
-private:
-    CommandDataElement::Builder mCommandDataElementBuilder;
-};
-}; // namespace CommandList
-
-namespace ReportData {
-enum
-{
-    kCsTag_RequestResponse     = 0,
-    kCsTag_SubscriptionId      = 1,
-    kCsTag_AttributeStatusList = 2,
-    kCsTag_AttributeDataList   = 3,
-    kCsTag_EventDataList       = 4,
-    kCsTag_IsLastReport        = 5,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this ReportData
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Check whether this message needs request response. Next() must be called before accessing them.
-     *
-     *  @param [in] apRequestResponse    A pointer to apRequestResponse
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetRequestResponse(bool * const apRequestResponse) const;
-
-    /**
-     *  @brief Get Subscription Id. Next() must be called before accessing them.
-     *
-     *  @param [in] apSubscriptionId    A pointer to apIsLastReport
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetSubscriptionId(uint64_t * const apSubscriptionId) const;
-
-    /**
-     *  @brief Get a TLVReader for the AttributesStatusList. Next() must be called before accessing them.
-     *
-     *  @param [in] apAttributeStatusList    A pointer to apAttributeStatusList
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Array
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetAttributeStatusList(AttributeStatusList::Parser * const apAttributeStatusList) const;
-
-    /**
-     *  @brief Get a TLVReader for the AttributesDataList. Next() must be called before accessing them.
-     *
-     *  @param [in] apAttributeDataList    A pointer to apAttributeDataList
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Array
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetAttributeDataList(AttributeDataList::Parser * const apAttributeDataList) const;
-
-    /**
-     *  @brief Get a TLVReader for the EventDataList. Next() must be called before accessing them.
-     *
-     *  @param [in] apEventDataList    A pointer to apEventDataList
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Array
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetEventDataList(EventList::Parser * const apEventDataList) const;
-
-    /**
-     *  @brief Check whether this message is last report. Next() must be called before accessing them.
-     *
-     *  @param [in] apIsLastReport    A pointer to apIsLastReport
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetIsLastReport(bool * const apIsLastReport) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a ReportData::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     *  @brief Inject RequestResponse into the TLV stream to indicate whether a response (a StatusReponse specifically)
-     *  is to be sent back to the request.
-     *
-     *  @param [in] aRequestResponse The boolean variable to indicate if request response is needed.
-     *
-     *  @return A reference to *this
-     */
-    ReportData::Builder & RequestResponse(const bool aRequestResponse);
-
-    /**
-     *  @brief Inject subscription id into the TLV stream, This field contains the Subscription ID
-     *  to which the data is being sent against. This is not present when the ReportDataRequest is
-     *  sent in response to a ReadRequest, but is present when sent in response to a SubscribeRequest.
-     *  Attempts should be made to ensure the SubscriptionId does not collide with IDs from previous
-     *  subscriptions to ensure disambiguation.
-     *
-     *  @param [in] aSubscriptionId  Subscription Id for this report data
-     *
-     *  @return A reference to *this
-     */
-    ReportData::Builder & SubscriptionId(const uint64_t aSubscriptionId);
-
-    /**
-     *  @brief Initialize a AttributeStatusList::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributeStatusList::Builder
-     */
-    AttributeStatusList::Builder & CreateAttributeStatusListBuilder();
-
-    /**
-     *  @brief Initialize a AttributeDataList::Builder for writing into the TLV stream
-     *
-     *  @return A reference to AttributeDataList::Builder
-     */
-    AttributeDataList::Builder & CreateAttributeDataListBuilder();
-
-    /**
-     *  @brief Initialize a EventList::Builder for writing into the TLV stream
-     *
-     *  @return A reference to EventList::Builder
-     */
-    EventList::Builder & CreateEventDataListBuilder();
-
-    /**
-     *  @brief This flag is set to ‘true’ when this is the last ReportDataRequest message
-     *  in a transaction and there are no more Changes to be conveyed.
-     *  @param [in] aIsLastReport The boolean variable to indicate if it is LastReport
-     *  @return A reference to *this
-     */
-    ReportData::Builder & IsLastReport(const bool aIsLastReport);
-
-    /**
-     *  @brief Mark the end of this ReportData
-     *
-     *  @return A reference to *this
-     */
-    ReportData::Builder & EndOfReportData();
-
-private:
-    AttributeStatusList::Builder mAttributeStatusListBuilder;
-    AttributeDataList::Builder mAttributeDataListBuilder;
-    EventList::Builder mEventDataListBuilder;
-};
-}; // namespace ReportData
-
-namespace InvokeCommand {
-enum
-{
-    kCsTag_CommandList = 0,
-};
-
-class Parser : public chip::app::Parser
-{
-public:
-    /**
-     *  @brief Initialize the parser object with TLVReader
-     *
-     *  @param [in] aReader A pointer to a TLVReader, which should point to the beginning of this request
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(const chip::TLV::TLVReader & aReader);
-
-    /**
-     *  @brief Roughly verify the message is correctly formed
-     *   1) all mandatory tags are present
-     *   2) all elements have expected data type
-     *   3) any tag can only appear once
-     *   4) At the top level of the structure, unknown tags are ignored for forward compatibility
-     *  @note The main use of this function is to print out what we're
-     *    receiving during protocol development and debugging.
-     *    The encoding rule has changed in IM encoding spec so this
-     *    check is only "roughly" conformant now.
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR CheckSchemaValidity() const;
-
-    /**
-     *  @brief Get a TLVReader for the CommandList. Next() must be called before accessing them.
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     *          #CHIP_END_OF_TLV if there is no such element
-     */
-    CHIP_ERROR GetCommandList(CommandList::Parser * const apCommandList) const;
-};
-
-class Builder : public chip::app::Builder
-{
-public:
-    /**
-     *  @brief Initialize a InvokeCommand::Builder for writing into a TLV stream
-     *
-     *  @param [in] apWriter    A pointer to TLVWriter
-     *
-     *  @return #CHIP_NO_ERROR on success
-     */
-    CHIP_ERROR Init(chip::TLV::TLVWriter * const apWriter);
-
-    /**
-     *  @brief Initialize a CommandList::Builder for writing into the TLV stream
-     *
-     *  @return A reference to Path::Builder
-     */
-    CommandList::Builder & CreateCommandListBuilder();
-
-    /**
-     *  @brief Mark the end of this InvokeCommand
-     *
-     *  @return A reference to *this
-     */
-    InvokeCommand::Builder & EndOfInvokeCommand();
-
-private:
-    CommandList::Builder mCommandListBuilder;
-};
-}; // namespace InvokeCommand
-
-}; // namespace app
-}; // namespace chip
-
-#endif // _CHIP_INTERACTION_MODEL_MESSAGE_DEF_H
index d80a5e9..437fd96 100644 (file)
@@ -30,7 +30,7 @@
 |---------------------------------------------------------------------+--------|
 | ApplicationBasic                                                    | 0x050D |
 | BarrierControl                                                      | 0x0103 |
-| Basic                                                               | 0x0000 |
+| Basic                                                               | 0x0028 |
 | Binding                                                             | 0xF000 |
 | ColorControl                                                        | 0x0300 |
 | ContentLaunch                                                       | 0xF002 |
@@ -200,15 +200,23 @@ chip::System::PacketBufferHandle encodeBarrierControlClusterReadClusterRevisionA
                                                                                          chip::EndpointId destinationEndpoint);
 
 /*----------------------------------------------------------------------------*\
-| Cluster Basic                                                       | 0x0000 |
+| Cluster Basic                                                       | 0x0028 |
 |------------------------------------------------------------------------------|
 | Commands:                                                           |        |
 | * MfgSpecificPing                                                   |   0x00 |
-| * ResetToFactoryDefaults                                            |   0x00 |
 |------------------------------------------------------------------------------|
 | Attributes:                                                         |        |
-| * ZclVersion                                                        | 0x0000 |
-| * PowerSource                                                       | 0x0007 |
+| * InteractionModelVersion                                           | 0x0000 |
+| * VendorName                                                        | 0x0001 |
+| * VendorID                                                          | 0x0002 |
+| * ProductName                                                       | 0x0003 |
+| * ProductID                                                         | 0x0004 |
+| * UserLabel                                                         | 0x0005 |
+| * Location                                                          | 0x0006 |
+| * HardwareVersion                                                   | 0x0007 |
+| * HardwareVersionString                                             | 0x0008 |
+| * SoftwareVersion                                                   | 0x0009 |
+| * SoftwareVersionString                                             | 0x000A |
 | * ClusterRevision                                                   | 0xFFFD |
 \*----------------------------------------------------------------------------*/
 
@@ -220,28 +228,94 @@ chip::System::PacketBufferHandle encodeBasicClusterMfgSpecificPingCommand(uint8_
 
 /**
  * @brief
- *    Encode an ResetToFactoryDefaults command for Basic server into buffer including the APS frame
+ *    Encode a Basic server discover command into buffer including the APS frame
  */
-chip::System::PacketBufferHandle encodeBasicClusterResetToFactoryDefaultsCommand(uint8_t seqNum,
-                                                                                 chip::EndpointId destinationEndpoint);
+chip::System::PacketBufferHandle encodeBasicClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint);
 
 /**
  * @brief
- *    Encode a Basic server discover command into buffer including the APS frame
+ *    Encode a Basic server read command for the InteractionModelVersion attribute into buffer including the APS frame
  */
-chip::System::PacketBufferHandle encodeBasicClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+chip::System::PacketBufferHandle encodeBasicClusterReadInteractionModelVersionAttribute(uint8_t seqNum,
+                                                                                        chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the VendorName attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadVendorNameAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the VendorID attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadVendorIDAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the ProductName attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadProductNameAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the ProductID attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadProductIDAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the UserLabel attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadUserLabelAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
 
 /**
  * @brief
- *    Encode a Basic server read command for the ZCL version attribute into buffer including the APS frame
+ *    Encode a Basic server write command for the UserLabel attribute into buffer including the APS frame
  */
-chip::System::PacketBufferHandle encodeBasicClusterReadZclVersionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+chip::System::PacketBufferHandle encodeBasicClusterWriteUserLabelAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint,
+                                                                           chip::ByteSpan userLabel);
 
 /**
  * @brief
- *    Encode a Basic server read command for the power source attribute into buffer including the APS frame
+ *    Encode a Basic server read command for the Location attribute into buffer including the APS frame
  */
-chip::System::PacketBufferHandle encodeBasicClusterReadPowerSourceAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+chip::System::PacketBufferHandle encodeBasicClusterReadLocationAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server write command for the Location attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterWriteLocationAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint,
+                                                                          chip::ByteSpan location);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the HardwareVersion attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadHardwareVersionAttribute(uint8_t seqNum,
+                                                                                chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the HardwareVersionString attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadHardwareVersionStringAttribute(uint8_t seqNum,
+                                                                                      chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the SoftwareVersion attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadSoftwareVersionAttribute(uint8_t seqNum,
+                                                                                chip::EndpointId destinationEndpoint);
+
+/**
+ * @brief
+ *    Encode a Basic server read command for the SoftwareVersionString attribute into buffer including the APS frame
+ */
+chip::System::PacketBufferHandle encodeBasicClusterReadSoftwareVersionStringAttribute(uint8_t seqNum,
+                                                                                      chip::EndpointId destinationEndpoint);
 
 /**
  * @brief
@@ -1166,7 +1240,7 @@ chip::System::PacketBufferHandle encodeDoorLockClusterGetYeardayScheduleCommand(
  *    Encode an LockDoor command for Door Lock server into buffer including the APS frame
  */
 chip::System::PacketBufferHandle encodeDoorLockClusterLockDoorCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint,
-                                                                      char * pin);
+                                                                      chip::ByteSpan pin);
 
 /**
  * @brief
@@ -1182,7 +1256,7 @@ encodeDoorLockClusterSetHolidayScheduleCommand(uint8_t seqNum, chip::EndpointId
  */
 chip::System::PacketBufferHandle encodeDoorLockClusterSetPinCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint,
                                                                     uint16_t userId, uint8_t userStatus, uint8_t userType,
-                                                                    char * pin);
+                                                                    chip::ByteSpan pin);
 
 /**
  * @brief
@@ -1190,7 +1264,7 @@ chip::System::PacketBufferHandle encodeDoorLockClusterSetPinCommand(uint8_t seqN
  */
 chip::System::PacketBufferHandle encodeDoorLockClusterSetRfidCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint,
                                                                      uint16_t userId, uint8_t userStatus, uint8_t userType,
-                                                                     char * id);
+                                                                     chip::ByteSpan id);
 
 /**
  * @brief
@@ -1222,14 +1296,14 @@ chip::System::PacketBufferHandle encodeDoorLockClusterSetYeardayScheduleCommand(
  *    Encode an UnlockDoor command for Door Lock server into buffer including the APS frame
  */
 chip::System::PacketBufferHandle encodeDoorLockClusterUnlockDoorCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint,
-                                                                        char * pin);
+                                                                        chip::ByteSpan pin);
 
 /**
  * @brief
  *    Encode an UnlockWithTimeout command for Door Lock server into buffer including the APS frame
  */
 chip::System::PacketBufferHandle encodeDoorLockClusterUnlockWithTimeoutCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint,
-                                                                               uint16_t timeoutInSeconds, char * pin);
+                                                                               uint16_t timeoutInSeconds, chip::ByteSpan pin);
 
 /**
  * @brief
@@ -1366,7 +1440,7 @@ encodeGeneralCommissioningClusterReadClusterRevisionAttribute(uint8_t seqNum, ch
  *    Encode an AddGroup command for Groups server into buffer including the APS frame
  */
 chip::System::PacketBufferHandle encodeGroupsClusterAddGroupCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint,
-                                                                    uint16_t groupId, char * groupName);
+                                                                    uint16_t groupId, chip::ByteSpan groupName);
 
 /**
  * @brief
@@ -1374,7 +1448,7 @@ chip::System::PacketBufferHandle encodeGroupsClusterAddGroupCommand(uint8_t seqN
  */
 chip::System::PacketBufferHandle encodeGroupsClusterAddGroupIfIdentifyingCommand(uint8_t seqNum,
                                                                                  chip::EndpointId destinationEndpoint,
-                                                                                 uint16_t groupId, char * groupName);
+                                                                                 uint16_t groupId, chip::ByteSpan groupName);
 
 /**
  * @brief
@@ -1978,8 +2052,8 @@ chip::System::PacketBufferHandle encodeOnOffClusterReadClusterRevisionAttribute(
  */
 chip::System::PacketBufferHandle encodeScenesClusterAddSceneCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint,
                                                                     uint16_t groupId, uint8_t sceneId, uint16_t transitionTime,
-                                                                    char * sceneName, chip::ClusterId clusterId, uint8_t length,
-                                                                    uint8_t value);
+                                                                    chip::ByteSpan sceneName, chip::ClusterId clusterId,
+                                                                    uint8_t length, uint8_t value);
 
 /**
  * @brief
index 8aa59ee..bee0afe 100644 (file)
@@ -101,7 +101,7 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a
 |---------------------------------------------------------------------+--------|
 | ApplicationBasic                                                    | 0x050D |
 | BarrierControl                                                      | 0x0103 |
-| Basic                                                               | 0x0000 |
+| Basic                                                               | 0x0028 |
 | Binding                                                             | 0xF000 |
 | ColorControl                                                        | 0x0300 |
 | ContentLaunch                                                       | 0xF002 |
@@ -151,9 +151,8 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a
 #define ZCL_BARRIER_CONTROL_GO_TO_PERCENT_COMMAND_ID (0x00)
 #define ZCL_BARRIER_CONTROL_STOP_COMMAND_ID (0x01)
 
-#define BASIC_CLUSTER_ID 0x0000
+#define BASIC_CLUSTER_ID 0x0028
 #define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
 
 #define BINDING_CLUSTER_ID 0xF000
 #define ZCL_BIND_COMMAND_ID (0x00)
@@ -417,6 +416,7 @@ PacketBufferHandle encodeBarrierControlClusterBarrierControlGoToPercentCommand(u
                                                                                uint8_t percentOpen)
 {
     COMMAND_HEADER("BarrierControlGoToPercent", BARRIER_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_BARRIER_CONTROL_GO_TO_PERCENT_COMMAND_ID).Put8(percentOpen);
     COMMAND_FOOTER();
 }
@@ -489,15 +489,23 @@ PacketBufferHandle encodeBarrierControlClusterReadClusterRevisionAttribute(uint8
 }
 
 /*----------------------------------------------------------------------------*\
-| Cluster Basic                                                       | 0x0000 |
+| Cluster Basic                                                       | 0x0028 |
 |------------------------------------------------------------------------------|
 | Commands:                                                           |        |
 | * MfgSpecificPing                                                   |   0x00 |
-| * ResetToFactoryDefaults                                            |   0x00 |
 |------------------------------------------------------------------------------|
 | Attributes:                                                         |        |
-| * ZclVersion                                                        | 0x0000 |
-| * PowerSource                                                       | 0x0007 |
+| * InteractionModelVersion                                           | 0x0000 |
+| * VendorName                                                        | 0x0001 |
+| * VendorID                                                          | 0x0002 |
+| * ProductName                                                       | 0x0003 |
+| * ProductID                                                         | 0x0004 |
+| * UserLabel                                                         | 0x0005 |
+| * Location                                                          | 0x0006 |
+| * HardwareVersion                                                   | 0x0007 |
+| * HardwareVersionString                                             | 0x0008 |
+| * SoftwareVersion                                                   | 0x0009 |
+| * SoftwareVersionString                                             | 0x000A |
 | * ClusterRevision                                                   | 0xFFFD |
 \*----------------------------------------------------------------------------*/
 
@@ -511,44 +519,165 @@ PacketBufferHandle encodeBasicClusterMfgSpecificPingCommand(uint8_t seqNum, Endp
     COMMAND_FOOTER();
 }
 
+PacketBufferHandle encodeBasicClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("DiscoverBasicAttributes", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
+    COMMAND_FOOTER();
+}
+
 /*
- * Command ResetToFactoryDefaults
+ * Attribute InteractionModelVersion
  */
-PacketBufferHandle encodeBasicClusterResetToFactoryDefaultsCommand(uint8_t seqNum, EndpointId destinationEndpoint)
+PacketBufferHandle encodeBasicClusterReadInteractionModelVersionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
 {
-    COMMAND_HEADER("ResetToFactoryDefaults", BASIC_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID);
+    COMMAND_HEADER("ReadBasicInteractionModelVersion", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
     COMMAND_FOOTER();
 }
 
-PacketBufferHandle encodeBasicClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
+/*
+ * Attribute VendorName
+ */
+PacketBufferHandle encodeBasicClusterReadVendorNameAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
 {
-    COMMAND_HEADER("DiscoverBasicAttributes", BASIC_CLUSTER_ID);
-    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
+    COMMAND_HEADER("ReadBasicVendorName", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001);
     COMMAND_FOOTER();
 }
 
 /*
- * Attribute ZclVersion
+ * Attribute VendorID
  */
-PacketBufferHandle encodeBasicClusterReadZclVersionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+PacketBufferHandle encodeBasicClusterReadVendorIDAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
 {
-    COMMAND_HEADER("ReadBasicZclVersion", BASIC_CLUSTER_ID);
-    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
+    COMMAND_HEADER("ReadBasicVendorID", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002);
+    COMMAND_FOOTER();
+}
+
+/*
+ * Attribute ProductName
+ */
+PacketBufferHandle encodeBasicClusterReadProductNameAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("ReadBasicProductName", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0003);
+    COMMAND_FOOTER();
+}
+
+/*
+ * Attribute ProductID
+ */
+PacketBufferHandle encodeBasicClusterReadProductIDAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("ReadBasicProductID", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0004);
     COMMAND_FOOTER();
 }
 
 /*
- * Attribute PowerSource
+ * Attribute UserLabel
  */
-PacketBufferHandle encodeBasicClusterReadPowerSourceAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+PacketBufferHandle encodeBasicClusterReadUserLabelAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
 {
-    COMMAND_HEADER("ReadBasicPowerSource", BASIC_CLUSTER_ID);
+    COMMAND_HEADER("ReadBasicUserLabel", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0005);
+    COMMAND_FOOTER();
+}
+
+PacketBufferHandle encodeBasicClusterWriteUserLabelAttribute(uint8_t seqNum, EndpointId destinationEndpoint,
+                                                             chip::ByteSpan userLabel)
+{
+    COMMAND_HEADER("WriteBasicUserLabel", BASIC_CLUSTER_ID);
+    size_t userLabelStrLen = userLabel.size();
+    if (!CanCastTo<uint8_t>(userLabelStrLen))
+    {
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, userLabelStrLen);
+        return PacketBufferHandle();
+    }
+
+    buf.Put8(kFrameControlGlobalCommand)
+        .Put8(seqNum)
+        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
+        .Put16(0x0005)
+        .Put8(66)
+        .Put(static_cast<uint8_t>(userLabelStrLen))
+        .Put(userLabel.data(), userLabelStrLen);
+    COMMAND_FOOTER();
+}
+
+/*
+ * Attribute Location
+ */
+PacketBufferHandle encodeBasicClusterReadLocationAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("ReadBasicLocation", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0006);
+    COMMAND_FOOTER();
+}
+
+PacketBufferHandle encodeBasicClusterWriteLocationAttribute(uint8_t seqNum, EndpointId destinationEndpoint, chip::ByteSpan location)
+{
+    COMMAND_HEADER("WriteBasicLocation", BASIC_CLUSTER_ID);
+    size_t locationStrLen = location.size();
+    if (!CanCastTo<uint8_t>(locationStrLen))
+    {
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, locationStrLen);
+        return PacketBufferHandle();
+    }
+
+    buf.Put8(kFrameControlGlobalCommand)
+        .Put8(seqNum)
+        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
+        .Put16(0x0006)
+        .Put8(66)
+        .Put(static_cast<uint8_t>(locationStrLen))
+        .Put(location.data(), locationStrLen);
+    COMMAND_FOOTER();
+}
+
+/*
+ * Attribute HardwareVersion
+ */
+PacketBufferHandle encodeBasicClusterReadHardwareVersionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("ReadBasicHardwareVersion", BASIC_CLUSTER_ID);
     buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0007);
     COMMAND_FOOTER();
 }
 
 /*
+ * Attribute HardwareVersionString
+ */
+PacketBufferHandle encodeBasicClusterReadHardwareVersionStringAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("ReadBasicHardwareVersionString", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0008);
+    COMMAND_FOOTER();
+}
+
+/*
+ * Attribute SoftwareVersion
+ */
+PacketBufferHandle encodeBasicClusterReadSoftwareVersionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("ReadBasicSoftwareVersion", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0009);
+    COMMAND_FOOTER();
+}
+
+/*
+ * Attribute SoftwareVersionString
+ */
+PacketBufferHandle encodeBasicClusterReadSoftwareVersionStringAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
+{
+    COMMAND_HEADER("ReadBasicSoftwareVersionString", BASIC_CLUSTER_ID);
+    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x000A);
+    COMMAND_FOOTER();
+}
+
+/*
  * Attribute ClusterRevision
  */
 PacketBufferHandle encodeBasicClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
@@ -576,6 +705,7 @@ PacketBufferHandle encodeBindingClusterBindCommand(uint8_t seqNum, EndpointId de
                                                    chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId)
 {
     COMMAND_HEADER("Bind", BINDING_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_BIND_COMMAND_ID)
@@ -593,6 +723,7 @@ PacketBufferHandle encodeBindingClusterUnbindCommand(uint8_t seqNum, EndpointId
                                                      chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId)
 {
     COMMAND_HEADER("Unbind", BINDING_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_UNBIND_COMMAND_ID)
@@ -700,6 +831,7 @@ PacketBufferHandle encodeColorControlClusterMoveColorCommand(uint8_t seqNum, End
                                                              int16_t rateY, uint8_t optionsMask, uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveColor", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_COLOR_COMMAND_ID)
@@ -720,6 +852,7 @@ PacketBufferHandle encodeColorControlClusterMoveColorTemperatureCommand(uint8_t
                                                                         uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveColorTemperature", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID)
@@ -739,6 +872,7 @@ PacketBufferHandle encodeColorControlClusterMoveHueCommand(uint8_t seqNum, Endpo
                                                            uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveHue", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_HUE_COMMAND_ID)
@@ -756,6 +890,7 @@ PacketBufferHandle encodeColorControlClusterMoveSaturationCommand(uint8_t seqNum
                                                                   uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveSaturation", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_SATURATION_COMMAND_ID)
@@ -774,6 +909,7 @@ PacketBufferHandle encodeColorControlClusterMoveToColorCommand(uint8_t seqNum, E
                                                                uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveToColor", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_TO_COLOR_COMMAND_ID)
@@ -793,6 +929,7 @@ PacketBufferHandle encodeColorControlClusterMoveToColorTemperatureCommand(uint8_
                                                                           uint8_t optionsMask, uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveToColorTemperature", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID)
@@ -811,6 +948,7 @@ PacketBufferHandle encodeColorControlClusterMoveToHueCommand(uint8_t seqNum, End
                                                              uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveToHue", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_TO_HUE_COMMAND_ID)
@@ -830,6 +968,7 @@ PacketBufferHandle encodeColorControlClusterMoveToHueAndSaturationCommand(uint8_
                                                                           uint8_t optionsMask, uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveToHueAndSaturation", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID)
@@ -849,6 +988,7 @@ PacketBufferHandle encodeColorControlClusterMoveToSaturationCommand(uint8_t seqN
                                                                     uint8_t optionsMask, uint8_t optionsOverride)
 {
     COMMAND_HEADER("MoveToSaturation", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_TO_SATURATION_COMMAND_ID)
@@ -867,6 +1007,7 @@ PacketBufferHandle encodeColorControlClusterStepColorCommand(uint8_t seqNum, End
                                                              uint8_t optionsOverride)
 {
     COMMAND_HEADER("StepColor", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_STEP_COLOR_COMMAND_ID)
@@ -888,6 +1029,7 @@ PacketBufferHandle encodeColorControlClusterStepColorTemperatureCommand(uint8_t
                                                                         uint8_t optionsOverride)
 {
     COMMAND_HEADER("StepColorTemperature", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID)
@@ -909,6 +1051,7 @@ PacketBufferHandle encodeColorControlClusterStepHueCommand(uint8_t seqNum, Endpo
                                                            uint8_t optionsOverride)
 {
     COMMAND_HEADER("StepHue", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_STEP_HUE_COMMAND_ID)
@@ -928,6 +1071,7 @@ PacketBufferHandle encodeColorControlClusterStepSaturationCommand(uint8_t seqNum
                                                                   uint8_t optionsOverride)
 {
     COMMAND_HEADER("StepSaturation", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_STEP_SATURATION_COMMAND_ID)
@@ -946,6 +1090,7 @@ PacketBufferHandle encodeColorControlClusterStopMoveStepCommand(uint8_t seqNum,
                                                                 uint8_t optionsOverride)
 {
     COMMAND_HEADER("StopMoveStep", COLOR_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_STOP_MOVE_STEP_COMMAND_ID)
@@ -1835,6 +1980,7 @@ PacketBufferHandle encodeDoorLockClusterClearHolidayScheduleCommand(uint8_t seqN
                                                                     uint8_t scheduleId)
 {
     COMMAND_HEADER("ClearHolidaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID).Put8(scheduleId);
     COMMAND_FOOTER();
 }
@@ -1845,6 +1991,7 @@ PacketBufferHandle encodeDoorLockClusterClearHolidayScheduleCommand(uint8_t seqN
 PacketBufferHandle encodeDoorLockClusterClearPinCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
 {
     COMMAND_HEADER("ClearPin", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_PIN_COMMAND_ID).Put16(userId);
     COMMAND_FOOTER();
 }
@@ -1855,6 +2002,7 @@ PacketBufferHandle encodeDoorLockClusterClearPinCommand(uint8_t seqNum, Endpoint
 PacketBufferHandle encodeDoorLockClusterClearRfidCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
 {
     COMMAND_HEADER("ClearRfid", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_CLEAR_RFID_COMMAND_ID).Put16(userId);
     COMMAND_FOOTER();
 }
@@ -1866,6 +2014,7 @@ PacketBufferHandle encodeDoorLockClusterClearWeekdayScheduleCommand(uint8_t seqN
                                                                     uint8_t scheduleId, uint16_t userId)
 {
     COMMAND_HEADER("ClearWeekdaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID)
@@ -1881,6 +2030,7 @@ PacketBufferHandle encodeDoorLockClusterClearYeardayScheduleCommand(uint8_t seqN
                                                                     uint8_t scheduleId, uint16_t userId)
 {
     COMMAND_HEADER("ClearYeardaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID)
@@ -1896,6 +2046,7 @@ PacketBufferHandle encodeDoorLockClusterGetHolidayScheduleCommand(uint8_t seqNum
                                                                   uint8_t scheduleId)
 {
     COMMAND_HEADER("GetHolidaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID).Put8(scheduleId);
     COMMAND_FOOTER();
 }
@@ -1906,6 +2057,7 @@ PacketBufferHandle encodeDoorLockClusterGetHolidayScheduleCommand(uint8_t seqNum
 PacketBufferHandle encodeDoorLockClusterGetLogRecordCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t logIndex)
 {
     COMMAND_HEADER("GetLogRecord", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_LOG_RECORD_COMMAND_ID).Put16(logIndex);
     COMMAND_FOOTER();
 }
@@ -1916,6 +2068,7 @@ PacketBufferHandle encodeDoorLockClusterGetLogRecordCommand(uint8_t seqNum, Endp
 PacketBufferHandle encodeDoorLockClusterGetPinCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
 {
     COMMAND_HEADER("GetPin", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_PIN_COMMAND_ID).Put16(userId);
     COMMAND_FOOTER();
 }
@@ -1926,6 +2079,7 @@ PacketBufferHandle encodeDoorLockClusterGetPinCommand(uint8_t seqNum, EndpointId
 PacketBufferHandle encodeDoorLockClusterGetRfidCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
 {
     COMMAND_HEADER("GetRfid", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_RFID_COMMAND_ID).Put16(userId);
     COMMAND_FOOTER();
 }
@@ -1936,6 +2090,7 @@ PacketBufferHandle encodeDoorLockClusterGetRfidCommand(uint8_t seqNum, EndpointI
 PacketBufferHandle encodeDoorLockClusterGetUserTypeCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId)
 {
     COMMAND_HEADER("GetUserType", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_USER_TYPE_COMMAND_ID).Put16(userId);
     COMMAND_FOOTER();
 }
@@ -1947,6 +2102,7 @@ PacketBufferHandle encodeDoorLockClusterGetWeekdayScheduleCommand(uint8_t seqNum
                                                                   uint8_t scheduleId, uint16_t userId)
 {
     COMMAND_HEADER("GetWeekdaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID)
@@ -1962,6 +2118,7 @@ PacketBufferHandle encodeDoorLockClusterGetYeardayScheduleCommand(uint8_t seqNum
                                                                   uint8_t scheduleId, uint16_t userId)
 {
     COMMAND_HEADER("GetYeardaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID)
@@ -1973,20 +2130,21 @@ PacketBufferHandle encodeDoorLockClusterGetYeardayScheduleCommand(uint8_t seqNum
 /*
  * Command LockDoor
  */
-PacketBufferHandle encodeDoorLockClusterLockDoorCommand(uint8_t seqNum, EndpointId destinationEndpoint, char * pin)
+PacketBufferHandle encodeDoorLockClusterLockDoorCommand(uint8_t seqNum, EndpointId destinationEndpoint, chip::ByteSpan pin)
 {
     COMMAND_HEADER("LockDoor", DOOR_LOCK_CLUSTER_ID);
-    size_t pinStrLen = strlen(pin);
+    size_t pinStrLen = pin.size();
     if (!CanCastTo<uint8_t>(pinStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_LOCK_DOOR_COMMAND_ID)
         .Put(static_cast<uint8_t>(pinStrLen))
-        .Put(pin);
+        .Put(pin.data(), pin.size());
     COMMAND_FOOTER();
 }
 
@@ -1998,6 +2156,7 @@ PacketBufferHandle encodeDoorLockClusterSetHolidayScheduleCommand(uint8_t seqNum
                                                                   uint32_t localEndTime, uint8_t operatingModeDuringHoliday)
 {
     COMMAND_HEADER("SetHolidaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID)
@@ -2012,15 +2171,17 @@ PacketBufferHandle encodeDoorLockClusterSetHolidayScheduleCommand(uint8_t seqNum
  * Command SetPin
  */
 PacketBufferHandle encodeDoorLockClusterSetPinCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId,
-                                                      uint8_t userStatus, uint8_t userType, char * pin)
+                                                      uint8_t userStatus, uint8_t userType, chip::ByteSpan pin)
 {
     COMMAND_HEADER("SetPin", DOOR_LOCK_CLUSTER_ID);
-    size_t pinStrLen = strlen(pin);
+
+    size_t pinStrLen = pin.size();
     if (!CanCastTo<uint8_t>(pinStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_SET_PIN_COMMAND_ID)
@@ -2028,7 +2189,7 @@ PacketBufferHandle encodeDoorLockClusterSetPinCommand(uint8_t seqNum, EndpointId
         .Put8(userStatus)
         .Put8(userType)
         .Put(static_cast<uint8_t>(pinStrLen))
-        .Put(pin);
+        .Put(pin.data(), pin.size());
     COMMAND_FOOTER();
 }
 
@@ -2036,15 +2197,17 @@ PacketBufferHandle encodeDoorLockClusterSetPinCommand(uint8_t seqNum, EndpointId
  * Command SetRfid
  */
 PacketBufferHandle encodeDoorLockClusterSetRfidCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t userId,
-                                                       uint8_t userStatus, uint8_t userType, char * id)
+                                                       uint8_t userStatus, uint8_t userType, chip::ByteSpan id)
 {
     COMMAND_HEADER("SetRfid", DOOR_LOCK_CLUSTER_ID);
-    size_t idStrLen = strlen(id);
+
+    size_t idStrLen = id.size();
     if (!CanCastTo<uint8_t>(idStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, idStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_SET_RFID_COMMAND_ID)
@@ -2052,7 +2215,7 @@ PacketBufferHandle encodeDoorLockClusterSetRfidCommand(uint8_t seqNum, EndpointI
         .Put8(userStatus)
         .Put8(userType)
         .Put(static_cast<uint8_t>(idStrLen))
-        .Put(id);
+        .Put(id.data(), id.size());
     COMMAND_FOOTER();
 }
 
@@ -2063,6 +2226,7 @@ PacketBufferHandle encodeDoorLockClusterSetUserTypeCommand(uint8_t seqNum, Endpo
                                                            uint8_t userType)
 {
     COMMAND_HEADER("SetUserType", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_SET_USER_TYPE_COMMAND_ID).Put16(userId).Put8(userType);
     COMMAND_FOOTER();
 }
@@ -2076,6 +2240,7 @@ PacketBufferHandle encodeDoorLockClusterSetWeekdayScheduleCommand(uint8_t seqNum
                                                                   uint8_t endMinute)
 {
     COMMAND_HEADER("SetWeekdaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID)
@@ -2097,6 +2262,7 @@ PacketBufferHandle encodeDoorLockClusterSetYeardayScheduleCommand(uint8_t seqNum
                                                                   uint32_t localEndTime)
 {
     COMMAND_HEADER("SetYeardaySchedule", DOOR_LOCK_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID)
@@ -2110,20 +2276,21 @@ PacketBufferHandle encodeDoorLockClusterSetYeardayScheduleCommand(uint8_t seqNum
 /*
  * Command UnlockDoor
  */
-PacketBufferHandle encodeDoorLockClusterUnlockDoorCommand(uint8_t seqNum, EndpointId destinationEndpoint, char * pin)
+PacketBufferHandle encodeDoorLockClusterUnlockDoorCommand(uint8_t seqNum, EndpointId destinationEndpoint, chip::ByteSpan pin)
 {
     COMMAND_HEADER("UnlockDoor", DOOR_LOCK_CLUSTER_ID);
-    size_t pinStrLen = strlen(pin);
+    size_t pinStrLen = pin.size();
     if (!CanCastTo<uint8_t>(pinStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_UNLOCK_DOOR_COMMAND_ID)
         .Put(static_cast<uint8_t>(pinStrLen))
-        .Put(pin);
+        .Put(pin.data(), pin.size());
     COMMAND_FOOTER();
 }
 
@@ -2131,21 +2298,23 @@ PacketBufferHandle encodeDoorLockClusterUnlockDoorCommand(uint8_t seqNum, Endpoi
  * Command UnlockWithTimeout
  */
 PacketBufferHandle encodeDoorLockClusterUnlockWithTimeoutCommand(uint8_t seqNum, EndpointId destinationEndpoint,
-                                                                 uint16_t timeoutInSeconds, char * pin)
+                                                                 uint16_t timeoutInSeconds, chip::ByteSpan pin)
 {
     COMMAND_HEADER("UnlockWithTimeout", DOOR_LOCK_CLUSTER_ID);
-    size_t pinStrLen = strlen(pin);
+
+    size_t pinStrLen = pin.size();
     if (!CanCastTo<uint8_t>(pinStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, pinStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID)
         .Put16(timeoutInSeconds)
         .Put(static_cast<uint8_t>(pinStrLen))
-        .Put(pin);
+        .Put(pin.data(), pin.size());
     COMMAND_FOOTER();
 }
 
@@ -2233,6 +2402,7 @@ PacketBufferHandle encodeGeneralCommissioningClusterArmFailSafeCommand(uint8_t s
                                                                        uint32_t timeoutMs)
 {
     COMMAND_HEADER("ArmFailSafe", GENERAL_COMMISSIONING_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_ARM_FAIL_SAFE_COMMAND_ID)
@@ -2260,22 +2430,26 @@ PacketBufferHandle encodeGeneralCommissioningClusterSetFabricCommand(uint8_t seq
                                                                      uint64_t breadcrumb, uint32_t timeoutMs)
 {
     COMMAND_HEADER("SetFabric", GENERAL_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(fabricId.size()))
+    size_t fabricIdStrLen = fabricId.size();
+    if (!CanCastTo<uint8_t>(fabricIdStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, fabricId.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, fabricIdStrLen);
         return PacketBufferHandle();
     }
-    if (!CanCastTo<uint8_t>(fabricSecret.size()))
+
+    size_t fabricSecretStrLen = fabricSecret.size();
+    if (!CanCastTo<uint8_t>(fabricSecretStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, fabricSecret.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, fabricSecretStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_SET_FABRIC_COMMAND_ID)
-        .Put(static_cast<uint8_t>(fabricId.size()))
+        .Put(static_cast<uint8_t>(fabricIdStrLen))
         .Put(fabricId.data(), fabricId.size())
-        .Put(static_cast<uint8_t>(fabricSecret.size()))
+        .Put(static_cast<uint8_t>(fabricSecretStrLen))
         .Put(fabricSecret.data(), fabricSecret.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -2352,21 +2526,23 @@ PacketBufferHandle encodeGeneralCommissioningClusterReadClusterRevisionAttribute
  * Command AddGroup
  */
 PacketBufferHandle encodeGroupsClusterAddGroupCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
-                                                      char * groupName)
+                                                      chip::ByteSpan groupName)
 {
     COMMAND_HEADER("AddGroup", GROUPS_CLUSTER_ID);
-    size_t groupNameStrLen = strlen(groupName);
+
+    size_t groupNameStrLen = groupName.size();
     if (!CanCastTo<uint8_t>(groupNameStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, groupNameStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_ADD_GROUP_COMMAND_ID)
         .Put16(groupId)
         .Put(static_cast<uint8_t>(groupNameStrLen))
-        .Put(groupName);
+        .Put(groupName.data(), groupName.size());
     COMMAND_FOOTER();
 }
 
@@ -2374,21 +2550,23 @@ PacketBufferHandle encodeGroupsClusterAddGroupCommand(uint8_t seqNum, EndpointId
  * Command AddGroupIfIdentifying
  */
 PacketBufferHandle encodeGroupsClusterAddGroupIfIdentifyingCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
-                                                                   char * groupName)
+                                                                   chip::ByteSpan groupName)
 {
     COMMAND_HEADER("AddGroupIfIdentifying", GROUPS_CLUSTER_ID);
-    size_t groupNameStrLen = strlen(groupName);
+
+    size_t groupNameStrLen = groupName.size();
     if (!CanCastTo<uint8_t>(groupNameStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, groupNameStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID)
         .Put16(groupId)
         .Put(static_cast<uint8_t>(groupNameStrLen))
-        .Put(groupName);
+        .Put(groupName.data(), groupName.size());
     COMMAND_FOOTER();
 }
 
@@ -2399,6 +2577,7 @@ PacketBufferHandle encodeGroupsClusterGetGroupMembershipCommand(uint8_t seqNum,
                                                                 uint16_t groupList)
 {
     COMMAND_HEADER("GetGroupMembership", GROUPS_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID)
@@ -2423,6 +2602,7 @@ PacketBufferHandle encodeGroupsClusterRemoveAllGroupsCommand(uint8_t seqNum, End
 PacketBufferHandle encodeGroupsClusterRemoveGroupCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
 {
     COMMAND_HEADER("RemoveGroup", GROUPS_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REMOVE_GROUP_COMMAND_ID).Put16(groupId);
     COMMAND_FOOTER();
 }
@@ -2433,6 +2613,7 @@ PacketBufferHandle encodeGroupsClusterRemoveGroupCommand(uint8_t seqNum, Endpoin
 PacketBufferHandle encodeGroupsClusterViewGroupCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
 {
     COMMAND_HEADER("ViewGroup", GROUPS_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_VIEW_GROUP_COMMAND_ID).Put16(groupId);
     COMMAND_FOOTER();
 }
@@ -2576,6 +2757,7 @@ PacketBufferHandle encodeIasZoneClusterReadClusterRevisionAttribute(uint8_t seqN
 PacketBufferHandle encodeIdentifyClusterIdentifyCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t identifyTime)
 {
     COMMAND_HEADER("Identify", IDENTIFY_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_IDENTIFY_COMMAND_ID).Put16(identifyTime);
     COMMAND_FOOTER();
 }
@@ -2655,6 +2837,7 @@ PacketBufferHandle encodeLevelControlClusterMoveCommand(uint8_t seqNum, Endpoint
                                                         uint8_t rate, uint8_t optionMask, uint8_t optionOverride)
 {
     COMMAND_HEADER("Move", LEVEL_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_COMMAND_ID)
@@ -2672,6 +2855,7 @@ PacketBufferHandle encodeLevelControlClusterMoveToLevelCommand(uint8_t seqNum, E
                                                                uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride)
 {
     COMMAND_HEADER("MoveToLevel", LEVEL_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_TO_LEVEL_COMMAND_ID)
@@ -2689,6 +2873,7 @@ PacketBufferHandle encodeLevelControlClusterMoveToLevelWithOnOffCommand(uint8_t
                                                                         uint8_t level, uint16_t transitionTime)
 {
     COMMAND_HEADER("MoveToLevelWithOnOff", LEVEL_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID)
@@ -2704,6 +2889,7 @@ PacketBufferHandle encodeLevelControlClusterMoveWithOnOffCommand(uint8_t seqNum,
                                                                  uint8_t rate)
 {
     COMMAND_HEADER("MoveWithOnOff", LEVEL_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_MOVE_WITH_ON_OFF_COMMAND_ID).Put8(moveMode).Put8(rate);
     COMMAND_FOOTER();
 }
@@ -2716,6 +2902,7 @@ PacketBufferHandle encodeLevelControlClusterStepCommand(uint8_t seqNum, Endpoint
                                                         uint8_t optionOverride)
 {
     COMMAND_HEADER("Step", LEVEL_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_STEP_COMMAND_ID)
@@ -2734,6 +2921,7 @@ PacketBufferHandle encodeLevelControlClusterStepWithOnOffCommand(uint8_t seqNum,
                                                                  uint8_t stepSize, uint16_t transitionTime)
 {
     COMMAND_HEADER("StepWithOnOff", LEVEL_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_STEP_WITH_ON_OFF_COMMAND_ID)
@@ -2750,6 +2938,7 @@ PacketBufferHandle encodeLevelControlClusterStopCommand(uint8_t seqNum, Endpoint
                                                         uint8_t optionOverride)
 {
     COMMAND_HEADER("Stop", LEVEL_CONTROL_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_STOP_COMMAND_ID).Put8(optionMask).Put8(optionOverride);
     COMMAND_FOOTER();
 }
@@ -3018,15 +3207,17 @@ PacketBufferHandle encodeNetworkCommissioningClusterAddThreadNetworkCommand(uint
                                                                             uint32_t timeoutMs)
 {
     COMMAND_HEADER("AddThreadNetwork", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(operationalDataset.size()))
+    size_t operationalDatasetStrLen = operationalDataset.size();
+    if (!CanCastTo<uint8_t>(operationalDatasetStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, operationalDataset.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, operationalDatasetStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_ADD_THREAD_NETWORK_COMMAND_ID)
-        .Put(static_cast<uint8_t>(operationalDataset.size()))
+        .Put(static_cast<uint8_t>(operationalDatasetStrLen))
         .Put(operationalDataset.data(), operationalDataset.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3041,22 +3232,26 @@ PacketBufferHandle encodeNetworkCommissioningClusterAddWiFiNetworkCommand(uint8_
                                                                           uint64_t breadcrumb, uint32_t timeoutMs)
 {
     COMMAND_HEADER("AddWiFiNetwork", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(ssid.size()))
+    size_t ssidStrLen = ssid.size();
+    if (!CanCastTo<uint8_t>(ssidStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, ssid.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, ssidStrLen);
         return PacketBufferHandle();
     }
-    if (!CanCastTo<uint8_t>(credentials.size()))
+
+    size_t credentialsStrLen = credentials.size();
+    if (!CanCastTo<uint8_t>(credentialsStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, credentials.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, credentialsStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_ADD_WI_FI_NETWORK_COMMAND_ID)
-        .Put(static_cast<uint8_t>(ssid.size()))
+        .Put(static_cast<uint8_t>(ssidStrLen))
         .Put(ssid.data(), ssid.size())
-        .Put(static_cast<uint8_t>(credentials.size()))
+        .Put(static_cast<uint8_t>(credentialsStrLen))
         .Put(credentials.data(), credentials.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3071,15 +3266,17 @@ PacketBufferHandle encodeNetworkCommissioningClusterDisableNetworkCommand(uint8_
                                                                           uint32_t timeoutMs)
 {
     COMMAND_HEADER("DisableNetwork", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(networkID.size()))
+    size_t networkIDStrLen = networkID.size();
+    if (!CanCastTo<uint8_t>(networkIDStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, networkID.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, networkIDStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_DISABLE_NETWORK_COMMAND_ID)
-        .Put(static_cast<uint8_t>(networkID.size()))
+        .Put(static_cast<uint8_t>(networkIDStrLen))
         .Put(networkID.data(), networkID.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3094,15 +3291,17 @@ PacketBufferHandle encodeNetworkCommissioningClusterEnableNetworkCommand(uint8_t
                                                                          uint32_t timeoutMs)
 {
     COMMAND_HEADER("EnableNetwork", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(networkID.size()))
+    size_t networkIDStrLen = networkID.size();
+    if (!CanCastTo<uint8_t>(networkIDStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, networkID.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, networkIDStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_ENABLE_NETWORK_COMMAND_ID)
-        .Put(static_cast<uint8_t>(networkID.size()))
+        .Put(static_cast<uint8_t>(networkIDStrLen))
         .Put(networkID.data(), networkID.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3117,6 +3316,7 @@ PacketBufferHandle encodeNetworkCommissioningClusterGetLastNetworkCommissioningR
                                                                                              uint32_t timeoutMs)
 {
     COMMAND_HEADER("GetLastNetworkCommissioningResult", NETWORK_COMMISSIONING_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID)
@@ -3132,15 +3332,17 @@ PacketBufferHandle encodeNetworkCommissioningClusterRemoveNetworkCommand(uint8_t
                                                                          uint32_t timeoutMs)
 {
     COMMAND_HEADER("RemoveNetwork", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(networkID.size()))
+    size_t networkIDStrLen = networkID.size();
+    if (!CanCastTo<uint8_t>(networkIDStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, networkID.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, networkIDStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_REMOVE_NETWORK_COMMAND_ID)
-        .Put(static_cast<uint8_t>(networkID.size()))
+        .Put(static_cast<uint8_t>(networkIDStrLen))
         .Put(networkID.data(), networkID.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3155,15 +3357,17 @@ PacketBufferHandle encodeNetworkCommissioningClusterScanNetworksCommand(uint8_t
                                                                         uint32_t timeoutMs)
 {
     COMMAND_HEADER("ScanNetworks", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(ssid.size()))
+    size_t ssidStrLen = ssid.size();
+    if (!CanCastTo<uint8_t>(ssidStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, ssid.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, ssidStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_SCAN_NETWORKS_COMMAND_ID)
-        .Put(static_cast<uint8_t>(ssid.size()))
+        .Put(static_cast<uint8_t>(ssidStrLen))
         .Put(ssid.data(), ssid.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3178,15 +3382,17 @@ PacketBufferHandle encodeNetworkCommissioningClusterUpdateThreadNetworkCommand(u
                                                                                uint64_t breadcrumb, uint32_t timeoutMs)
 {
     COMMAND_HEADER("UpdateThreadNetwork", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(operationalDataset.size()))
+    size_t operationalDatasetStrLen = operationalDataset.size();
+    if (!CanCastTo<uint8_t>(operationalDatasetStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, operationalDataset.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, operationalDatasetStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_UPDATE_THREAD_NETWORK_COMMAND_ID)
-        .Put(static_cast<uint8_t>(operationalDataset.size()))
+        .Put(static_cast<uint8_t>(operationalDatasetStrLen))
         .Put(operationalDataset.data(), operationalDataset.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3201,22 +3407,26 @@ PacketBufferHandle encodeNetworkCommissioningClusterUpdateWiFiNetworkCommand(uin
                                                                              uint64_t breadcrumb, uint32_t timeoutMs)
 {
     COMMAND_HEADER("UpdateWiFiNetwork", NETWORK_COMMISSIONING_CLUSTER_ID);
-    if (!CanCastTo<uint8_t>(ssid.size()))
+    size_t ssidStrLen = ssid.size();
+    if (!CanCastTo<uint8_t>(ssidStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, ssid.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, ssidStrLen);
         return PacketBufferHandle();
     }
-    if (!CanCastTo<uint8_t>(credentials.size()))
+
+    size_t credentialsStrLen = credentials.size();
+    if (!CanCastTo<uint8_t>(credentialsStrLen))
     {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, credentials.size());
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, credentialsStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_UPDATE_WI_FI_NETWORK_COMMAND_ID)
-        .Put(static_cast<uint8_t>(ssid.size()))
+        .Put(static_cast<uint8_t>(ssidStrLen))
         .Put(ssid.data(), ssid.size())
-        .Put(static_cast<uint8_t>(credentials.size()))
+        .Put(static_cast<uint8_t>(credentialsStrLen))
         .Put(credentials.data(), credentials.size())
         .Put64(breadcrumb)
         .Put32(timeoutMs);
@@ -3350,16 +3560,18 @@ PacketBufferHandle encodeOnOffClusterReadClusterRevisionAttribute(uint8_t seqNum
  * Command AddScene
  */
 PacketBufferHandle encodeScenesClusterAddSceneCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId,
-                                                      uint8_t sceneId, uint16_t transitionTime, char * sceneName,
+                                                      uint8_t sceneId, uint16_t transitionTime, chip::ByteSpan sceneName,
                                                       chip::ClusterId clusterId, uint8_t length, uint8_t value)
 {
     COMMAND_HEADER("AddScene", SCENES_CLUSTER_ID);
-    size_t sceneNameStrLen = strlen(sceneName);
+
+    size_t sceneNameStrLen = sceneName.size();
     if (!CanCastTo<uint8_t>(sceneNameStrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, sceneNameStrLen);
         return PacketBufferHandle();
     }
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_ADD_SCENE_COMMAND_ID)
@@ -3367,7 +3579,7 @@ PacketBufferHandle encodeScenesClusterAddSceneCommand(uint8_t seqNum, EndpointId
         .Put8(sceneId)
         .Put16(transitionTime)
         .Put(static_cast<uint8_t>(sceneNameStrLen))
-        .Put(sceneName)
+        .Put(sceneName.data(), sceneName.size())
         .Put16(clusterId)
         .Put8(length)
         .Put8(value);
@@ -3380,6 +3592,7 @@ PacketBufferHandle encodeScenesClusterAddSceneCommand(uint8_t seqNum, EndpointId
 PacketBufferHandle encodeScenesClusterGetSceneMembershipCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
 {
     COMMAND_HEADER("GetSceneMembership", SCENES_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID).Put16(groupId);
     COMMAND_FOOTER();
 }
@@ -3391,6 +3604,7 @@ PacketBufferHandle encodeScenesClusterRecallSceneCommand(uint8_t seqNum, Endpoin
                                                          uint8_t sceneId, uint16_t transitionTime)
 {
     COMMAND_HEADER("RecallScene", SCENES_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand)
         .Put8(seqNum)
         .Put8(ZCL_RECALL_SCENE_COMMAND_ID)
@@ -3406,6 +3620,7 @@ PacketBufferHandle encodeScenesClusterRecallSceneCommand(uint8_t seqNum, Endpoin
 PacketBufferHandle encodeScenesClusterRemoveAllScenesCommand(uint8_t seqNum, EndpointId destinationEndpoint, uint16_t groupId)
 {
     COMMAND_HEADER("RemoveAllScenes", SCENES_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REMOVE_ALL_SCENES_COMMAND_ID).Put16(groupId);
     COMMAND_FOOTER();
 }
@@ -3417,6 +3632,7 @@ PacketBufferHandle encodeScenesClusterRemoveSceneCommand(uint8_t seqNum, Endpoin
                                                          uint8_t sceneId)
 {
     COMMAND_HEADER("RemoveScene", SCENES_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REMOVE_SCENE_COMMAND_ID).Put16(groupId).Put8(sceneId);
     COMMAND_FOOTER();
 }
@@ -3428,6 +3644,7 @@ PacketBufferHandle encodeScenesClusterStoreSceneCommand(uint8_t seqNum, Endpoint
                                                         uint8_t sceneId)
 {
     COMMAND_HEADER("StoreScene", SCENES_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_STORE_SCENE_COMMAND_ID).Put16(groupId).Put8(sceneId);
     COMMAND_FOOTER();
 }
@@ -3439,6 +3656,7 @@ PacketBufferHandle encodeScenesClusterViewSceneCommand(uint8_t seqNum, EndpointI
                                                        uint8_t sceneId)
 {
     COMMAND_HEADER("ViewScene", SCENES_CLUSTER_ID);
+
     buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_VIEW_SCENE_COMMAND_ID).Put16(groupId).Put8(sceneId);
     COMMAND_FOOTER();
 }
index 19dd9f0..59984bd 100644 (file)
@@ -142,7 +142,12 @@ void StartServer()
     }
     else
     {
+// TODO: Thread devices are not able to advertise using mDNS before being provisioned,
+// so configuraton should be added to enable commissioning advertising based on supported
+// Rendezvous methods.
+#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD
         err = app::Mdns::AdvertiseCommisioning();
+#endif
     }
 
     if (err != CHIP_NO_ERROR)
index 5e86993..fa10c54 100644 (file)
@@ -531,6 +531,11 @@ void InitServer(AppDelegate * delegate)
 #endif
     }
 
+// Starting mDNS server only for Thread devices due to problem reported in issue #5076.
+#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
+    app::Mdns::StartServer();
+#endif
+
 exit:
     if (err != CHIP_NO_ERROR)
     {
index c35de4b..a536fa9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -90,7 +90,7 @@ CHIP_ERROR SendCommandRequest(void)
                                                         kTestGroupId,    // GroupId
                                                         kTestClusterId,  // ClusterId
                                                         kTestCommandId,  // CommandId
-                                                        (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                                        (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
 
     // Add command data here
 
index bde7daf..f4f3d3d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -60,7 +60,7 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
                                                         kTestGroupId,    // GroupId
                                                         kTestClusterId,  // ClusterId
                                                         kTestCommandId,  // CommandId
-                                                        (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                                        (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
 
     // Add command data here
 
index 017d7a0..981ec25 100644 (file)
@@ -73,7 +73,7 @@ bool IMEmberAfSendDefaultResponseWithCallback(EmberAfStatus status)
                                                              0, // GroupId
                                                              imCompatibilityEmberApsFrame.clusterId,
                                                              imCompatibilityEmberAfCluster.commandId,
-                                                             (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                                             (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
 
     chip::TLV::TLVType dummyType = chip::TLV::kTLVType_NotSpecified;
     chip::TLV::TLVWriter writer  = currentCommandObject->CreateCommandDataElementTLVWriter();
diff --git a/src/app/zap-templates/af-structs.zapt b/src/app/zap-templates/af-structs.zapt
deleted file mode 100644 (file)
index 069e383..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-#include <stdint.h>
-#include "basic-types.h"
-#include "enums.h"
-
-{{#zcl_structs}}
-
-// Struct for {{label}}
-typedef struct _{{asType label}} {
-{{#zcl_struct_items}}
-{{#if (isStrEqual label "endpoint")}}
-{{ident}}chip::EndpointId {{asSymbol label}};
-{{else if (isStrEqual label "endpointId")}}
-{{ident}}chip::EndpointId {{asSymbol label}};
-{{else if (isStrEqual type "CLUSTER_ID")}}
-{{ident}}chip::ClusterId {{asSymbol label}};
-{{else if (isStrEqual type "ATTRIBUTE_ID")}}
-{{ident}}chip::AttributeId {{asSymbol label}};
-{{else if (isStrEqual label "groupId")}}
-{{ident}}chip::GroupId {{asSymbol label}};
-{{else if (isStrEqual label "commandId")}}
-{{ident}}chip::CommandId {{asSymbol label}};
-{{else}}
-{{ident}}{{asUnderlyingType type}} {{asSymbol label}};
-{{/if}}
-{{/zcl_struct_items}}
-} {{asUnderlyingType label}};
-{{/zcl_structs}}
diff --git a/src/app/zap-templates/att-storage.zapt b/src/app/zap-templates/att-storage.zapt
deleted file mode 100644 (file)
index b0491aa..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// Attribute masks modify how attributes are used by the framework
-//
-// Attribute that has this mask is NOT read-only
-#define ATTRIBUTE_MASK_WRITABLE (0x01)
-// Attribute that has this mask is saved to a token
-#define ATTRIBUTE_MASK_TOKENIZE (0x02)
-// Attribute that has this mask has a min/max values
-#define ATTRIBUTE_MASK_MIN_MAX (0x04)
-// Manufacturer specific attribute
-#define ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC (0x08)
-// Attribute deferred to external storage
-#define ATTRIBUTE_MASK_EXTERNAL_STORAGE (0x10)
-// Attribute is singleton
-#define ATTRIBUTE_MASK_SINGLETON (0x20)
-// Attribute is a client attribute
-#define ATTRIBUTE_MASK_CLIENT (0x40)
-
-// Cluster masks modify how clusters are used by the framework
-//
-// Does this cluster have init function?
-#define CLUSTER_MASK_INIT_FUNCTION (0x01)
-// Does this cluster have attribute changed function?
-#define CLUSTER_MASK_ATTRIBUTE_CHANGED_FUNCTION (0x02)
-// Does this cluster have default response function?
-#define CLUSTER_MASK_DEFAULT_RESPONSE_FUNCTION (0x04)
-// Does this cluster have message sent function?
-#define CLUSTER_MASK_MESSAGE_SENT_FUNCTION (0x08)
-// Does this cluster have manufacturer specific attribute changed function?
-#define CLUSTER_MASK_MANUFACTURER_SPECIFIC_ATTRIBUTE_CHANGED_FUNCTION (0x10)
-// Does this cluster have pre-attribute changed function?
-#define CLUSTER_MASK_PRE_ATTRIBUTE_CHANGED_FUNCTION (0x20)
-// Cluster is a server
-#define CLUSTER_MASK_SERVER (0x40)
-// Cluster is a client
-#define CLUSTER_MASK_CLIENT (0x80)
-
-// Command masks modify meanings of commands
-//
-// Is sending of this client command supported
-#define COMMAND_MASK_OUTGOING_CLIENT (0x01)
-// Is sending of this server command supported
-#define COMMAND_MASK_OUTGOING_SERVER (0x02)
-// Is receiving of this client command supported
-#define COMMAND_MASK_INCOMING_CLIENT (0x04)
-// Is receiving of this server command supported
-#define COMMAND_MASK_INCOMING_SERVER (0x08)
-// Is this command manufacturer specific?
-#define COMMAND_MASK_MANUFACTURER_SPECIFIC (0x10)
diff --git a/src/app/zap-templates/attribute-id.zapt b/src/app/zap-templates/attribute-id.zapt
deleted file mode 100644 (file)
index 203aa4c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-{{#zcl_clusters}}
-// Attribute ids for cluster: {{label}}
-
-{{#zcl_attributes_client}}
-{{#first}}
-// Client attributes
-{{/first}}
-#define ZCL_{{asDelimitedMacro define}}_ATTRIBUTE_ID ({{asHex code 4}})
-{{#last}}
-
-{{/last}}
-{{/zcl_attributes_client}}
-{{#zcl_attributes_server}}
-{{#first}}
-// Server attributes
-{{/first}}
-#define ZCL_{{asDelimitedMacro define}}_ATTRIBUTE_ID ({{asHex code 4}})
-{{#last}}
-
-{{/last}}
-{{/zcl_attributes_server}}
-{{/zcl_clusters}}
diff --git a/src/app/zap-templates/attribute-size.zapt b/src/app/zap-templates/attribute-size.zapt
deleted file mode 100644 (file)
index 5002bb3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// ZCL attribute sizes
-{{#zcl_atomics}}
-{{#if size}}
-{{ident}}ZCL_{{asDelimitedMacro name}}_ATTRIBUTE_TYPE, {{size}}, \
-{{/if}}
-{{/zcl_atomics}}
diff --git a/src/app/zap-templates/attribute-type.zapt b/src/app/zap-templates/attribute-type.zapt
deleted file mode 100644 (file)
index c41da30..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// ZCL attribute types
-enum {
-{{#zcl_atomics}}
-{{ident}}ZCL_{{asDelimitedMacro name}}_ATTRIBUTE_TYPE = {{asHex atomicId 2}}, // {{description}}
-{{/zcl_atomics}}
-};
diff --git a/src/app/zap-templates/call-command-handler-src.zapt b/src/app/zap-templates/call-command-handler-src.zapt
deleted file mode 100644 (file)
index 796207c..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-{{chip_header}}
-
-#include <stdint.h>
-
-#include "af-structs.h"
-#include "call-command-handler.h"
-#include "callback.h"
-#include "command-id.h"
-#include "util.h"
-
-using namespace chip;
-
-{{#all_user_clusters}}
-{{#if (isEnabled enabled)}}
-EmberAfStatus emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(EmberAfClusterCommand * cmd);
-{{/if}}
-{{/all_user_clusters}}
-
-
-static EmberAfStatus status(bool wasHandled, bool clusterExists, bool mfgSpecific)
-{
-    if (wasHandled)
-    {
-        return EMBER_ZCL_STATUS_SUCCESS;
-    }
-    else if (mfgSpecific)
-    {
-        return EMBER_ZCL_STATUS_UNSUP_MANUF_CLUSTER_COMMAND;
-    }
-    else if (clusterExists)
-    {
-        return EMBER_ZCL_STATUS_UNSUP_COMMAND;
-    }
-    else
-    {
-        return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER;
-    }
-}
-
-
-// Main command parsing controller.
-EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
-{
-    EmberAfStatus result = status(false, false, cmd->mfgSpecific);
-    if (cmd->direction == (uint8_t) ZCL_DIRECTION_SERVER_TO_CLIENT &&
-        emberAfContainsClientWithMfgCode(cmd->apsFrame->destinationEndpoint, cmd->apsFrame->clusterId, cmd->mfgCode))
-    {
-        switch (cmd->apsFrame->clusterId)
-        {
-        {{#all_user_clusters}}
-        {{#if (isEnabled enabled)}}
-        {{#if (isClient side) }}
-        case ZCL_{{asDelimitedMacro define}}_ID :
-            result = emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(cmd);
-            break;
-        {{/if}}
-        {{/if}}
-        {{/all_user_clusters}}
-        default:
-            // Unrecognized cluster ID, error status will apply.
-            break;
-        }
-    }
-    else if (cmd->direction == (uint8_t) ZCL_DIRECTION_CLIENT_TO_SERVER &&
-             emberAfContainsServerWithMfgCode(cmd->apsFrame->destinationEndpoint, cmd->apsFrame->clusterId, cmd->mfgCode))
-    {
-        switch (cmd->apsFrame->clusterId)
-        {
-        {{#all_user_clusters}}
-        {{#if (isEnabled enabled)}}
-        {{#unless (isClient  side) }}
-        case ZCL_{{asDelimitedMacro define}}_ID :
-            result = emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(cmd);
-            break;
-        {{/unless}}
-        {{/if}}
-        {{/all_user_clusters}}
-        default:
-            // Unrecognized cluster ID, error status will apply.
-            break;
-        }
-    }
-    return result;
-}
-
-// Cluster specific command parsing
-
-{{#all_user_clusters}}
-{{#if (isEnabled enabled)}}
-EmberAfStatus emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        {{#all_user_cluster_commands}}
-        {{#if (isStrEqual clusterName parent.name)}}
-        {{#if (isCommandAvailable parent.side incoming outgoing commandSource name)}}
-        case ZCL_{{asDelimitedMacro name}}_COMMAND_ID: {
-            {{#if (zcl_command_arguments_count this.id)}}
-            uint32_t argOffset = 0;
-            {{#zcl_command_arguments}}
-            {{asUnderlyingType type}} * {{asSymbol label}} = ({{asUnderlyingType type}} *)(cmd->buffer + argOffset);
-            {{#unless (isLastElement index count)}}
-            argOffset+= sizeof({{asUnderlyingType type}});
-            {{/unless}}
-            {{/zcl_command_arguments}}
-
-            wasHandled = emberAf{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}Callback({{#zcl_command_arguments}} *{{asSymbol label}}{{#unless (isLastElement index count)}}, {{/unless}}{{/zcl_command_arguments}});
-            {{else}}
-            wasHandled = emberAf{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}Callback();
-            {{/if}}
-            break;
-        }
-        {{/if}}
-        {{/if}}
-        {{/all_user_cluster_commands}}
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
-{{/if}}
-{{/all_user_clusters}}
diff --git a/src/app/zap-templates/call-command-handler.zapt b/src/app/zap-templates/call-command-handler.zapt
deleted file mode 100644 (file)
index 6ab9791..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-#include "af-types.h"
diff --git a/src/app/zap-templates/callback-stub-src.zapt b/src/app/zap-templates/callback-stub-src.zapt
deleted file mode 100644 (file)
index f73a3f6..0000000
+++ /dev/null
@@ -1,550 +0,0 @@
-{{chip_header}}
-
-#include "callback.h"
-#include "cluster-id.h"
-
-using namespace chip;
-
-// Cluster Init Functions
-void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
-{
-    switch (clusterId)
-    {
-    {{#all_user_clusters_names}}
-     case ZCL_{{asDelimitedMacro define}}_ID :
-        emberAf{{asCamelCased name false}}ClusterInitCallback(endpoint);
-        break;
-    {{/all_user_clusters_names}}
-    default:
-        // Unrecognized cluster ID
-        break;
-    }
-}
-
-{{#all_user_clusters_names}}
-void __attribute__((weak)) emberAf{{asCamelCased name false}}ClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
-{{/all_user_clusters_names}}
-
-//
-// Non-Cluster Related Callbacks
-//
-
-/** @brief Add To Current App Tasks
- *
- * This function is only useful to sleepy end devices.  This function will note
- * the passed item as part of a set of tasks the application has outstanding
- * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
- * application behaves with regard to sleeping and polling.  Until the
- * outstanding task is completed, the device may poll more frequently and sleep
- * less often.
- *
- * @param tasks   Ver.: always
- */
-void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
-
-/** @brief Remove From Current App Tasks
- *
- * This function is only useful to sleepy end devices.  This function will
- * remove the passed item from the set of tasks the application has outstanding
- * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
- * application behaves with regard to sleeping and polling.  Removing the item
- * from the list of outstanding tasks may allow the device to sleep longer and
- * poll less frequently.  If there are other outstanding tasks the system may
- * still have to stay away and poll more often.
- *
- * @param tasks   Ver.: always
- */
-void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
-
-/** @brief Allow Network Write Attribute
- *
- * This function is called by the application framework before it writes an
- * attribute in response to a write attribute request from an external device.
- * The value passed into this callback is the value to which the attribute is to
- * be set by the framework.
-        Example:       In mirroring simple metering data
- * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
- * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
- * attributes on its mirror. The-meter-mirror sample application, located in
- * app/framework/sample-apps, uses this callback to allow the mirrored device to
- * write simple metering attributes on the mirror regardless of the fact that
- * most simple metering attributes are defined as read-only by the ZigBee
- * specification.
-        Note:  The ZCL specification does not (as of this
- * writing) specify any permission-level security for writing writeable
- * attributes. As far as the ZCL specification is concerned, if an attribute is
- * writeable, any device that has a link key for the device should be able to
- * write that attribute. Furthermore if an attribute is read only, it should not
- * be written over the air. Thus, if you implement permissions for writing
- * attributes as a feature, you MAY be operating outside the specification. This
- * is unlikely to be a problem for writing read-only attributes, but it may be a
- * problem for attributes that are writeable according to the specification but
- * restricted by the application implementing this callback.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeId   Ver.: always
- * @param mask   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param value   Ver.: always
- * @param type   Ver.: always
- */
-EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId,
-                                                                          AttributeId attributeId, uint8_t mask,
-                                                                          uint16_t manufacturerCode, uint8_t * value, uint8_t type)
-{
-    return EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL; // Default
-}
-
-/** @brief Attribute Read Access
- *
- * This function is called whenever the Application Framework needs to check
- * access permission for an attribute read.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param attributeId   Ver.: always
- */
-bool emberAfAttributeReadAccessCallback(EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode,
-                                        AttributeId attributeId)
-{
-    return true;
-}
-
-/** @brief Attribute Write Access
- *
- * This function is called whenever the Application Framework needs to check
- * access permission for an attribute write.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param attributeId   Ver.: always
- */
-bool emberAfAttributeWriteAccessCallback(EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode,
-                                         AttributeId attributeId)
-{
-    return true;
-}
-
-/** @brief Default Response
- *
- * This function is called by the application framework when a Default Response
- * command is received from an external device.  The application should return
- * true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param commandId The command identifier to which this is a response.  Ver.:
- * always
- * @param status Specifies either SUCCESS or the nature of the error that was
- * detected in the received command.  Ver.: always
- */
-bool emberAfDefaultResponseCallback(ClusterId clusterId, CommandId commandId, EmberAfStatus status)
-{
-    return false;
-}
-
-/** @brief Discover Attributes Response
- *
- * This function is called by the application framework when a Discover
- * Attributes Response or Discover Attributes Extended Response command is
- * received from an external device.  The Discover Attributes Response command
- * contains a bool indicating if discovery is complete and a list of zero or
- * more attribute identifier/type records. The final argument indicates whether
- * the response is in the extended format or not.  The application should return
- * true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param discoveryComplete Indicates whether there are more attributes to be
- * discovered.  true if there are no more attributes to be discovered.  Ver.:
- * always
- * @param buffer Buffer containing the list of attribute identifier/type
- * records.  Ver.: always
- * @param bufLen The length in bytes of the list.  Ver.: always
- * @param extended Indicates whether the response is in the extended format or
- * not.  Ver.: always
- */
-bool emberAfDiscoverAttributesResponseCallback(ClusterId clusterId, bool discoveryComplete, uint8_t * buffer,
-                                               uint16_t bufLen, bool extended)
-{
-    return false;
-}
-
-/** @brief Discover Commands Generated Response
- *
- * This function is called by the framework when Discover Commands Generated
- * Response is received.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param manufacturerCode Manufacturer code  Ver.: always
- * @param discoveryComplete Indicates whether there are more commands to be
- * discovered.  Ver.: always
- * @param commandIds Buffer containing the list of command identifiers.  Ver.:
- * always
- * @param commandIdCount The length of bytes of the list, whish is the same as
- * the number of identifiers.  Ver.: always
- */
-bool emberAfDiscoverCommandsGeneratedResponseCallback(ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
-                                                      CommandId * commandIds, uint16_t commandIdCount)
-{
-    return false;
-}
-
-/** @brief Discover Commands Received Response
- *
- * This function is called by the framework when Discover Commands Received
- * Response is received.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param manufacturerCode Manufacturer code  Ver.: always
- * @param discoveryComplete Indicates whether there are more commands to be
- * discovered.  Ver.: always
- * @param commandIds Buffer containing the list of command identifiers.  Ver.:
- * always
- * @param commandIdCount The length of bytes of the list, whish is the same as
- * the number of identifiers.  Ver.: always
- */
-bool emberAfDiscoverCommandsReceivedResponseCallback(ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
-                                                     CommandId * commandIds, uint16_t commandIdCount)
-{
-    return false;
-}
-
-/** @brief Pre Command Received
- *
- * This callback is the second in the Application Framework's message processing
- * chain. At this point in the processing of incoming over-the-air messages, the
- * application has determined that the incoming message is a ZCL command. It
- * parses enough of the message to populate an EmberAfClusterCommand struct. The
- * Application Framework defines this struct value in a local scope to the
- * command processing but also makes it available through a global pointer
- * called emberAfCurrentCommand, in app/framework/util/util.c. When command
- * processing is complete, this pointer is cleared.
- *
- * @param cmd   Ver.: always
- */
-bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd)
-{
-    return false;
-}
-
-/** @brief Pre Message Send
- *
- * This function is called by the framework when it is about to pass a message
- * to the stack primitives for sending.   This message may or may not be ZCL,
- * ZDO, or some other protocol.  This is called prior to
-        any ZigBee
- * fragmentation that may be done.  If the function returns true it is assumed
- * the callback has consumed and processed the message.  The callback must also
- * set the EmberStatus status code to be passed back to the caller.  The
- * framework will do no further processing on the message.
-        If the
- * function returns false then it is assumed that the callback has not processed
- * the mesasge and the framework will continue to process accordingly.
- *
- * @param messageStruct The structure containing the parameters of the APS
- * message to be sent.  Ver.: always
- * @param status A pointer to the status code value that will be returned to the
- * caller.  Ver.: always
- */
-bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status)
-{
-    return false;
-}
-
-/** @brief Message Sent
- *
- * This function is called by the application framework from the message sent
- * handler, when it is informed by the stack regarding the message sent status.
- * All of the values passed to the emberMessageSentHandler are passed on to this
- * callback. This provides an opportunity for the application to verify that its
- * message has been sent successfully and take the appropriate action. This
- * callback should return a bool value of true or false. A value of true
- * indicates that the message sent notification has been handled and should not
- * be handled by the application framework.
- *
- * @param type   Ver.: always
- * @param indexOrDestination   Ver.: always
- * @param apsFrame   Ver.: always
- * @param msgLen   Ver.: always
- * @param message   Ver.: always
- * @param status   Ver.: always
- */
-bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint16_t indexOrDestination, EmberApsFrame * apsFrame,
-                                uint16_t msgLen, uint8_t * message, EmberStatus status)
-{
-    return false;
-}
-
-/** @brief Pre Attribute Change
- *
- * This function is called by the application framework before it changes an
- * attribute value.  The value passed into this callback is the value to which
- * the attribute is to be set by the framework.  The application should return
- * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
- * to reject it.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeId   Ver.: always
- * @param mask   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param type   Ver.: always
- * @param size   Ver.: always
- * @param value   Ver.: always
- */
-EmberAfStatus emberAfPreAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId,
-                                                uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
-                                                uint8_t * value)
-{
-    return EMBER_ZCL_STATUS_SUCCESS;
-}
-
-/** @brief Post Attribute Change
- *
- * This function is called by the application framework after it changes an
- * attribute value. The value passed into this callback is the value to which
- * the attribute was set by the framework.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeId   Ver.: always
- * @param mask   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param type   Ver.: always
- * @param size   Ver.: always
- * @param value   Ver.: always
- */
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
-                                        uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value) {}
-
-/** @brief Read Attributes Response
- *
- * This function is called by the application framework when a Read Attributes
- * Response command is received from an external device.  The application should
- * return true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param buffer Buffer containing the list of read attribute status records.
- * Ver.: always
- * @param bufLen The length in bytes of the list.  Ver.: always
- */
-bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
-{
-    return false;
-}
-
-/** @brief External Attribute Read
- *
- * Like emberAfExternalAttributeWriteCallback above, this function is called
- * when the framework needs to read an attribute that is not stored within the
- * Application Framework's data structures.
-        All of the important
- * information about the attribute itself is passed as a pointer to an
- * EmberAfAttributeMetadata struct, which is stored within the application and
- * used to manage the attribute. A complete description of the
- * EmberAfAttributeMetadata struct is provided in
- * app/framework/include/af-types.h
-        This function assumes that the
- * application is able to read the attribute, write it into the passed buffer,
- * and return immediately. Any attributes that require a state machine for
- * reading and writing are not really candidates for externalization at the
- * present time. The Application Framework does not currently include a state
- * machine for reading or writing attributes that must take place across a
- * series of application ticks. Attributes that cannot be read in a timely
- * manner should be stored within the Application Framework and updated
- * occasionally by the application code from within the
- * emberAfMainTickCallback.
-        If the application was successfully able to
- * read the attribute and write it into the passed buffer, it should return a
- * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
- * managed attribute value is smaller than what the buffer can hold. In the case
- * of a buffer overflow throw an appropriate error such as
- * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
- * application was not able to read the attribute.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeMetadata   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param buffer   Ver.: always
- * @param maxReadLength   Ver.: always
- */
-EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId,
-                                                   EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
-                                                   uint8_t * buffer, uint16_t maxReadLength)
-{
-    return EMBER_ZCL_STATUS_FAILURE;
-}
-
-/** @brief Write Attributes Response
- *
- * This function is called by the application framework when a Write Attributes
- * Response command is received from an external device.  The application should
- * return true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param buffer Buffer containing the list of write attribute status records.
- * Ver.: always
- * @param bufLen The length in bytes of the list.  Ver.: always
- */
-bool emberAfWriteAttributesResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
-{
-    return false;
-}
-
-/** @brief External Attribute Write
- *
- * This function is called whenever the Application Framework needs to write an
- * attribute which is not stored within the data structures of the Application
- * Framework itself. One of the new features in Version 2 is the ability to
- * store attributes outside the Framework. This is particularly useful for
- * attributes that do not need to be stored because they can be read off the
- * hardware when they are needed, or are stored in some central location used by
- * many modules within the system. In this case, you can indicate that the
- * attribute is stored externally. When the framework needs to write an external
- * attribute, it makes a call to this callback.
-        This callback is very
- * useful for host micros which need to store attributes in persistent memory.
- * Because each host micro (used with an Ember NCP) has its own type of
- * persistent memory storage, the Application Framework does not include the
- * ability to mark attributes as stored in flash the way that it does for Ember
- * SoCs like the EM35x. On a host micro, any attributes that need to be stored
- * in persistent memory should be marked as external and accessed through the
- * external read and write callbacks. Any host code associated with the
- * persistent storage should be implemented within this callback.
-        All of
- * the important information about the attribute itself is passed as a pointer
- * to an EmberAfAttributeMetadata struct, which is stored within the application
- * and used to manage the attribute. A complete description of the
- * EmberAfAttributeMetadata struct is provided in
- * app/framework/include/af-types.h.
-        This function assumes that the
- * application is able to write the attribute and return immediately. Any
- * attributes that require a state machine for reading and writing are not
- * candidates for externalization at the present time. The Application Framework
- * does not currently include a state machine for reading or writing attributes
- * that must take place across a series of application ticks. Attributes that
- * cannot be written immediately should be stored within the Application
- * Framework and updated occasionally by the application code from within the
- * emberAfMainTickCallback.
-        If the application was successfully able to
- * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
- * other return value indicates the application was not able to write the
- * attribute.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeMetadata   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param buffer   Ver.: always
- */
-EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId,
-                                                    EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
-                                                    uint8_t * buffer)
-{
-    return EMBER_ZCL_STATUS_FAILURE;
-}
-
-/** @brief Report Attributes
- *
- * This function is called by the application framework when a Report Attributes
- * command is received from an external device.  The application should return
- * true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this command.  Ver.: always
- * @param buffer Buffer containing the list of attribute report records.  Ver.:
- * always
- * @param bufLen The length in bytes of the list.  Ver.: always
- */
-bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
-{
-    return false;
-}
-
-/** @brief Get Current Time
- *
- * This callback is called when device attempts to get current time from the
- * hardware. If this device has means to retrieve exact time, then this method
- * should implement it. If the callback can't provide the exact time it should
- * return 0 to indicate failure. Default action is to return 0, which indicates
- * that device does not have access to real time.
- *
- */
-uint32_t emberAfGetCurrentTimeCallback()
-{
-    return 0;
-}
-
-/** @brief Get Endpoint Info
- *
- * This function is a callback to an application implemented endpoint that
- * operates outside the normal application framework.  When the framework wishes
- * to perform operations with that endpoint it uses this callback to retrieve
- * the endpoint's information.  If the endpoint exists and the application can
- * provide data then true shall be returned.  Otherwise the callback must return
- * false.
- *
- * @param endpoint The endpoint to retrieve data for.  Ver.: always
- * @param returnNetworkIndex The index corresponding to the ZigBee network the
- * endpoint belongs to.  If not using a multi-network device, 0 must be
- * returned.  Otherwise on a multi-network device the stack will switch to this
- * network before sending the message.  Ver.: always
- * @param returnEndpointInfo A pointer to a data struct that will be written
- * with information about the endpoint.  Ver.: always
- */
-bool emberAfGetEndpointInfoCallback(EndpointId endpoint, uint8_t * returnNetworkIndex, EmberAfEndpointInfoStruct * returnEndpointInfo)
-{
-    return false;
-}
-
-/** @brief Get Source Route Overhead
- *
- * This function is called by the framework to determine the overhead required
- * in the network frame for source routing to a particular destination.
- *
- * @param destination The node id of the destination  Ver.: always
- */
-uint8_t emberAfGetSourceRouteOverheadCallback(EmberNodeId destination)
-{
-    return 0;
-}
-
-/** @brief Registration Abort
- *
- * This callback is called when the device should abort the registration
- * process.
- *
- */
-void emberAfRegistrationAbortCallback() {}
-
-/** @brief Interpan Send Message
- *
- * This function will send a raw MAC message with interpan frame format using
- * the passed parameters.
- *
- * @param header Interpan header info  Ver.: always
- * @param messageLength The length of the message received or to send  Ver.:
- * always
- * @param message The message data received or to send.  Ver.: always
- */
-EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message)
-{
-    return EMBER_LIBRARY_NOT_PRESENT;
-}
-
-/** @brief Start Move
- *
- * This function is called to initiate the process for a device to move (rejoin)
- * to a new parent.
- *
- */
-bool emberAfStartMoveCallback()
-{
-    return false;
-}
diff --git a/src/app/zap-templates/callback.zapt b/src/app/zap-templates/callback.zapt
deleted file mode 100644 (file)
index 30bd715..0000000
+++ /dev/null
@@ -1,591 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-#include "af-structs.h"
-#include "af-types.h"
-#include "basic-types.h"
-
-/** @brief Cluster Init
- *
- * This function is called when a specific cluster is initialized. It gives the
- * application an opportunity to take care of cluster initialization procedures.
- * It is called exactly once for each endpoint where cluster is present.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- */
-void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clusterId);
-
-// Cluster Init Functions
-
-{{#all_user_clusters_names}}
-
-/** @brief {{name}} Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAf{{asCamelCased name false}}ClusterInitCallback(chip::EndpointId endpoint);
-
-{{/all_user_clusters_names}}
-
-// Cluster Server/Client Init Functions
-
-{{#all_user_clusters}}
-
-//
-// {{name}} Cluster {{side}}
-//
-
-/** @brief {{name}} Cluster {{asCamelCased side false}} Init
- *
- * {{asCamelCased side false}} Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}InitCallback(chip::EndpointId endpoint);
-
-/** @brief {{name}} Cluster {{asCamelCased side false}} Attribute Changed
- *
- * {{asCamelCased side false}} Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}AttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief {{name}} Cluster {{asCamelCased side false}} Manufacturer Specific Attribute Changed
- *
- * {{asCamelCased side false}} 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 emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}ManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, uint16_t manufacturerCode);
-
-/** @brief {{name}} Cluster {{asCamelCased side false}} Message Sent
- *
- * {{asCamelCased side false}} 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 emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}MessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
-
-/** @brief {{name}} Cluster {{asCamelCased side false}} Pre Attribute Changed
- *
- * {{asCamelCased side}} 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 emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}PreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, EmberAfAttributeType attributeType, uint8_t size, uint8_t * value);
-
-/** @brief {{name}} Cluster {{asCamelCased side false}} Tick
- *
- * {{asCamelCased side}} Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}TickCallback(chip::EndpointId endpoint);
-{{/all_user_clusters}}
-
-// Cluster Commands Callback
-
-{{#all_user_clusters}}
-{{#if (isEnabled enabled)}}
-{{#all_user_cluster_commands}}
-{{#if (isStrEqual clusterName parent.name)}}
-{{#if (isCommandAvailable parent.side incoming outgoing commandSource)}}
-/**
-* @brief {{parent.name}} Cluster {{name}} Command callback
-{{#if (zcl_command_arguments_count this.id)}}
-{{#zcl_command_arguments}}
-* @param {{asCamelCased label}}
-{{/zcl_command_arguments}}
-{{/if}}
-*/
-
-{{#if (zcl_command_arguments_count this.id)}}
-bool emberAf{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}Callback({{#zcl_command_arguments}} {{asUnderlyingType type}} {{asSymbol label}}{{#unless (isLastElement index count)}}, {{/unless}}{{/zcl_command_arguments}});
-{{else}}
-bool emberAf{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}Callback();
-{{/if}}
-
-
-{{/if}}
-{{/if}}
-{{/all_user_cluster_commands}}
-{{/if}}
-{{/all_user_clusters}}
-
-//
-// Non-Cluster Related Callbacks
-//
-
-/** @brief Add To Current App Tasks
- *
- * This function is only useful to sleepy end devices.  This function will note
- * the passed item as part of a set of tasks the application has outstanding
- * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
- * application behaves with regard to sleeping and polling.  Until the
- * outstanding task is completed, the device may poll more frequently and sleep
- * less often.
- *
- * @param tasks   Ver.: always
- */
-void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks);
-
-/** @brief Remove From Current App Tasks
- *
- * This function is only useful to sleepy end devices.  This function will
- * remove the passed item from the set of tasks the application has outstanding
- * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
- * application behaves with regard to sleeping and polling.  Removing the item
- * from the list of outstanding tasks may allow the device to sleep longer and
- * poll less frequently.  If there are other outstanding tasks the system may
- * still have to stay away and poll more often.
- *
- * @param tasks   Ver.: always
- */
-void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks);
-
-/** @brief Allow Network Write Attribute
- *
- * This function is called by the application framework before it writes an
- * attribute in response to a write attribute request from an external device.
- * The value passed into this callback is the value to which the attribute is to
- * be set by the framework.
-        Example:       In mirroring simple metering data
- * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
- * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
- * attributes on its mirror. The-meter-mirror sample application, located in
- * app/framework/sample-apps, uses this callback to allow the mirrored device to
- * write simple metering attributes on the mirror regardless of the fact that
- * most simple metering attributes are defined as read-only by the ZigBee
- * specification.
-        Note:  The ZCL specification does not (as of this
- * writing) specify any permission-level security for writing writeable
- * attributes. As far as the ZCL specification is concerned, if an attribute is
- * writeable, any device that has a link key for the device should be able to
- * write that attribute. Furthermore if an attribute is read only, it should not
- * be written over the air. Thus, if you implement permissions for writing
- * attributes as a feature, you MAY be operating outside the specification. This
- * is unlikely to be a problem for writing read-only attributes, but it may be a
- * problem for attributes that are writeable according to the specification but
- * restricted by the application implementing this callback.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeId   Ver.: always
- * @param mask   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param value   Ver.: always
- * @param type   Ver.: always
- */
-EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
-                                                                          chip::AttributeId attributeId, uint8_t mask,
-                                                                          uint16_t manufacturerCode, uint8_t * value, uint8_t type);
-
-/** @brief Attribute Read Access
- *
- * This function is called whenever the Application Framework needs to check
- * access permission for an attribute read.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param attributeId   Ver.: always
- */
-bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
-                                        chip::AttributeId attributeId);
-
-/** @brief Attribute Write Access
- *
- * This function is called whenever the Application Framework needs to check
- * access permission for an attribute write.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param attributeId   Ver.: always
- */
-bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
-                                         chip::AttributeId attributeId);
-
-/** @brief Default Response
- *
- * This function is called by the application framework when a Default Response
- * command is received from an external device.  The application should return
- * true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param commandId The command identifier to which this is a response.  Ver.:
- * always
- * @param status Specifies either SUCCESS or the nature of the error that was
- * detected in the received command.  Ver.: always
- */
-bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);
-
-/** @brief Discover Attributes Response
- *
- * This function is called by the application framework when a Discover
- * Attributes Response or Discover Attributes Extended Response command is
- * received from an external device.  The Discover Attributes Response command
- * contains a bool indicating if discovery is complete and a list of zero or
- * more attribute identifier/type records. The final argument indicates whether
- * the response is in the extended format or not.  The application should return
- * true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param discoveryComplete Indicates whether there are more attributes to be
- * discovered.  true if there are no more attributes to be discovered.  Ver.:
- * always
- * @param buffer Buffer containing the list of attribute identifier/type
- * records.  Ver.: always
- * @param bufLen The length in bytes of the list.  Ver.: always
- * @param extended Indicates whether the response is in the extended format or
- * not.  Ver.: always
- */
-bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer,
-                                               uint16_t bufLen, bool extended);
-
-/** @brief Discover Commands Generated Response
- *
- * This function is called by the framework when Discover Commands Generated
- * Response is received.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param manufacturerCode Manufacturer code  Ver.: always
- * @param discoveryComplete Indicates whether there are more commands to be
- * discovered.  Ver.: always
- * @param commandIds Buffer containing the list of command identifiers.  Ver.:
- * always
- * @param commandIdCount The length of bytes of the list, whish is the same as
- * the number of identifiers.  Ver.: always
- */
-bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
-                                                      chip::CommandId * commandIds, uint16_t commandIdCount);
-
-
-/** @brief Discover Commands Received Response
- *
- * This function is called by the framework when Discover Commands Received
- * Response is received.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param manufacturerCode Manufacturer code  Ver.: always
- * @param discoveryComplete Indicates whether there are more commands to be
- * discovered.  Ver.: always
- * @param commandIds Buffer containing the list of command identifiers.  Ver.:
- * always
- * @param commandIdCount The length of bytes of the list, whish is the same as
- * the number of identifiers.  Ver.: always
- */
-bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
-                                                     chip::CommandId * commandIds, uint16_t commandIdCount);
-
-
-/** @brief Pre Command Received
- *
- * This callback is the second in the Application Framework's message processing
- * chain. At this point in the processing of incoming over-the-air messages, the
- * application has determined that the incoming message is a ZCL command. It
- * parses enough of the message to populate an EmberAfClusterCommand struct. The
- * Application Framework defines this struct value in a local scope to the
- * command processing but also makes it available through a global pointer
- * called emberAfCurrentCommand, in app/framework/util/util.c. When command
- * processing is complete, this pointer is cleared.
- *
- * @param cmd   Ver.: always
- */
-bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd);
-
-/** @brief Pre Message Send
- *
- * This function is called by the framework when it is about to pass a message
- * to the stack primitives for sending.   This message may or may not be ZCL,
- * ZDO, or some other protocol.  This is called prior to
-        any ZigBee
- * fragmentation that may be done.  If the function returns true it is assumed
- * the callback has consumed and processed the message.  The callback must also
- * set the EmberStatus status code to be passed back to the caller.  The
- * framework will do no further processing on the message.
-        If the
- * function returns false then it is assumed that the callback has not processed
- * the mesasge and the framework will continue to process accordingly.
- *
- * @param messageStruct The structure containing the parameters of the APS
- * message to be sent.  Ver.: always
- * @param status A pointer to the status code value that will be returned to the
- * caller.  Ver.: always
- */
-bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status);
-
-/** @brief Message Sent
- *
- * This function is called by the application framework from the message sent
- * handler, when it is informed by the stack regarding the message sent status.
- * All of the values passed to the emberMessageSentHandler are passed on to this
- * callback. This provides an opportunity for the application to verify that its
- * message has been sent successfully and take the appropriate action. This
- * callback should return a bool value of true or false. A value of true
- * indicates that the message sent notification has been handled and should not
- * be handled by the application framework.
- *
- * @param type   Ver.: always
- * @param indexOrDestination   Ver.: always
- * @param apsFrame   Ver.: always
- * @param msgLen   Ver.: always
- * @param message   Ver.: always
- * @param status   Ver.: always
- */
-bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint16_t indexOrDestination, EmberApsFrame * apsFrame,
-                                uint16_t msgLen, uint8_t * message, EmberStatus status);
-
-/** @brief Pre Attribute Change
- *
- * This function is called by the application framework before it changes an
- * attribute value.  The value passed into this callback is the value to which
- * the attribute is to be set by the framework.  The application should return
- * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
- * to reject it.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeId   Ver.: always
- * @param mask   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param type   Ver.: always
- * @param size   Ver.: always
- * @param value   Ver.: always
- */
-EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
-                                                uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
-                                                uint8_t * value);
-
-/** @brief Post Attribute Change
- *
- * This function is called by the application framework after it changes an
- * attribute value. The value passed into this callback is the value to which
- * the attribute was set by the framework.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeId   Ver.: always
- * @param mask   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param type   Ver.: always
- * @param size   Ver.: always
- * @param value   Ver.: always
- */
-void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t mask,
-                                        uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);
-
-/** @brief Read Attributes Response
- *
- * This function is called by the application framework when a Read Attributes
- * Response command is received from an external device.  The application should
- * return true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param buffer Buffer containing the list of read attribute status records.
- * Ver.: always
- * @param bufLen The length in bytes of the list.  Ver.: always
- */
-bool emberAfReadAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
-
-/** @brief External Attribute Read
- *
- * Like emberAfExternalAttributeWriteCallback above, this function is called
- * when the framework needs to read an attribute that is not stored within the
- * Application Framework's data structures.
-        All of the important
- * information about the attribute itself is passed as a pointer to an
- * EmberAfAttributeMetadata struct, which is stored within the application and
- * used to manage the attribute. A complete description of the
- * EmberAfAttributeMetadata struct is provided in
- * app/framework/include/af-types.h
-        This function assumes that the
- * application is able to read the attribute, write it into the passed buffer,
- * and return immediately. Any attributes that require a state machine for
- * reading and writing are not really candidates for externalization at the
- * present time. The Application Framework does not currently include a state
- * machine for reading or writing attributes that must take place across a
- * series of application ticks. Attributes that cannot be read in a timely
- * manner should be stored within the Application Framework and updated
- * occasionally by the application code from within the
- * emberAfMainTickCallback.
-        If the application was successfully able to
- * read the attribute and write it into the passed buffer, it should return a
- * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
- * managed attribute value is smaller than what the buffer can hold. In the case
- * of a buffer overflow throw an appropriate error such as
- * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
- * application was not able to read the attribute.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeMetadata   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param buffer   Ver.: always
- * @param maxReadLength   Ver.: always
- */
-EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
-                                                   EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
-                                                   uint8_t * buffer, uint16_t maxReadLength);
-
-/** @brief Write Attributes Response
- *
- * This function is called by the application framework when a Write Attributes
- * Response command is received from an external device.  The application should
- * return true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this response.  Ver.: always
- * @param buffer Buffer containing the list of write attribute status records.
- * Ver.: always
- * @param bufLen The length in bytes of the list.  Ver.: always
- */
-bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
-
-/** @brief External Attribute Write
- *
- * This function is called whenever the Application Framework needs to write an
- * attribute which is not stored within the data structures of the Application
- * Framework itself. One of the new features in Version 2 is the ability to
- * store attributes outside the Framework. This is particularly useful for
- * attributes that do not need to be stored because they can be read off the
- * hardware when they are needed, or are stored in some central location used by
- * many modules within the system. In this case, you can indicate that the
- * attribute is stored externally. When the framework needs to write an external
- * attribute, it makes a call to this callback.
-        This callback is very
- * useful for host micros which need to store attributes in persistent memory.
- * Because each host micro (used with an Ember NCP) has its own type of
- * persistent memory storage, the Application Framework does not include the
- * ability to mark attributes as stored in flash the way that it does for Ember
- * SoCs like the EM35x. On a host micro, any attributes that need to be stored
- * in persistent memory should be marked as external and accessed through the
- * external read and write callbacks. Any host code associated with the
- * persistent storage should be implemented within this callback.
-        All of
- * the important information about the attribute itself is passed as a pointer
- * to an EmberAfAttributeMetadata struct, which is stored within the application
- * and used to manage the attribute. A complete description of the
- * EmberAfAttributeMetadata struct is provided in
- * app/framework/include/af-types.h.
-        This function assumes that the
- * application is able to write the attribute and return immediately. Any
- * attributes that require a state machine for reading and writing are not
- * candidates for externalization at the present time. The Application Framework
- * does not currently include a state machine for reading or writing attributes
- * that must take place across a series of application ticks. Attributes that
- * cannot be written immediately should be stored within the Application
- * Framework and updated occasionally by the application code from within the
- * emberAfMainTickCallback.
-        If the application was successfully able to
- * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
- * other return value indicates the application was not able to write the
- * attribute.
- *
- * @param endpoint   Ver.: always
- * @param clusterId   Ver.: always
- * @param attributeMetadata   Ver.: always
- * @param manufacturerCode   Ver.: always
- * @param buffer   Ver.: always
- */
-EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
-                                                    EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
-                                                    uint8_t * buffer);
-
-/** @brief Report Attributes
- *
- * This function is called by the application framework when a Report Attributes
- * command is received from an external device.  The application should return
- * true if the message was processed or false if it was not.
- *
- * @param clusterId The cluster identifier of this command.  Ver.: always
- * @param buffer Buffer containing the list of attribute report records.  Ver.:
- * always
- * @param bufLen The length in bytes of the list.  Ver.: always
- */
-bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
-
-/** @brief Get Current Time
- *
- * This callback is called when device attempts to get current time from the
- * hardware. If this device has means to retrieve exact time, then this method
- * should implement it. If the callback can't provide the exact time it should
- * return 0 to indicate failure. Default action is to return 0, which indicates
- * that device does not have access to real time.
- *
- */
-uint32_t emberAfGetCurrentTimeCallback();
-
-/** @brief Get Endpoint Info
- *
- * This function is a callback to an application implemented endpoint that
- * operates outside the normal application framework.  When the framework wishes
- * to perform operations with that endpoint it uses this callback to retrieve
- * the endpoint's information.  If the endpoint exists and the application can
- * provide data then true shall be returned.  Otherwise the callback must return
- * false.
- *
- * @param endpoint The endpoint to retrieve data for.  Ver.: always
- * @param returnNetworkIndex The index corresponding to the ZigBee network the
- * endpoint belongs to.  If not using a multi-network device, 0 must be
- * returned.  Otherwise on a multi-network device the stack will switch to this
- * network before sending the message.  Ver.: always
- * @param returnEndpointInfo A pointer to a data struct that will be written
- * with information about the endpoint.  Ver.: always
- */
-bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex, EmberAfEndpointInfoStruct * returnEndpointInfo);
-
-/** @brief Get Source Route Overhead
- *
- * This function is called by the framework to determine the overhead required
- * in the network frame for source routing to a particular destination.
- *
- * @param destination The node id of the destination  Ver.: always
- */
-uint8_t emberAfGetSourceRouteOverheadCallback(EmberNodeId destination);
-
-/** @brief Registration Abort
- *
- * This callback is called when the device should abort the registration
- * process.
- *
- */
-void emberAfRegistrationAbortCallback();
-
-/** @brief Interpan Send Message
- *
- * This function will send a raw MAC message with interpan frame format using
- * the passed parameters.
- *
- * @param header Interpan header info  Ver.: always
- * @param messageLength The length of the message received or to send  Ver.:
- * always
- * @param message The message data received or to send.  Ver.: always
- */
-EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message);
-
-/** @brief Start Move
- *
- * This function is called to initiate the process for a device to move (rejoin)
- * to a new parent.
- *
- */
-bool emberAfStartMoveCallback();
-
diff --git a/src/app/zap-templates/client-command-macro.zapt b/src/app/zap-templates/client-command-macro.zapt
deleted file mode 100644 (file)
index fba147f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// TODO issue #3637
diff --git a/src/app/zap-templates/cluster-id.zapt b/src/app/zap-templates/cluster-id.zapt
deleted file mode 100644 (file)
index 4331eb3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-{{#zcl_clusters}}
-
-// Definitions for cluster: {{label}}
-#define ZCL_{{asDelimitedMacro define}}_ID ({{asHex code 4}})
-
-{{/zcl_clusters}}
diff --git a/src/app/zap-templates/command-id.zapt b/src/app/zap-templates/command-id.zapt
deleted file mode 100644 (file)
index 74a95c5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// Global, non-cluster-specific commands
-{{#zcl_global_commands}}
-#define ZCL_{{asDelimitedMacro label}}_COMMAND_ID ({{asHex code 2}})
-{{/zcl_global_commands}}
-
-{{#zcl_clusters}}
-
-{{#zcl_commands}}
-{{#first}}
-// Commands for cluster: {{parent.label}}
-{{/first}}
-#define ZCL_{{asDelimitedMacro label}}_COMMAND_ID ({{asHex code 2}})
-{{/zcl_commands}}
-{{/zcl_clusters}}
index 030082b..b3bc6f5 100644 (file)
  *    limitations under the License.
  */
 
-const stringShortTypes = [ 'CHAR_STRING', 'OCTET_STRING' ];
-const stringLongTypes  = [ 'LONG_CHAR_STRING', 'LONG_OCTET_STRING' ];
-const stringBytesTypes = [ 'OCTET_STRING', 'LONG_OCTET_STRING' ];
+const characterStringTypes = [ 'CHAR_STRING', 'LONG_CHAR_STRING' ];
+const octetStringTypes     = [ 'OCTET_STRING', 'LONG_OCTET_STRING' ];
+const stringShortTypes     = [ 'CHAR_STRING', 'OCTET_STRING' ];
+const stringLongTypes      = [ 'LONG_CHAR_STRING', 'LONG_OCTET_STRING' ];
 
-function isShortString(type)
+function isString(type)
 {
-  return stringShortTypes.includes(type);
+  return isCharString(type) || isOctetString(type);
 }
 
-function isLongString(type)
+function isCharString(type)
 {
-  return stringLongTypes.includes(type);
+  return characterStringTypes.includes(type.toUpperCase());
 }
 
-function isByteString(type)
+function isOctetString(type)
 {
-  return stringBytesTypes.includes(type);
+  return octetStringTypes.includes(type.toUpperCase());
 }
 
-function isString(type)
+function isShortString(type)
 {
-  return isShortString(type) || isLongString(type);
+  return stringShortTypes.includes(type.toUpperCase());
 }
 
-function isCharString(type)
+function isLongString(type)
 {
-  return isString(type) && !isByteString(type);
+  return stringLongTypes.includes(type.toUpperCase());
 }
 
 //
 // Module exports
 //
 exports.isString      = isString;
+exports.isCharString  = isCharString;
+exports.isOctetString = isOctetString;
 exports.isShortString = isShortString;
 exports.isLongString  = isLongString;
-exports.isByteString  = isByteString;
-exports.isCharString  = isCharString;
diff --git a/src/app/zap-templates/endpoint_config.zapt b/src/app/zap-templates/endpoint_config.zapt
deleted file mode 100644 (file)
index fba147f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// TODO issue #3637
diff --git a/src/app/zap-templates/enums.zapt b/src/app/zap-templates/enums.zapt
deleted file mode 100644 (file)
index 729329a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// ZCL enums
-
-{{#zcl_enums}}
-
-// Enum for {{label}}
-typedef enum {
-{{#zcl_enum_items}}
-{{ident}}EMBER_ZCL_{{asDelimitedMacro parent.label}}_{{asDelimitedMacro label}} = {{value}},
-{{/zcl_enum_items}}
-} EmberAf{{asType label}};
-{{/zcl_enums}}
-
-{{#zcl_bitmaps}}
-{{#zcl_bitmap_items}}
-#define EMBER_AF_{{asDelimitedMacro parent.label}}_{{asDelimitedMacro label}} ({{mask}})
-#define EMBER_AF_{{asDelimitedMacro parent.label}}_{{asDelimitedMacro label}}_OFFSET ({{asOffset mask}})
-{{/zcl_bitmap_items}}
-{{/zcl_bitmaps}}
diff --git a/src/app/zap-templates/gen_config.zapt b/src/app/zap-templates/gen_config.zapt
deleted file mode 100644 (file)
index 6988c01..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// User options for plugin Binding Table Library
-#define EMBER_BINDING_TABLE_SIZE 10
-
-/**** Network Section ****/
-#define EMBER_SUPPORTED_NETWORKS (1)
-
-
-#define EMBER_APS_UNICAST_MESSAGE_COUNT 10
-
-/**** Cluster endpoint counts ****/
-{{#all_user_clusters}}
-#define EMBER_AF_{{asDelimitedMacro define}}_{{asDelimitedMacro side}}_ENDPOINT_COUNT ({{user_endpoint_count_by_cluster id side}})
-{{/all_user_clusters}}
-
-/**** Cluster Plugins ****/
-{{#all_user_clusters}}
-
-// Use this macro to check if the {{side}} side of the {{name}} cluster is included
-#define ZCL_USING_{{asDelimitedMacro define}}_{{asDelimitedMacro side}}
-#define EMBER_AF_PLUGIN_{{asDelimitedMacro name}}_{{asDelimitedMacro side}}
-{{#if (isServer side)}}
-#define EMBER_AF_PLUGIN_{{asDelimitedMacro name}}
-{{/if}}
-{{#if (isStrEqual name "Color Control")}}
-{{#if (isServer side)}}
-// User options for {{side}} plugin {{name}}
-#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY
-#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP
-#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV
-{{/if}}
-{{else if (isStrEqual name "IAS Zone")}}
-// User options for {{side}} plugin {{name}}
-{{#if (isServer side)}}
-#define EMBER_AF_PLUGIN_IAS_ZONE_SERVER_ZONE_TYPE 541
-{{else}}
-#define EMBER_AF_PLUGIN_IAS_ZONE_CLIENT_MAX_DEVICES 10
-{{/if}}
-{{else if (isStrEqual name "Level Control")}}
-{{#if (isServer side)}}
-// User options for {{side}} plugin {{name}}
-#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MAXIMUM_LEVEL 255
-#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL 0
-#define EMBER_AF_PLUGIN_LEVEL_CONTROL_RATE 0
-{{/if}}
-{{else if (isStrEqual name "Scenes")}}
-{{#if (isServer side)}}
-// User options for {{side}} plugin {{name}}
-#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3
-{{/if}}
-{{/if}}
-{{/all_user_clusters}}
-
-// TODO Issue #3871 Reporting should only be enabled if there are reportable attributes
-// 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 5
-#define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS
diff --git a/src/app/zap-templates/helper-chip.js b/src/app/zap-templates/helper-chip.js
deleted file mode 100644 (file)
index bf4c831..0000000
+++ /dev/null
@@ -1,74 +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.
- */
-
-/**
- * This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
- *
- * @module Templating API: toplevel utility helpers
- */
-
-// Import Zcl helper from zap core
-const helperZcl = require('../../../third_party/zap/repo/src-electron/generator/helper-zcl.js')
-
-/**
- * Dummy helper that add a string to the templates showing
- * if the strings matches. Use to demonstrate the use
- * of ZAP helper within the chip-helper environment
- *
- * @param {*} str1 : First string to compare
- * @param {*} str2 : Second string to comapre
- */
-function example_helper(str1, str2) {
-  if (helperZcl.isStrEqual(str1, str2)) {
-    return 'The two strings are identical'
-  } else {
-    return 'The two strings are different'
-  }
-}
-
-/**
- * Produces the top-of-the-file header for a C file.
- *
- * @returns The header content
- */
-function chip_header() {
-  return `
-  /*
-  *
-  *    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.
-  */`;
-}
-
-// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
-//
-// Note: these exports are public API. Templates that might have been created in the past and are
-// available in the wild might depend on these names.
-// If you rename the functions, you need to still maintain old exports list.
-exports.chip_header = chip_header;
-exports.example_helper = example_helper;
diff --git a/src/app/zap-templates/print-cluster.zapt b/src/app/zap-templates/print-cluster.zapt
deleted file mode 100644 (file)
index 7bed5cc..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{{chip_header}}
-
-// Prevent multiple inclusion
-#pragma once
-
-// This is the mapping of IDs to cluster names assuming a format according
-// to the "EmberAfClusterName" defined in the ZCL header.
-// The names of clusters that are not present, are removed.
-
-{{#zcl_clusters}}
-#if defined(ZCL_USING_{{asDelimitedMacro this.define}}_SERVER) || defined(ZCL_USING_{{asDelimitedMacro this.define}}_CLIENT)
-    #define CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}} {ZCL_{{asDelimitedMacro this.define}}_ID, {{this.code}}, "{{this.label}}" },
-#else
-    #define CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}}
-#endif
-
-{{/zcl_clusters}}
-
-#define CLUSTER_IDS_TO_NAMES \
-{{#zcl_clusters}}
-    CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}} \
-{{/zcl_clusters}}
-
-#define MAX_CLUSTER_NAME_LENGTH  {{zcl_cluster_largest_label_length}}
index 6316465..947b711 100644 (file)
@@ -253,10 +253,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 case 0x38: // semi / Semi-precision
                 case 0x39: // single / Single precision
                 case 0x3A: // double / Double precision
-                case 0x41: // octstr / Octet string
-                case 0x42: // string / Character string
-                case 0x43: // octstr16 / Long octet string
-                case 0x44: // string16 / Long character string
                 case 0x48: // array / Array
                 case 0x49: // struct / Structure
                 case 0x50: // set / Set
@@ -269,6 +265,46 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                     return true;
                 }
 
+                case 0x41: // octstr / Octet string
+                case 0x42: // string / Character string
+                {
+                    // Short Strings must contains at least one byte for the length
+                    CHECK_MESSAGE_LENGTH(1);
+                    uint8_t length = chip::Encoding::Read8(message);
+                    ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                    // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                    if (length == 0xFF)
+                    {
+                        length = 0;
+                    }
+
+                    CHECK_MESSAGE_LENGTH(length);
+                    Callback::Callback<StringAttributeCallback> * cb = Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                    cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                    break;
+                }
+
+                case 0x43: // octstr16 / Long octet string
+                case 0x44: // string16 / Long character string
+                {
+                    // Long Strings must contains at least two bytes for the length
+                    CHECK_MESSAGE_LENGTH(2);
+                    uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                    ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                    // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                    if (length == 0xFFFF)
+                    {
+                        length = 0;
+                    }
+
+                    CHECK_MESSAGE_LENGTH(length);
+                    Callback::Callback<StringAttributeCallback> * cb = Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                    cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                    break;
+                }
+
                 case 0x08: // data8 / 8-bit data
                 case 0x18: // map8 / 8-bit bitmap
                 case 0x20: // uint8 / Unsigned  8-bit integer
@@ -704,10 +740,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -718,6 +750,46 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb = Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb = Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
index a0804d8..898af4c 100644 (file)
@@ -3,6 +3,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -16,6 +17,7 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void* context, uint16_t minInterval, uint16_t maxInterval);
 typedef void (*ReadReportingConfigurationReceivedCallback)(void* context, uint16_t timeout);
 
index bcfa34e..62126b5 100644 (file)
@@ -26,7 +26,7 @@ CHIP_ERROR {{asCamelCased clusterName false}}Cluster::{{asCamelCased name false}
 (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, k{{asCamelCased name false}}CommandId,
-                                         (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                         (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer  = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -77,7 +77,7 @@ CHIP_ERROR {{asCamelCased parent.name false}}Cluster::ReadAttribute{{asCamelCase
 }
 
 {{#if (isWritableAttribute)}}
-CHIP_ERROR {{asCamelCased parent.name false}}Cluster::WriteAttribute{{asCamelCased name false}}(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, {{asUnderlyingZclType type}} value)
+CHIP_ERROR {{asCamelCased parent.name false}}Cluster::WriteAttribute{{asCamelCased name false}}(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, {{chipType}} value)
 {
     uint8_t seqNum = mDevice->GetNextSequenceNumber();
     System::PacketBufferHandle encodedCommand = encode{{asCamelCased parent.name false}}ClusterWrite{{asCamelCased name false}}Attribute(seqNum, mEndpoint, value);
index 01da2a2..0d3e108 100644 (file)
@@ -35,7 +35,7 @@ public:
     {{/chip_server_cluster_attributes}}
     {{#chip_server_cluster_attributes}}
     {{#if (isWritableAttribute)}}
-    CHIP_ERROR WriteAttribute{{asCamelCased name false}}(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, {{asUnderlyingZclType type}} value);
+    CHIP_ERROR WriteAttribute{{asCamelCased name false}}(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, {{chipType}} value);
     {{/if}}
     {{/chip_server_cluster_attributes}}
     {{#chip_server_cluster_attributes}}
index 32c269f..4a0ec37 100644 (file)
@@ -70,24 +70,40 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError* error = [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeUndefinedError userInfo:@{NSLocalizedDescriptionKey:@"Unsupported attribute type"}];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString)
+                {
+                    NSData *data = [NSData dataWithBytes: value.data() length: value.size()];
+                    callback->mHandler(nil, @{ @"value": data });
+                }
+                else
+                {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data() length:value.size() encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @{ @"value": str });
+                }
+
+                if (!callback->mKeepAlive)
+                {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -95,6 +111,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -229,6 +247,39 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @{ @"value": [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive)
+                {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -360,7 +411,7 @@ private:
 
 {{#chip_server_cluster_commands}}
 {{#if (zcl_command_arguments_count this.id)}}
-- (void){{asCamelCased name}}:{{#chip_server_cluster_command_arguments}}{{#if (isFirstElement index)}}{{else}}{{asCamelCased label}}:{{/if}}({{#if (isByteString type)}}NSData *{{else}}{{asBasicType chipType}}{{/if}}){{asCamelCased label}} {{/chip_server_cluster_command_arguments}}completionHandler:(ResponseHandler)completionHandler
+- (void){{asCamelCased name}}:{{#chip_server_cluster_command_arguments}}{{#if (isFirstElement index)}}{{else}}{{asCamelCased label}}:{{/if}}({{asObjectiveCBasicType type}}){{asCamelCased label}} {{/chip_server_cluster_command_arguments}}completionHandler:(ResponseHandler)completionHandler
 {{else}}
 - (void){{asCamelCased name}}:(ResponseHandler)completionHandler
 {{/if}}
@@ -382,7 +433,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.{{asCamelCased name false}}(onSuccess->Cancel(), onFailure->Cancel(){{#chip_server_cluster_command_arguments}}, {{#if (isByteString type)}}chip::ByteSpan((const uint8_t*){{asCamelCased label}}.bytes, {{asCamelCased label}}.length){{else}}{{asCamelCased label}}{{/if}}{{/chip_server_cluster_command_arguments}});
+    CHIP_ERROR err = self.cppCluster.{{asCamelCased name false}}(onSuccess->Cancel(), onFailure->Cancel(){{#chip_server_cluster_command_arguments}}, {{#if (isOctetString type)}}chip::ByteSpan((const uint8_t*){{asCamelCased label}}.bytes, {{asCamelCased label}}.length){{else if (isCharString type)}}chip::ByteSpan((const uint8_t*)[{{asCamelCased label}} dataUsingEncoding:NSUTF8StringEncoding].bytes, [{{asCamelCased label}} lengthOfBytesUsingEncoding:NSUTF8StringEncoding]){{else}}{{asCamelCased label}}{{/if}}{{/chip_server_cluster_command_arguments}});
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -394,7 +445,7 @@ private:
 {{#chip_server_cluster_attributes}}
 - (void)readAttribute{{asCamelCased name false}}:(ResponseHandler)completionHandler
 {
-    CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge * onSuccess = new CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge * onSuccess = new CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge(completionHandler, [self callbackQueue]{{#if (isString type)}},{{#if (isOctetString type)}}true{{else}}false{{/if}}{{/if}});
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -416,7 +467,7 @@ private:
 }
 
 {{#if (isWritableAttribute)}}
-- (void)writeAttribute{{asCamelCased name false}}:({{asUnderlyingZclType type}})value completionHandler:(ResponseHandler)completionHandler
+- (void)writeAttribute{{asCamelCased name false}}:({{asObjectiveCBasicType type}})value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -431,7 +482,14 @@ private:
         return;
     }
 
+    {{#if (isOctetString type)}}
+    CHIP_ERROR err = self.cppCluster.WriteAttribute{{asCamelCased name false}}(onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t*)value.bytes, value.length));
+    {{else if (isCharString type)}}
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttribute{{asCamelCased name false}}(onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t*)data.bytes, data.length));
+    {{else}}
     CHIP_ERROR err = self.cppCluster.WriteAttribute{{asCamelCased name false}}(onSuccess->Cancel(), onFailure->Cancel(), value);
+    {{/if}}
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -467,7 +525,7 @@ private:
 
 - (void) reportAttribute{{asCamelCased name false}}:(ResponseHandler)reportHandler
 {
-    CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge * onReport = new CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge * onReport = new CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge(reportHandler, [self callbackQueue]{{#if (isString type)}},{{#if (isOctetString type)}}true{{else}}false{{/if}}{{/if}}, true);
     if (!onReport) {
         reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
index 45d3b6b..9ef083a 100644 (file)
@@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 {{#chip_server_cluster_commands}}
 {{#if (zcl_command_arguments_count this.id)}}
-- (void){{asCamelCased name}}:{{#chip_server_cluster_command_arguments}}{{#if (isFirstElement index)}}{{else}}{{asCamelCased label}}:{{/if}}({{#if (isByteString type)}}NSData *{{else}}{{asBasicType chipType}}{{/if}}){{asCamelCased label}} {{/chip_server_cluster_command_arguments}}completionHandler:(ResponseHandler)completionHandler;
+- (void){{asCamelCased name}}:{{#chip_server_cluster_command_arguments}}{{#if (isFirstElement index)}}{{else}}{{asCamelCased label}}:{{/if}}({{asObjectiveCBasicType type}}){{asCamelCased label}} {{/chip_server_cluster_command_arguments}}completionHandler:(ResponseHandler)completionHandler;
 {{else}}
 - (void){{asCamelCased name}}:(ResponseHandler)completionHandler;
 {{/if}}
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
 {{#chip_server_cluster_attributes}}
 - (void)readAttribute{{asCamelCased name false}}:(ResponseHandler)completionHandler;
 {{#if (isWritableAttribute)}}
-- (void)writeAttribute{{asCamelCased name false}}:({{asUnderlyingZclType type}})value completionHandler:(ResponseHandler)completionHandler;
+- (void)writeAttribute{{asCamelCased name false}}:({{asObjectiveCBasicType type}})value completionHandler:(ResponseHandler)completionHandler;
 {{/if}}
 {{#if (isReportableAttribute)}}
 - (void) configureAttribute{{asCamelCased name false}}:(uint16_t)minInterval  maxInterval:(uint16_t)maxInterval{{#unless (isDiscreteType)}} change:({{chipType}})change{{/unless}} completionHandler:(ResponseHandler)completionHandler;
index e4f285a..fe9d388 100644 (file)
@@ -39,7 +39,7 @@ chip::System::PacketBufferHandle encode{{asCamelCased parent.name false}}Cluster
  * @brief
  *    Encode a {{parent.name}} server write command for the {{name}} attribute into buffer including the APS frame
  */
-chip::System::PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterWrite{{asCamelCased name false}}Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, {{asUnderlyingZclType type}} {{asCamelCased name}});
+chip::System::PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterWrite{{asCamelCased name false}}Attribute(uint8_t seqNum, chip::EndpointId destinationEndpoint, {{chipType}} {{asCamelCased name}});
 
 {{/if}}
 {{#if (isReportableAttribute)}}
index 7cc96d2..eccb518 100644 (file)
@@ -125,20 +125,15 @@ PacketBufferHandle encode{{asCamelCased clusterName false}}Cluster{{asType name}
 {
     COMMAND_HEADER("{{asType name}}", {{parent.define}}_ID);
     {{#chip_server_cluster_command_arguments}}
-    {{#if (isByteString type)}}
-    if (!CanCastTo<uint8_t>({{asCamelCased label}}.size()))
-    {
-        ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, {{asCamelCased label}}.size());
-        return PacketBufferHandle();
-    }
-    {{else if (isString type)}}
-    size_t {{asCamelCased label}}StrLen = strlen({{asCamelCased label}});
-    if (!CanCastTo<uint8_t>({{asCamelCased label}}StrLen))
+    {{#if (isString type)}}
+    size_t {{asCamelCased label}}StrLen = {{asCamelCased label}}.size();
+    if (!CanCastTo<{{#if (isShortString type)}}uint8_t{{else}}uint16_t{{/if}}>({{asCamelCased label}}StrLen))
     {
         ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, {{asCamelCased label}}StrLen);
         return PacketBufferHandle();
     }
     {{/if}}
+
     {{/chip_server_cluster_command_arguments}}
       buf
     {{#if (isManufacturerSpecificCommand)}}
@@ -150,12 +145,9 @@ PacketBufferHandle encode{{asCamelCased clusterName false}}Cluster{{asType name}
        .Put8(seqNum)
        .Put8(ZCL_{{asDelimitedMacro name}}_COMMAND_ID)
     {{#chip_server_cluster_command_arguments}}
-    {{#if (isByteString type)}}
-       .Put(static_cast<uint8_t>({{asCamelCased label}}.size()))
+    {{#if (isString type)}}
+       .Put(static_cast<{{#if (isShortString type)}}uint8_t{{else}}uint16_t{{/if}}>({{asCamelCased label}}StrLen))
        .Put({{asCamelCased label}}.data(), {{asCamelCased label}}.size())
-    {{else if (isString type)}}
-       .Put(static_cast<uint8_t>({{asCamelCased label}}StrLen))
-       .Put({{asCamelCased label}})
     {{else if (isSignedType)}}
        .Put{{chipTypePutLength}}(static_cast<{{chipTypePutCastType}}>({{asCamelCased label}}))
     {{else}}
@@ -193,15 +185,30 @@ PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterRead{{asCamelC
 }
 
 {{#if (isWritableAttribute)}}
-PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterWrite{{asCamelCased name false}}Attribute(uint8_t seqNum, EndpointId destinationEndpoint, {{asUnderlyingZclType type}} {{asCamelCased name}})
+PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterWrite{{asCamelCased name false}}Attribute(uint8_t seqNum, EndpointId destinationEndpoint, {{chipType}} {{asCamelCased name}})
 {
     COMMAND_HEADER("Write{{asCamelCased parent.name false}}{{asCamelCased name false}}", {{parent.define}}_ID);
+    {{#if (isString type)}}
+    size_t {{asCamelCased name}}StrLen = {{asCamelCased name}}.size();
+    if (!CanCastTo<{{#if (isShortString type)}}uint8_t{{else}}uint16_t{{/if}}>({{asCamelCased name}}StrLen))
+    {
+        ChipLogError(Zcl, "Error encoding %s command. String too long: %d", kName, {{asCamelCased name}}StrLen);
+        return PacketBufferHandle();
+    }
+
+    {{/if}}
     buf.Put8(kFrameControlGlobalCommand)
        .Put8(seqNum)
        .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID)
        .Put16({{asHex attributeCode 4}})
        .Put8({{atomicTypeId}})
-       .Put{{chipTypePutLength}}(static_cast<{{chipTypePutCastType}}>({{asCamelCased name}}));
+    {{#if (isString type)}}
+       .Put(static_cast<{{#if (isShortString type)}}uint8_t{{else}}uint16_t{{/if}}>({{asCamelCased name}}StrLen))
+       .Put({{asCamelCased name}}.data(), {{asCamelCased name }}StrLen)
+    {{else}}
+       .Put{{chipTypePutLength}}(static_cast<{{chipTypePutCastType}}>({{asCamelCased name}}))
+    {{/if}}
+       ;
     COMMAND_FOOTER();
 }
 
index 2e68715..98166fe 100644 (file)
@@ -47,7 +47,7 @@ function asPutLength(zclType)
   case 'uint64_t':
     return type.replace(/[^0-9]/g, '');
   default:
-    throw error = 'Unhandled type: ' + zclType;
+    throw error = 'asPutLength: Unhandled type: ' + zclType;
   }
 }
 
@@ -66,7 +66,7 @@ function asPutCastType(zclType)
   case 'uint64_t':
     return type;
   default:
-    throw error = 'Unhandled type: ' + zclType;
+    throw error = 'asPutCastType: Unhandled type: ' + zclType;
   }
 }
 
@@ -161,13 +161,9 @@ function chip_server_cluster_command_arguments(options)
   {
     return Promise.all(args.map(arg => collectItem.call(this, arg, pkgId))).then(items => items.flat()).then(items => {
       return Promise.all(items.map(item => {
-        if (StringHelper.isByteString(item.type)) {
+        if (StringHelper.isString(item.type)) {
           item.chipType = 'chip::ByteSpan';
           return item;
-        } else if (StringHelper.isString(item.type)) {
-          // Enhanced the command argument with 'chipType' for conveniences.
-          item.chipType = 'char *';
-          return item;
         }
 
         return zclHelper.asUnderlyingZclType.call(this, item.type, options).then(zclType => {
@@ -248,6 +244,13 @@ function getAttributes(pkgId, options)
       // Enhanced the attribute with 'atomidId', 'discrete', chipType properties for convenience.
       att.atomicTypeId = atomic.atomicId;
       att.discrete     = atomic.discrete;
+
+      if (StringHelper.isString(att.type)) {
+        // Enhanced the command argument with 'chipType' for conveniences.
+        att.chipType = 'chip::ByteSpan';
+        return att;
+      }
+
       return zclHelper.asUnderlyingZclType.call(this, att.type, options).then(zclType => {
         att.chipType = zclType;
         return att;
@@ -285,8 +288,10 @@ function chip_server_cluster_attributes(options)
         let isWritable       = !!sameAttributes.find(att2 => att2.writable);
         let isReportable     = !!sameAttributes.find(att2 => att2.reportable.included);
         if (isWritable || isReportable) {
-          att.chipTypePutLength   = asPutLength(att.chipType);
-          att.chipTypePutCastType = asPutCastType(att.chipType);
+          if (!StringHelper.isString(att.type)) {
+            att.chipTypePutLength   = asPutLength(att.chipType);
+            att.chipTypePutCastType = asPutCastType(att.chipType);
+          }
           att.writable            = isWritable;
           att.reportable.included = isReportable;
         }
@@ -449,16 +454,20 @@ function asCallbackAttributeType(attributeType)
   case 0x38: // semi / Semi-precision
   case 0x39: // single / Single precision
   case 0x3A: // double / Double precision
-  case 0x41: // octstr / Octet string
-  case 0x42: // string / Character string
-  case 0x43: // octstr16 / Long octet string
-  case 0x44: // string16 / Long character string
   case 0x48: // array / Array
   case 0x49: // struct / Structure
   case 0x50: // set / Set
   case 0x51: // bag / Bag
   case 0xE0: // ToD / Time of day
+  case 0xEA: // bacOID / BACnet OID
+  case 0xF1: // key128 / 128-bit security key
+  case 0xFF: // unk / Unknown
     return 'Unsupported';
+  case 0x41: // octstr / Octet string
+  case 0x42: // string / Character string
+  case 0x43: // octstr16 / Long octet string
+  case 0x44: // string16 / Long character string
+    return 'String';
   case 0x08: // data8 / 8-bit data
   case 0x18: // map8 / 8-bit bitmap
   case 0x20: // uint8 / Unsigned  8-bit integer
@@ -470,9 +479,6 @@ function asCallbackAttributeType(attributeType)
   case 0x31: // enum16 / 16-bit enumeration
   case 0xE8: // clusterId / Cluster ID
   case 0xE9: // attribId / Attribute ID
-  case 0xEA: // bacOID / BACnet OID
-  case 0xF1: // key128 / 128-bit security key
-  case 0xFF: // unk / Unknown
     return 'Int16u';
   case 0x0B: // data32 / 32-bit data
   case 0x1B: // map32 / 32-bit bitmap
@@ -501,6 +507,17 @@ function asCallbackAttributeType(attributeType)
   }
 }
 
+function asObjectiveCBasicType(type)
+{
+  if (StringHelper.isOctetString(type)) {
+    return 'NSData *';
+  } else if (StringHelper.isCharString(type)) {
+    return 'NSString *';
+  } else {
+    return ChipTypesHelper.asBasicType(this.chipType);
+  }
+}
+
 function asObjectiveCNumberType(label, type)
 {
   function fn(pkgId)
@@ -548,6 +565,7 @@ exports.chip_server_clusters                  = chip_server_clusters;
 exports.chip_server_cluster_commands          = chip_server_cluster_commands;
 exports.chip_server_cluster_command_arguments = chip_server_cluster_command_arguments
 exports.asBasicType                           = ChipTypesHelper.asBasicType;
+exports.asObjectiveCBasicType                 = asObjectiveCBasicType;
 exports.asObjectiveCNumberType                = asObjectiveCNumberType;
 exports.isSignedType                          = isSignedType;
 exports.isDiscreteType                        = isDiscreteType;
index c2bf73b..a886acf 100644 (file)
@@ -18,13 +18,13 @@ extern "C" {
 {{#chip_server_clusters}}
 // Cluster {{asCamelCased name false}}
 {{#chip_server_cluster_commands}}
-CHIP_ERROR chip_ime_AppendCommand_{{asCamelCased clusterName false}}_{{asCamelCased name false}}(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId ZCLgroupId{{#chip_server_cluster_command_arguments}}, {{#if (isByteString type)}}const uint8_t * {{asCamelCased label}}, uint32_t {{asCamelCased label}}_Len{{else}}{{chipType}} {{asCamelCased label}}{{/if}}{{/chip_server_cluster_command_arguments}})
+CHIP_ERROR chip_ime_AppendCommand_{{asCamelCased clusterName false}}_{{asCamelCased name false}}(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId ZCLgroupId{{#chip_server_cluster_command_arguments}}, {{#if (isString type)}}const uint8_t * {{asCamelCased label}}, uint32_t {{asCamelCased label}}_Len{{else}}{{chipType}} {{asCamelCased label}}{{/if}}{{/chip_server_cluster_command_arguments}})
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::{{asCamelCased clusterName false}}Cluster cluster{{asCamelCased clusterName false}};
     (void) ZCLgroupId;
     cluster{{asCamelCased clusterName false}}.Associate(device, ZCLendpointId);
-    return cluster{{asCamelCased clusterName false}}.{{asCamelCased name false}}(nullptr, nullptr{{#chip_server_cluster_command_arguments}}, {{#if (isByteString type)}}chip::ByteSpan({{asCamelCased label}}, {{asCamelCased label}}_Len){{else}}{{asCamelCased label}}{{/if}}
+    return cluster{{asCamelCased clusterName false}}.{{asCamelCased name false}}(nullptr, nullptr{{#chip_server_cluster_command_arguments}}, {{#if (isString type)}}chip::ByteSpan({{asCamelCased label}}, {{asCamelCased label}}_Len){{else}}{{asCamelCased label}}{{/if}}
     {{/chip_server_cluster_command_arguments}});
 }
 {{/chip_server_cluster_commands}}
index e123dff..58c3631 100644 (file)
@@ -47,7 +47,7 @@ class ChipCluster:
 {{/chip_server_cluster_command_arguments}}
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_{{asCamelCased clusterName false}}_{{asCamelCased name false}}(
-                device, ZCLendpoint, ZCLgroupid{{#chip_server_cluster_command_arguments}}, {{asCamelCased label}}{{#if (isByteString type)}}, len({{asCamelCased label}}){{/if}}{{/chip_server_cluster_command_arguments}}
+                device, ZCLendpoint, ZCLgroupid{{#chip_server_cluster_command_arguments}}, {{asCamelCased label}}{{#if (isString type)}}, len({{asCamelCased label}}){{/if}}{{/chip_server_cluster_command_arguments}}
             )
         )
 
@@ -59,7 +59,7 @@ class ChipCluster:
         # Cluster {{asCamelCased name false}}
 {{#chip_server_cluster_commands}}
         # Cluster {{asCamelCased clusterName false}} Command {{asCamelCased name false}}
-        self._chipLib.chip_ime_AppendCommand_{{asCamelCased clusterName false}}_{{asCamelCased name false}}.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16{{#chip_server_cluster_command_arguments}}{{#if (isByteString type)}}, ctypes.c_char_p, ctypes.c_uint32{{else}}, ctypes.{{asPythonCType chipType}}{{/if}}{{/chip_server_cluster_command_arguments}}]
+        self._chipLib.chip_ime_AppendCommand_{{asCamelCased clusterName false}}_{{asCamelCased name false}}.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16{{#chip_server_cluster_command_arguments}}{{#if (isString type)}}, ctypes.c_char_p, ctypes.c_uint32{{else}}, ctypes.{{asPythonCType chipType}}{{/if}}{{/chip_server_cluster_command_arguments}}]
         self._chipLib.chip_ime_AppendCommand_{{asCamelCased clusterName false}}_{{asCamelCased name false}}.restype = ctypes.c_uint32
 {{/chip_server_cluster_commands}}
 {{/chip_server_clusters}}
index 36e4c8e..232e79c 100644 (file)
@@ -24,10 +24,10 @@ limitations under the License.
     <client init="false" tick="false">true</client>
     <server init="false" tick="false">true</server>
     <description>This cluster provides information about an application running on a TV or media player device which is represented as an endpoint.</description>
-    <attribute side="server" code="0x0000" define="VENDOR_NAME" type="OCTET_STRING" length="32" writable="false" optional="false">vendor name</attribute>
-    <attribute side="server" code="0x0001" define="VENDOR_ID" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">vendor id</attribute>
+    <attribute side="server" code="0x0000" define="APPLICATION_VENDOR_NAME" type="OCTET_STRING" length="32" writable="false" optional="false">vendor name</attribute>
+    <attribute side="server" code="0x0001" define="APPLICATION_VENDOR_ID" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">vendor id</attribute>
     <attribute side="server" code="0x0002" define="APPLICATION_NAME" type="OCTET_STRING" length="32" writable="false" optional="false">application name</attribute>
-    <attribute side="server" code="0x0003" define="PRODUCT_ID" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">product id</attribute>
+    <attribute side="server" code="0x0003" define="APPLICATION_PRODUCT_ID" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">product id</attribute>
     <attribute side="server" code="0x0005" define="APPLICATION_ID" type="OCTET_STRING" length="32" writable="false" optional="false">application id</attribute>
     <attribute side="server" code="0x0006" define="CATALOG_VENDOR_ID" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">catalog vendor id</attribute>
     <attribute side="server" code="0x0007" define="APPLICATION_STATUS" type="ENUM8" min="0x00" max="0xFF" writable="false" default="0x01" optional="false">application satus</attribute>
index eff6e76..4dab110 100644 (file)
@@ -16,7 +16,7 @@ limitations under the License.
 -->
 <configurator>
   <domain name="CHIP"/>
-  <clusterExtension code="0x0000">
+  <clusterExtension code="0x0028">
     <command source="client" code="0x00" name="MfgSpecificPing" optional="true" manufacturerCode="0x1002">
       <description></description>
     </command>
index 367ac8a..6ed1b74 100644 (file)
@@ -170,32 +170,38 @@ limitations under the License.
   <cluster singleton="true">
     <name>Basic</name>
     <domain>General</domain>
-    <description>Attributes for determining basic information about a device, setting user device information such as location, and enabling a device.</description>
-    <code>0x0000</code>
+    <description>Attributes for determining basic information about a device, and setting user device information such as location.</description>
+    <code>0x0028</code>
     <define>BASIC_CLUSTER</define>
     <client tick="false" init="false">true</client>
     <server tick="false" init="false">true</server>
     <globalAttribute side="either" code="0xFFFD" value="3"/>
-    <attribute side="server" code="0x0000" define="VERSION" type="INT8U" min="0x00" max="0xFF" writable="false" default="0x08" optional="false">ZCL version</attribute>
-    <!-- ZCL_VERSION -->
-    <attribute side="server" code="0x0001" define="APPLICATION_VERSION" type="INT8U" min="0x00" max="0xFF" writable="false" default="0x00" optional="true">application version</attribute>
-    <attribute side="server" code="0x0002" define="STACK_VERSION" type="INT8U" min="0x00" max="0xFF" writable="false" default="0x00" optional="true">stack version</attribute>
-    <attribute side="server" code="0x0003" define="HW_VERSION" type="INT8U" min="0x00" max="0xFF" writable="false" default="0x00" optional="true">hardware version</attribute>
-    <attribute side="server" code="0x0004" define="MANUFACTURER_NAME" type="CHAR_STRING" length="32" writable="false" default="" optional="true">manufacturer name</attribute>
-    <attribute side="server" code="0x0005" define="MODEL_IDENTIFIER" type="CHAR_STRING" length="32" writable="false" default="" optional="true">model identifier</attribute>
-    <attribute side="server" code="0x0006" define="DATE_CODE" type="CHAR_STRING" length="16" writable="false" default="" optional="true">date code</attribute>
-    <attribute side="server" code="0x0007" define="POWER_SOURCE" type="ENUM8" min="0x00" max="0xFF" writable="false" default="0x00" optional="false">power source</attribute>
-    <attribute side="server" code="0x0008" define="GENERIC_DEVICE_CLASS" type="ENUM8" min="0x00" max="0xFF" writable="false" default="0xFF" optional="true" introducedIn="l&amp;o-1.0-15-0014-04">generic device class</attribute>
-    <attribute side="server" code="0x0009" define="GENERIC_DEVICE_TYPE" type="ENUM8" min="0x00" max="0xFF" writable="false" default="0xFF" optional="true" introducedIn="l&amp;o-1.0-15-0014-04">generic device type</attribute>
-    <attribute side="server" code="0x000A" define="PRODUCT_CODE" type="OCTET_STRING" length="16" writable="false" optional="true" introducedIn="l&amp;o-1.0-15-0014-04">product code</attribute>
-    <attribute side="server" code="0x000B" define="PRODUCT_URL" type="CHAR_STRING" length="64" writable="false" optional="true" introducedIn="l&amp;o-1.0-15-0014-04">product url</attribute>
-    <attribute side="server" code="0x0010" define="LOCATION_DESCRIPTION" type="CHAR_STRING" length="16" writable="true" default="" optional="true">location description</attribute>
-    <attribute side="server" code="0x0011" define="PHYSICAL_ENVIRONMENT" type="ENUM8" min="0x00" max="0xFF" writable="true" default="0x00" optional="true">physical environment</attribute>
-    <attribute side="server" code="0x0012" define="DEVICE_ENABLED" type="BOOLEAN" min="0x00" max="0x01" writable="true" default="0x01" optional="true">device enabled</attribute>
-    <attribute side="server" code="0x0013" define="ALARM_MASK" type="BITMAP8" min="0x00" max="0x03" writable="true" default="0x00" optional="true">alarm mask</attribute>
-    <attribute side="server" code="0x0014" define="DISABLE_LOCAL_CONFIG" type="BITMAP8" min="0x00" max="0x03" writable="true" default="0x00" optional="true">disable local config</attribute>
-    <command source="client" code="0x00" name="ResetToFactoryDefaults" optional="true" cli="zcl basic rtfd">
-      <description>Command that resets all attribute values to factory default.</description>
+
+    <attribute side="server" code="0x0000" define="INTERACTION_MODEL_VERSION" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">InteractionModelVersion</attribute>
+    <attribute side="server" code="0x0001" define="VENDOR_NAME" type="CHAR_STRING" length="32" writable="false" default="" optional="false">VendorName</attribute>
+    <attribute side="server" code="0x0002" define="VENDOR_ID" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">VendorID</attribute>
+    <attribute side="server" code="0x0003" define="PRODUCT_NAME" type="CHAR_STRING" length="32" writable="false" default="" optional="false">ProductName</attribute>
+    <attribute side="server" code="0x0004" define="PRODUCT_ID" type="INT16U" min="0x0000" max="0xFFFF" writable="false" optional="false">ProductID</attribute>
+    <attribute side="server" code="0x0005" define="USER_LABEL" type="CHAR_STRING" length="32" writable="true" default="" optional="false">UserLabel</attribute>
+    <attribute side="server" code="0x0006" define="LOCATION" type="CHAR_STRING" length="16" writable="true" default="" optional="false">Location</attribute>
+    <attribute side="server" code="0x0007" define="HARDWARE_VERSION" type="INT16U" min="0x0000" max="0xFFFF" writable="false" default="0x00" optional="false">HardwareVersion</attribute>
+    <attribute side="server" code="0x0008" define="HARDWARE_VERSION_STRING" type="CHAR_STRING" length="64" writable="false" default="" optional="false">HardwareVersionString</attribute>
+    <attribute side="server" code="0x0009" define="SOFTWARE_VERSION" type="INT32U" min="0x0000" max="0xFFFF" writable="false" default="0x00" optional="false">SoftwareVersion</attribute>
+    <attribute side="server" code="0x000A" define="SOFTWARE_VERSION_STRING" type="CHAR_STRING" length="64" writable="false" default="" optional="false">SoftwareVersionString</attribute>
+    <attribute side="server" code="0x000B" define="MANUFACTURING_DATE" type="CHAR_STRING" length="16" writable="false" default="" optional="true">ManufacturingDate</attribute>
+    <attribute side="server" code="0x000C" define="PART_NUMBER" type="CHAR_STRING" writable="false" optional="true">PartNumber</attribute>
+    <attribute side="server" code="0x000D" define="PRODUCT_URL" type="CHAR_STRING" writable="false" optional="true">ProductURL</attribute>
+    <attribute side="server" code="0x000E" define="PRODUCT_LABEL" type="CHAR_STRING" length="64" writable="false" default="" optional="true">ProductLabel</attribute>
+    <attribute side="server" code="0x000F" define="SERIAL_NUMBER" type="CHAR_STRING" length="32" writable="false" default="" optional="true">SerialNumber</attribute>
+    <attribute side="server" code="0x0010" define="LOCAL_CONFIG_DISABLED" type="BOOLEAN" min="0x00" max="0x01" writable="true" default="0x00" optional="true">LocalConfigDisabled</attribute>
+    <command source="server" code="0x00" name="StartUp" optional="false">
+      <description>The StartUp event SHALL be emitted by a Node as soon as reasonable after completing a boot or reboot process.</description>
+    </command>
+    <command source="server" code="0x01" name="ShutDown" optional="false">
+      <description>The ShutDown event SHOULD be emitted by a Node prior to any orderly shutdown sequence on a best-effort basis.</description>
+    </command>
+    <command source="server" code="0x02" name="Leave" optional="false">
+      <description>The Leave event SHOULD be emitted by a Node prior to permanently leaving the Fabric.</description>
     </command>
   </cluster>
   <cluster singleton="true">
index 891da75..3bf6817 100644 (file)
@@ -742,7 +742,7 @@ limitations under the License.
     <attribute side="server" code="0x0021" define="PRICE_TRAILING_DIGIT" type="INT8U" writable="false" optional="false">price trailing digit</attribute>
     <attribute side="server" code="0x0022" define="PRICE" type="INT32U" writable="false" optional="false">price</attribute>
     <attribute side="server" code="0x0030" define="GOOD_ID" type="OCTET_STRING" length="64" writable="false" optional="false">good id</attribute>
-    <attribute side="server" code="0x0031" define="SERIAL_NUMBER" type="OCTET_STRING" length="64" writable="false" optional="false">serial number</attribute>
+    <attribute side="server" code="0x0031" define="PAYMENT_SERIAL_NUMBER" type="OCTET_STRING" length="64" writable="false" optional="false">serial number</attribute>
     <attribute side="server" code="0x0032" define="PAYMENT_TIMESTAMP" type="OCTET_STRING" length="64" writable="false" optional="false">timestamp</attribute>
     <attribute side="server" code="0x0033" define="TRANS_ID" type="INT16U" writable="true" optional="true">trans id</attribute>
     <attribute side="server" code="0x0034" define="TRANS_STATUS" type="ENUM8" writable="true" optional="true">trans status</attribute>
index 6abdb70..aaf0d52 100644 (file)
@@ -272,7 +272,7 @@ exit:
 void BLEEndPoint::HandleSubscribeComplete()
 {
     ChipLogProgress(Ble, "subscribe complete, ep = %p", this);
-    SetFlag(mConnStateFlags, kConnState_GattOperationInFlight, false);
+    mConnStateFlags.Clear(ConnectionStateFlag::kGattOperationInFlight);
 
     BLE_ERROR err = DriveSending();
 
@@ -295,7 +295,7 @@ bool BLEEndPoint::IsConnected(uint8_t state) const
 
 bool BLEEndPoint::IsUnsubscribePending() const
 {
-    return (GetFlag(mTimerStateFlags, kTimerState_UnsubscribeTimerRunning));
+    return mTimerStateFlags.Has(TimerStateFlag::kUnsubscribeTimerRunning);
 }
 
 void BLEEndPoint::Abort()
@@ -392,7 +392,7 @@ void BLEEndPoint::FinalizeClose(uint8_t oldState, uint8_t flags, BLE_ERROR err)
     }
     else // Otherwise, try to signal close to remote device before end point releases BLE connection and frees itself.
     {
-        if (mRole == kBleRole_Central && GetFlag(mConnStateFlags, kConnState_DidBeginSubscribe))
+        if (mRole == kBleRole_Central && mConnStateFlags.Has(ConnectionStateFlag::kDidBeginSubscribe))
         {
             // Cancel send and receive-ack timers, if running.
             StopAckReceivedTimer();
@@ -420,10 +420,10 @@ void BLEEndPoint::FinalizeClose(uint8_t oldState, uint8_t flags, BLE_ERROR err)
                 }
 
                 // Mark unsubscribe GATT operation in progress.
-                SetFlag(mConnStateFlags, kConnState_GattOperationInFlight, true);
+                mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight);
             }
         }
-        else // mRole == kBleRole_Peripheral, OR GetFlag(mTimerStateFlags, kConnState_DidBeginSubscribe) == false...
+        else // mRole == kBleRole_Peripheral, OR mTimerStateFlags.Has(ConnectionStateFlag::kDidBeginSubscribe) == false...
         {
             Free();
         }
@@ -456,7 +456,7 @@ void BLEEndPoint::ReleaseBleConnection()
 {
     if (mConnObj != BLE_CONNECTION_UNINITIALIZED)
     {
-        if (GetFlag(mConnStateFlags, kConnState_AutoClose))
+        if (mConnStateFlags.Has(ConnectionStateFlag::kAutoClose))
         {
             ChipLogProgress(Ble, "Auto-closing end point's BLE connection.");
             mBle->mPlatformDelegate->CloseConnection(mConnObj);
@@ -562,11 +562,10 @@ BLE_ERROR BLEEndPoint::Init(BleLayer * bleLayer, BLE_CONNECTION_OBJECT connObj,
     mRefCount = 1;
 
     // BLEEndPoint data members:
-    mConnObj         = connObj;
-    mRole            = role;
-    mConnStateFlags  = 0;
-    mTimerStateFlags = 0;
-    SetFlag(mConnStateFlags, kConnState_AutoClose, autoClose);
+    mConnObj = connObj;
+    mRole    = role;
+    mTimerStateFlags.ClearAll();
+    mConnStateFlags.ClearAll().Set(ConnectionStateFlag::kAutoClose, autoClose);
     mLocalReceiveWindowSize  = 0;
     mRemoteReceiveWindowSize = 0;
     mReceiveWindowMaxSize    = 0;
@@ -686,7 +685,7 @@ exit:
 bool BLEEndPoint::PrepareNextFragment(PacketBufferHandle && data, bool & sentAck)
 {
     // If we have a pending fragment acknowledgement to send, piggyback it on the fragment we're about to transmit.
-    if (GetFlag(mTimerStateFlags, kTimerState_SendAckTimerRunning))
+    if (mTimerStateFlags.Has(TimerStateFlag::kSendAckTimerRunning))
     {
         // Reset local receive window counter.
         mLocalReceiveWindowSize = mReceiveWindowMaxSize;
@@ -818,10 +817,10 @@ BLE_ERROR BLEEndPoint::HandleHandshakeConfirmationReceived()
                      err = BLE_ERROR_GATT_SUBSCRIBE_FAILED);
 
         // We just sent a GATT subscribe request, so make sure to attempt unsubscribe on close.
-        SetFlag(mConnStateFlags, kConnState_DidBeginSubscribe, true);
+        mConnStateFlags.Set(ConnectionStateFlag::kDidBeginSubscribe);
 
         // Mark GATT operation in progress for subscribe request.
-        SetFlag(mConnStateFlags, kConnState_GattOperationInFlight, true);
+        mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight);
     }
     else // (mRole == kBleRole_Peripheral), verified on Init
     {
@@ -882,12 +881,12 @@ BLE_ERROR BLEEndPoint::HandleFragmentConfirmationReceived()
     // TODO Packet buffer high water mark optimization: if ack pending, but fragmenter state == complete, free fragmenter's
     // tx buf before sending ack.
 
-    if (GetFlag(mConnStateFlags, kConnState_StandAloneAckInFlight))
+    if (mConnStateFlags.Has(ConnectionStateFlag::kStandAloneAckInFlight))
     {
         // If confirmation was received for stand-alone ack, free its tx buffer.
         mAckToSend = nullptr;
 
-        SetFlag(mConnStateFlags, kConnState_StandAloneAckInFlight, false);
+        mConnStateFlags.Clear(ConnectionStateFlag::kStandAloneAckInFlight);
     }
 
     // If local receive window size has shrunk to or below immediate ack threshold, AND a message fragment is not
@@ -922,12 +921,12 @@ BLE_ERROR BLEEndPoint::HandleGattSendConfirmationReceived()
     ChipLogDebugBleEndPoint(Ble, "entered HandleGattSendConfirmationReceived");
 
     // Mark outstanding GATT operation as finished.
-    SetFlag(mConnStateFlags, kConnState_GattOperationInFlight, false);
+    mConnStateFlags.Clear(ConnectionStateFlag::kGattOperationInFlight);
 
     // If confirmation was for outbound portion of BTP connect handshake...
-    if (!GetFlag(mConnStateFlags, kConnState_CapabilitiesConfReceived))
+    if (!mConnStateFlags.Has(ConnectionStateFlag::kCapabilitiesConfReceived))
     {
-        SetFlag(mConnStateFlags, kConnState_CapabilitiesConfReceived, true);
+        mConnStateFlags.Set(ConnectionStateFlag::kCapabilitiesConfReceived);
 
         return HandleHandshakeConfirmationReceived();
     }
@@ -970,7 +969,7 @@ BLE_ERROR BLEEndPoint::DoSendStandAloneAck()
     mLocalReceiveWindowSize = mReceiveWindowMaxSize;
     ChipLogDebugBleEndPoint(Ble, "reset local rx window on stand-alone ack tx, size = %u", mLocalReceiveWindowSize);
 
-    SetFlag(mConnStateFlags, kConnState_StandAloneAckInFlight, true);
+    mConnStateFlags.Set(ConnectionStateFlag::kStandAloneAckInFlight);
 
     // Start ack received timer, if it's not already running.
     err = StartAckReceivedTimer();
@@ -989,12 +988,12 @@ BLE_ERROR BLEEndPoint::DriveSending()
     // If receiver's window is almost closed and we don't have an ack to send, OR we do have an ack to send but
     // receiver's window is completely empty, OR another GATT operation is in flight, awaiting confirmation...
     if ((mRemoteReceiveWindowSize <= BTP_WINDOW_NO_ACK_SEND_THRESHOLD &&
-         !GetFlag(mTimerStateFlags, kTimerState_SendAckTimerRunning) && mAckToSend.IsNull()) ||
-        (mRemoteReceiveWindowSize == 0) || (GetFlag(mConnStateFlags, kConnState_GattOperationInFlight)))
+         !mTimerStateFlags.Has(TimerStateFlag::kSendAckTimerRunning) && mAckToSend.IsNull()) ||
+        (mRemoteReceiveWindowSize == 0) || (mConnStateFlags.Has(ConnectionStateFlag::kGattOperationInFlight)))
     {
 #ifdef CHIP_BLE_END_POINT_DEBUG_LOGGING_ENABLED
         if (mRemoteReceiveWindowSize <= BTP_WINDOW_NO_ACK_SEND_THRESHOLD &&
-            !GetFlag(mTimerStateFlags, kTimerState_SendAckTimerRunning) && mAckToSend == NULL)
+            !mTimerStateFlags.Has(TimerStateFlag::kSendAckTimerRunning) && mAckToSend == NULL)
         {
             ChipLogDebugBleEndPoint(Ble, "NO SEND: receive window almost closed, and no ack to send");
         }
@@ -1004,7 +1003,7 @@ BLE_ERROR BLEEndPoint::DriveSending()
             ChipLogDebugBleEndPoint(Ble, "NO SEND: remote receive window closed");
         }
 
-        if (GetFlag(mConnStateFlags, kConnState_GattOperationInFlight))
+        if (mConnStateFlags.Has(ConnectionStateFlag::kGattOperationInFlight))
         {
             ChipLogDebugBleEndPoint(Ble, "NO SEND: Gatt op in flight");
         }
@@ -1273,13 +1272,13 @@ BLE_ERROR BLEEndPoint::Receive(PacketBufferHandle data)
         }
 
         // If we're receiving the first inbound packet of a BLE transport connection handshake...
-        if (!GetFlag(mConnStateFlags, kConnState_CapabilitiesMsgReceived))
+        if (!mConnStateFlags.Has(ConnectionStateFlag::kCapabilitiesMsgReceived))
         {
             if (mRole == kBleRole_Central) // If we're a central receiving a capabilities response indication...
             {
                 // Ensure end point's in the right state before continuing.
                 VerifyOrExit(mState == kState_Connecting, err = BLE_ERROR_INCORRECT_STATE);
-                SetFlag(mConnStateFlags, kConnState_CapabilitiesMsgReceived, true);
+                mConnStateFlags.Set(ConnectionStateFlag::kCapabilitiesMsgReceived);
 
                 err = HandleCapabilitiesResponseReceived(std::move(data));
                 SuccessOrExit(err);
@@ -1288,7 +1287,7 @@ BLE_ERROR BLEEndPoint::Receive(PacketBufferHandle data)
             {
                 // Ensure end point's in the right state before continuing.
                 VerifyOrExit(mState == kState_Ready, err = BLE_ERROR_INCORRECT_STATE);
-                SetFlag(mConnStateFlags, kConnState_CapabilitiesMsgReceived, true);
+                mConnStateFlags.Set(ConnectionStateFlag::kCapabilitiesMsgReceived);
 
                 err = HandleCapabilitiesRequestReceived(std::move(data));
 
@@ -1391,7 +1390,7 @@ BLE_ERROR BLEEndPoint::Receive(PacketBufferHandle data)
     if (mBtpEngine.HasUnackedData())
     {
         if (mLocalReceiveWindowSize <= BLE_CONFIG_IMMEDIATE_ACK_WINDOW_THRESHOLD &&
-            !GetFlag(mConnStateFlags, kConnState_GattOperationInFlight))
+            !mConnStateFlags.Has(ConnectionStateFlag::kGattOperationInFlight))
         {
             ChipLogDebugBleEndPoint(Ble, "sending immediate ack");
             err = DriveStandAloneAck();
@@ -1446,14 +1445,14 @@ exit:
 
 bool BLEEndPoint::SendWrite(PacketBufferHandle && buf)
 {
-    SetFlag(mConnStateFlags, kConnState_GattOperationInFlight, true);
+    mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight);
 
     return mBle->mPlatformDelegate->SendWriteRequest(mConnObj, &CHIP_BLE_SVC_ID, &mBle->CHIP_BLE_CHAR_1_ID, std::move(buf));
 }
 
 bool BLEEndPoint::SendIndication(PacketBufferHandle && buf)
 {
-    SetFlag(mConnStateFlags, kConnState_GattOperationInFlight, true);
+    mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight);
 
     return mBle->mPlatformDelegate->SendIndication(mConnObj, &CHIP_BLE_SVC_ID, &mBle->CHIP_BLE_CHAR_2_ID, std::move(buf));
 }
@@ -1465,7 +1464,7 @@ BLE_ERROR BLEEndPoint::StartConnectTimer()
 
     timerErr = mBle->mSystemLayer->StartTimer(BLE_CONNECT_TIMEOUT_MS, HandleConnectTimeout, this);
     VerifyOrExit(timerErr == CHIP_SYSTEM_NO_ERROR, err = BLE_ERROR_START_TIMER_FAILED);
-    SetFlag(mTimerStateFlags, kTimerState_ConnectTimerRunning, true);
+    mTimerStateFlags.Set(TimerStateFlag::kConnectTimerRunning);
 
 exit:
     return err;
@@ -1478,7 +1477,7 @@ BLE_ERROR BLEEndPoint::StartReceiveConnectionTimer()
 
     timerErr = mBle->mSystemLayer->StartTimer(BLE_CONNECT_TIMEOUT_MS, HandleReceiveConnectionTimeout, this);
     VerifyOrExit(timerErr == CHIP_SYSTEM_NO_ERROR, err = BLE_ERROR_START_TIMER_FAILED);
-    SetFlag(mTimerStateFlags, kTimerState_ReceiveConnectionTimerRunning, true);
+    mTimerStateFlags.Set(TimerStateFlag::kReceiveConnectionTimerRunning);
 
 exit:
     return err;
@@ -1489,12 +1488,12 @@ BLE_ERROR BLEEndPoint::StartAckReceivedTimer()
     BLE_ERROR err = BLE_NO_ERROR;
     chip::System::Error timerErr;
 
-    if (!GetFlag(mTimerStateFlags, kTimerState_AckReceivedTimerRunning))
+    if (!mTimerStateFlags.Has(TimerStateFlag::kAckReceivedTimerRunning))
     {
         timerErr = mBle->mSystemLayer->StartTimer(BTP_ACK_RECEIVED_TIMEOUT_MS, HandleAckReceivedTimeout, this);
         VerifyOrExit(timerErr == CHIP_SYSTEM_NO_ERROR, err = BLE_ERROR_START_TIMER_FAILED);
 
-        SetFlag(mTimerStateFlags, kTimerState_AckReceivedTimerRunning, true);
+        mTimerStateFlags.Set(TimerStateFlag::kAckReceivedTimerRunning);
     }
 
 exit:
@@ -1505,7 +1504,7 @@ BLE_ERROR BLEEndPoint::RestartAckReceivedTimer()
 {
     BLE_ERROR err = BLE_NO_ERROR;
 
-    VerifyOrExit(GetFlag(mTimerStateFlags, kTimerState_AckReceivedTimerRunning), err = BLE_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mTimerStateFlags.Has(TimerStateFlag::kAckReceivedTimerRunning), err = BLE_ERROR_INCORRECT_STATE);
 
     StopAckReceivedTimer();
 
@@ -1523,13 +1522,13 @@ BLE_ERROR BLEEndPoint::StartSendAckTimer()
 
     ChipLogDebugBleEndPoint(Ble, "entered StartSendAckTimer");
 
-    if (!GetFlag(mTimerStateFlags, kTimerState_SendAckTimerRunning))
+    if (!mTimerStateFlags.Has(TimerStateFlag::kSendAckTimerRunning))
     {
         ChipLogDebugBleEndPoint(Ble, "starting new SendAckTimer");
         timerErr = mBle->mSystemLayer->StartTimer(BTP_ACK_SEND_TIMEOUT_MS, HandleSendAckTimeout, this);
         VerifyOrExit(timerErr == CHIP_SYSTEM_NO_ERROR, err = BLE_ERROR_START_TIMER_FAILED);
 
-        SetFlag(mTimerStateFlags, kTimerState_SendAckTimerRunning, true);
+        mTimerStateFlags.Set(TimerStateFlag::kSendAckTimerRunning);
     }
 
 exit:
@@ -1543,7 +1542,7 @@ BLE_ERROR BLEEndPoint::StartUnsubscribeTimer()
 
     timerErr = mBle->mSystemLayer->StartTimer(BLE_UNSUBSCRIBE_TIMEOUT_MS, HandleUnsubscribeTimeout, this);
     VerifyOrExit(timerErr == CHIP_SYSTEM_NO_ERROR, err = BLE_ERROR_START_TIMER_FAILED);
-    SetFlag(mTimerStateFlags, kTimerState_UnsubscribeTimerRunning, true);
+    mTimerStateFlags.Set(TimerStateFlag::kUnsubscribeTimerRunning);
 
 exit:
     return err;
@@ -1553,35 +1552,35 @@ void BLEEndPoint::StopConnectTimer()
 {
     // Cancel any existing connect timer.
     mBle->mSystemLayer->CancelTimer(HandleConnectTimeout, this);
-    SetFlag(mTimerStateFlags, kTimerState_ConnectTimerRunning, false);
+    mTimerStateFlags.Clear(TimerStateFlag::kConnectTimerRunning);
 }
 
 void BLEEndPoint::StopReceiveConnectionTimer()
 {
     // Cancel any existing receive connection timer.
     mBle->mSystemLayer->CancelTimer(HandleReceiveConnectionTimeout, this);
-    SetFlag(mTimerStateFlags, kTimerState_ReceiveConnectionTimerRunning, false);
+    mTimerStateFlags.Clear(TimerStateFlag::kReceiveConnectionTimerRunning);
 }
 
 void BLEEndPoint::StopAckReceivedTimer()
 {
     // Cancel any existing ack-received timer.
     mBle->mSystemLayer->CancelTimer(HandleAckReceivedTimeout, this);
-    SetFlag(mTimerStateFlags, kTimerState_AckReceivedTimerRunning, false);
+    mTimerStateFlags.Clear(TimerStateFlag::kAckReceivedTimerRunning);
 }
 
 void BLEEndPoint::StopSendAckTimer()
 {
     // Cancel any existing send-ack timer.
     mBle->mSystemLayer->CancelTimer(HandleSendAckTimeout, this);
-    SetFlag(mTimerStateFlags, kTimerState_SendAckTimerRunning, false);
+    mTimerStateFlags.Clear(TimerStateFlag::kSendAckTimerRunning);
 }
 
 void BLEEndPoint::StopUnsubscribeTimer()
 {
     // Cancel any existing unsubscribe timer.
     mBle->mSystemLayer->CancelTimer(HandleUnsubscribeTimeout, this);
-    SetFlag(mTimerStateFlags, kTimerState_UnsubscribeTimerRunning, false);
+    mTimerStateFlags.Clear(TimerStateFlag::kUnsubscribeTimerRunning);
 }
 
 void BLEEndPoint::HandleConnectTimeout(chip::System::Layer * systemLayer, void * appState, chip::System::Error err)
@@ -1589,10 +1588,10 @@ void BLEEndPoint::HandleConnectTimeout(chip::System::Layer * systemLayer, void *
     BLEEndPoint * ep = static_cast<BLEEndPoint *>(appState);
 
     // Check for event-based timer race condition.
-    if (GetFlag(ep->mTimerStateFlags, kTimerState_ConnectTimerRunning))
+    if (ep->mTimerStateFlags.Has(TimerStateFlag::kConnectTimerRunning))
     {
         ChipLogError(Ble, "connect handshake timed out, closing ep %p", ep);
-        SetFlag(ep->mTimerStateFlags, kTimerState_ConnectTimerRunning, false);
+        ep->mTimerStateFlags.Clear(TimerStateFlag::kConnectTimerRunning);
         ep->DoClose(kBleCloseFlag_AbortTransmission, BLE_ERROR_CONNECT_TIMED_OUT);
     }
 }
@@ -1602,10 +1601,10 @@ void BLEEndPoint::HandleReceiveConnectionTimeout(chip::System::Layer * systemLay
     BLEEndPoint * ep = static_cast<BLEEndPoint *>(appState);
 
     // Check for event-based timer race condition.
-    if (GetFlag(ep->mTimerStateFlags, kTimerState_ReceiveConnectionTimerRunning))
+    if (ep->mTimerStateFlags.Has(TimerStateFlag::kReceiveConnectionTimerRunning))
     {
         ChipLogError(Ble, "receive handshake timed out, closing ep %p", ep);
-        SetFlag(ep->mTimerStateFlags, kTimerState_ReceiveConnectionTimerRunning, false);
+        ep->mTimerStateFlags.Clear(TimerStateFlag::kReceiveConnectionTimerRunning);
         ep->DoClose(kBleCloseFlag_SuppressCallback | kBleCloseFlag_AbortTransmission, BLE_ERROR_RECEIVE_TIMED_OUT);
     }
 }
@@ -1615,11 +1614,11 @@ void BLEEndPoint::HandleAckReceivedTimeout(chip::System::Layer * systemLayer, vo
     BLEEndPoint * ep = static_cast<BLEEndPoint *>(appState);
 
     // Check for event-based timer race condition.
-    if (GetFlag(ep->mTimerStateFlags, kTimerState_AckReceivedTimerRunning))
+    if (ep->mTimerStateFlags.Has(TimerStateFlag::kAckReceivedTimerRunning))
     {
         ChipLogError(Ble, "ack recv timeout, closing ep %p", ep);
         ep->mBtpEngine.LogStateDebug();
-        SetFlag(ep->mTimerStateFlags, kTimerState_AckReceivedTimerRunning, false);
+        ep->mTimerStateFlags.Clear(TimerStateFlag::kAckReceivedTimerRunning);
         ep->DoClose(kBleCloseFlag_AbortTransmission, BLE_ERROR_FRAGMENT_ACK_TIMED_OUT);
     }
 }
@@ -1629,12 +1628,12 @@ void BLEEndPoint::HandleSendAckTimeout(chip::System::Layer * systemLayer, void *
     BLEEndPoint * ep = static_cast<BLEEndPoint *>(appState);
 
     // Check for event-based timer race condition.
-    if (GetFlag(ep->mTimerStateFlags, kTimerState_SendAckTimerRunning))
+    if (ep->mTimerStateFlags.Has(TimerStateFlag::kSendAckTimerRunning))
     {
-        SetFlag(ep->mTimerStateFlags, kTimerState_SendAckTimerRunning, false);
+        ep->mTimerStateFlags.Clear(TimerStateFlag::kSendAckTimerRunning);
 
         // If previous stand-alone ack isn't still in flight...
-        if (!GetFlag(ep->mConnStateFlags, kConnState_StandAloneAckInFlight))
+        if (!ep->mConnStateFlags.Has(ConnectionStateFlag::kStandAloneAckInFlight))
         {
             BLE_ERROR sendErr = ep->DriveStandAloneAck();
 
@@ -1651,10 +1650,10 @@ void BLEEndPoint::HandleUnsubscribeTimeout(chip::System::Layer * systemLayer, vo
     BLEEndPoint * ep = static_cast<BLEEndPoint *>(appState);
 
     // Check for event-based timer race condition.
-    if (GetFlag(ep->mTimerStateFlags, kTimerState_UnsubscribeTimerRunning))
+    if (ep->mTimerStateFlags.Has(TimerStateFlag::kUnsubscribeTimerRunning))
     {
         ChipLogError(Ble, "unsubscribe timed out, ble ep %p", ep);
-        SetFlag(ep->mTimerStateFlags, kTimerState_UnsubscribeTimerRunning, false);
+        ep->mTimerStateFlags.Clear(TimerStateFlag::kUnsubscribeTimerRunning);
         ep->HandleUnsubscribeComplete();
     }
 }
index 36daf0d..cc1aa3a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2014-2017 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -107,26 +107,26 @@ public:
 
 private:
     // Private data members:
-    enum ConnectionStateFlags
+    enum class ConnectionStateFlag : uint8_t
     {
-        kConnState_AutoClose                = 0x01, // End point should close underlying BLE conn on BTP close.
-        kConnState_CapabilitiesConfReceived = 0x02, // GATT confirmation received for sent capabilities req/resp.
-        kConnState_CapabilitiesMsgReceived  = 0x04, // Capabilities request or response message received.
-        kConnState_DidBeginSubscribe        = 0x08, // GATT subscribe request sent; must unsubscribe on close.
-        kConnState_StandAloneAckInFlight    = 0x10, // Stand-alone ack in flight, awaiting GATT confirmation.
-        kConnState_GattOperationInFlight    = 0x20  // GATT write, indication, subscribe, or unsubscribe in flight,
-                                                    // awaiting GATT confirmation.
+        kAutoClose                = 0x01, // End point should close underlying BLE conn on BTP close.
+        kCapabilitiesConfReceived = 0x02, // GATT confirmation received for sent capabilities req/resp.
+        kCapabilitiesMsgReceived  = 0x04, // Capabilities request or response message received.
+        kDidBeginSubscribe        = 0x08, // GATT subscribe request sent; must unsubscribe on close.
+        kStandAloneAckInFlight    = 0x10, // Stand-alone ack in flight, awaiting GATT confirmation.
+        kGattOperationInFlight    = 0x20  // GATT write, indication, subscribe, or unsubscribe in flight,
+                                          // awaiting GATT confirmation.
     };
 
-    enum TimerStateFlags
+    enum class TimerStateFlag : uint8_t
     {
-        kTimerState_ConnectTimerRunning           = 0x01, // BTP connect completion timer running.
-        kTimerState_ReceiveConnectionTimerRunning = 0x02, // BTP receive connection completion timer running.
-        kTimerState_AckReceivedTimerRunning       = 0x04, // Ack received timer running due to unacked sent fragment.
-        kTimerState_SendAckTimerRunning           = 0x08, // Send ack timer running; indicates pending ack to send.
-        kTimerState_UnsubscribeTimerRunning       = 0x10, // Unsubscribe completion timer running.
+        kConnectTimerRunning           = 0x01, // BTP connect completion timer running.
+        kReceiveConnectionTimerRunning = 0x02, // BTP receive connection completion timer running.
+        kAckReceivedTimerRunning       = 0x04, // Ack received timer running due to unacked sent fragment.
+        kSendAckTimerRunning           = 0x08, // Send ack timer running; indicates pending ack to send.
+        kUnsubscribeTimerRunning       = 0x10, // Unsubscribe completion timer running.
 #if CHIP_ENABLE_CHIPOBLE_TEST
-        kTimerState_UnderTestTimerRunnung = 0x80 // running throughput Tx test
+        kUnderTestTimerRunnung = 0x80 // running throughput Tx test
 #endif
     };
 
@@ -147,8 +147,8 @@ private:
 
     BtpEngine mBtpEngine;
     BleRole mRole;
-    uint8_t mConnStateFlags;
-    uint8_t mTimerStateFlags;
+    BitFlags<ConnectionStateFlag> mConnStateFlags;
+    BitFlags<TimerStateFlag> mTimerStateFlags;
     SequenceNumber_t mLocalReceiveWindowSize;
     SequenceNumber_t mRemoteReceiveWindowSize;
     SequenceNumber_t mReceiveWindowMaxSize;
index ef83b90..4b62c98 100644 (file)
@@ -55,10 +55,10 @@ static inline void IncSeqNum(SequenceNumber_t & a_seq_num)
     a_seq_num = static_cast<SequenceNumber_t>(0xff & ((a_seq_num) + 1));
 }
 
-static inline bool DidReceiveData(uint8_t rx_flags)
+static inline bool DidReceiveData(BitFlags<BtpEngine::HeaderFlags> rx_flags)
 {
-    return (GetFlag(rx_flags, BtpEngine::kHeaderFlag_StartMessage) || GetFlag(rx_flags, BtpEngine::kHeaderFlag_ContinueMessage) ||
-            GetFlag(rx_flags, BtpEngine::kHeaderFlag_EndMessage));
+    return rx_flags.HasAny(BtpEngine::HeaderFlags::kStartMessage, BtpEngine::HeaderFlags::kContinueMessage,
+                           BtpEngine::HeaderFlags::kEndMessage);
 }
 
 static void PrintBufDebug(const System::PacketBufferHandle & buf)
@@ -213,7 +213,7 @@ BLE_ERROR BtpEngine::EncodeStandAloneAck(const PacketBufferHandle & data)
     characteristic = data->Start();
 
     // Since there's no preexisting message payload, we can write BTP header without adjusting data start pointer.
-    characteristic[0] = kHeaderFlag_FragmentAck;
+    characteristic[0] = static_cast<uint8_t>(HeaderFlags::kFragmentAck);
 
     // Acknowledge most recently received sequence number.
     characteristic[1] = GetAndRecordRxAckSeqNum();
@@ -245,8 +245,8 @@ exit:
 BLE_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle data, SequenceNumber_t & receivedAck,
                                                   bool & didReceiveAck)
 {
-    BLE_ERROR err    = BLE_NO_ERROR;
-    uint8_t rx_flags = 0;
+    BLE_ERROR err = BLE_NO_ERROR;
+    BitFlags<HeaderFlags> rx_flags;
     // BLE data uses little-endian byte order.
     Encoding::LittleEndian::Reader reader(data->Start(), data->DataLength());
 
@@ -255,15 +255,15 @@ BLE_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle dat
     mRxCharCount++;
 
     // Get header flags, always in first byte.
-    VerifyOrExit(reader.Read8(&rx_flags).StatusCode() == CHIP_NO_ERROR, err = BLE_ERROR_MESSAGE_INCOMPLETE);
+    VerifyOrExit(reader.Read8(rx_flags.RawStorage()).StatusCode() == CHIP_NO_ERROR, err = BLE_ERROR_MESSAGE_INCOMPLETE);
 #if CHIP_ENABLE_CHIPOBLE_TEST
-    if (GetFlag(rx_flags, kHeaderFlag_CommandMessage))
+    if (rx_flags.Has(HeaderFlags::kCommandMessage))
         SetRxPacketType(kType_Control);
     else
         SetRxPacketType(kType_Data);
 #endif
 
-    didReceiveAck = GetFlag(rx_flags, kHeaderFlag_FragmentAck);
+    didReceiveAck = rx_flags.Has(HeaderFlags::kFragmentAck);
 
     // Get ack number, if any.
     if (didReceiveAck)
@@ -309,7 +309,7 @@ BLE_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle dat
         Encoding::LittleEndian::Reader startReader(data->Start(), data->DataLength());
 
         // Verify StartMessage header flag set.
-        VerifyOrExit(rx_flags & kHeaderFlag_StartMessage, err = BLE_ERROR_INVALID_BTP_HEADER_FLAGS);
+        VerifyOrExit(rx_flags.Has(HeaderFlags::kStartMessage), err = BLE_ERROR_INVALID_BTP_HEADER_FLAGS);
 
         VerifyOrExit(startReader.Read16(&mRxLength).StatusCode() == CHIP_NO_ERROR, err = BLE_ERROR_MESSAGE_INCOMPLETE);
 
@@ -328,10 +328,10 @@ BLE_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle dat
     else if (mRxState == kState_InProgress)
     {
         // Verify StartMessage header flag NOT set, since we're in the middle of receiving a message.
-        VerifyOrExit((rx_flags & kHeaderFlag_StartMessage) == 0, err = BLE_ERROR_INVALID_BTP_HEADER_FLAGS);
+        VerifyOrExit(!rx_flags.Has(HeaderFlags::kStartMessage), err = BLE_ERROR_INVALID_BTP_HEADER_FLAGS);
 
         // Verify ContinueMessage or EndMessage header flag set.
-        VerifyOrExit((rx_flags & kHeaderFlag_ContinueMessage) || (rx_flags & kHeaderFlag_EndMessage),
+        VerifyOrExit(rx_flags.HasAny(HeaderFlags::kContinueMessage, HeaderFlags::kEndMessage),
                      err = BLE_ERROR_INVALID_BTP_HEADER_FLAGS);
 
         // Add received fragment to reassembled message buffer.
@@ -348,7 +348,7 @@ BLE_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle dat
         ExitNow();
     }
 
-    if (rx_flags & kHeaderFlag_EndMessage)
+    if (rx_flags.Has(HeaderFlags::kEndMessage))
     {
         // Trim remainder, if any, of the received packet buffer based on sender-specified length of reassembled message.
         int padding = mRxBuf->DataLength() - mRxLength;
@@ -372,7 +372,7 @@ exit:
         mRxState = kState_Error;
 
         // Dump protocol engine state, plus header flags and received data length.
-        ChipLogError(Ble, "HandleCharacteristicReceived failed, err = %d, rx_flags = %u", err, rx_flags);
+        ChipLogError(Ble, "HandleCharacteristicReceived failed, err = %d, rx_flags = %u", err, rx_flags.Raw());
         if (didReceiveAck)
         {
             ChipLogError(Ble, "With rx'd ack = %u", receivedAck);
@@ -457,17 +457,16 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
         characteristic -= header_size;
         mTxBuf->SetStart(characteristic);
         uint8_t cursor = 1; // first position past header flags byte
-
-        characteristic[0] = kHeaderFlag_StartMessage;
+        BitFlags<HeaderFlags> headerFlags(HeaderFlags::kStartMessage);
 
 #if CHIP_ENABLE_CHIPOBLE_TEST
         if (TxPacketType() == kType_Control)
-            SetFlag(characteristic[0], kHeaderFlag_CommandMessage, true);
+            headerFlags.Set(HeaderFlags::kCommandMessage);
 #endif
 
         if (send_ack)
         {
-            SetFlag(characteristic[0], kHeaderFlag_FragmentAck, true);
+            headerFlags.Set(HeaderFlags::kFragmentAck);
             characteristic[cursor++] = GetAndRecordRxAckSeqNum();
             ChipLogDebugBtpEngine(Ble, "===> encoded piggybacked ack, ack_num = %u", characteristic[cursor - 1]);
         }
@@ -480,7 +479,7 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
         {
             mTxBuf->SetDataLength(static_cast<uint16_t>(mTxLength + cursor));
             mTxLength = 0;
-            SetFlag(characteristic[0], kHeaderFlag_EndMessage, true);
+            headerFlags.Set(HeaderFlags::kEndMessage);
             mTxState = kState_Complete;
             mTxPacketCount++;
         }
@@ -490,6 +489,7 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
             mTxLength = static_cast<uint16_t>((mTxLength + cursor) - mTxFragmentSize);
         }
 
+        characteristic[0] = headerFlags.Raw();
         ChipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send first fragment:");
         PrintBufDebug(data);
     }
@@ -510,16 +510,16 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
         mTxBuf->SetStart(characteristic);
         uint8_t cursor = 1; // first position past header flags byte
 
-        characteristic[0] = kHeaderFlag_ContinueMessage;
+        BitFlags<HeaderFlags> headerFlags(HeaderFlags::kContinueMessage);
 
 #if CHIP_ENABLE_CHIPOBLE_TEST
         if (TxPacketType() == kType_Control)
-            SetFlag(characteristic[0], kHeaderFlag_CommandMessage, true);
+            headerFlags.Set(HeaderFlags::kCommandMessage);
 #endif
 
         if (send_ack)
         {
-            SetFlag(characteristic[0], kHeaderFlag_FragmentAck, true);
+            headerFlags.Set(HeaderFlags::kFragmentAck);
             characteristic[cursor++] = GetAndRecordRxAckSeqNum();
             ChipLogDebugBtpEngine(Ble, "===> encoded piggybacked ack, ack_num = %u", characteristic[cursor - 1]);
         }
@@ -530,7 +530,7 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
         {
             mTxBuf->SetDataLength(static_cast<uint16_t>(mTxLength + cursor));
             mTxLength = 0;
-            SetFlag(characteristic[0], kHeaderFlag_EndMessage, true);
+            headerFlags.Set(HeaderFlags::kEndMessage);
             mTxState = kState_Complete;
             mTxPacketCount++;
         }
@@ -540,6 +540,7 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
             mTxLength = static_cast<uint16_t>((mTxLength + cursor) - mTxFragmentSize);
         }
 
+        characteristic[0] = headerFlags.Raw();
         ChipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send additional fragment:");
         PrintBufDebug(mTxBuf);
     }
index 9b7a6c5..43dda04 100644 (file)
@@ -87,16 +87,17 @@ public:
         kState_Error      = 3
     } State_t; // [READ-ONLY] Current state
 
-    enum
+    // Masks for BTP fragment header flag bits.
+    enum class HeaderFlags : uint8_t
     {
-        kHeaderFlag_StartMessage    = 0x01,
-        kHeaderFlag_ContinueMessage = 0x02,
-        kHeaderFlag_EndMessage      = 0x04,
-        kHeaderFlag_FragmentAck     = 0x08,
+        kStartMessage    = 0x01,
+        kContinueMessage = 0x02,
+        kEndMessage      = 0x04,
+        kFragmentAck     = 0x08,
 #if CHIP_ENABLE_CHIPOBLE_TEST
-        kHeaderFlag_CommandMessage = 0x10,
+        kCommandMessage = 0x10,
 #endif
-    }; // Masks for BTP fragment header flag bits.
+    };
 
     static const uint16_t sDefaultFragmentSize;
     static const uint16_t sMaxFragmentSize;
@@ -129,7 +130,10 @@ public:
     inline SequenceNumber_t SetRxPacketSeq(SequenceNumber_t seq) { return (mRxPacketSeq = seq); }
     inline SequenceNumber_t TxPacketSeq() { return mTxPacketSeq; }
     inline SequenceNumber_t RxPacketSeq() { return mRxPacketSeq; }
-    inline bool IsCommandPacket(const PacketBufferHandle & p) { return GetFlag(*(p->Start()), kHeaderFlag_CommandMessage); }
+    inline bool IsCommandPacket(const PacketBufferHandle & p)
+    {
+        return BitFlags<HeaderFlags>(*(p->Start())).Has(HeaderFlags::kCommandMessage);
+    }
     inline void PushPacketTag(const PacketBufferHandle & p, PacketType_t type)
     {
         p->SetStart(p->Start() - sizeof(type));
index f6145a9..4223e0e 100644 (file)
@@ -114,7 +114,7 @@ CHIP_ERROR BarrierControlCluster::BarrierControlGoToPercent(Callback::Cancelable
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kBarrierControlGoToPercentCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -148,7 +148,7 @@ CHIP_ERROR BarrierControlCluster::BarrierControlStop(Callback::Cancelable * onSu
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kBarrierControlStopCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -227,7 +227,7 @@ CHIP_ERROR BasicCluster::MfgSpecificPing(Callback::Cancelable * onSuccessCallbac
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMfgSpecificPingCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -249,55 +249,109 @@ CHIP_ERROR BasicCluster::MfgSpecificPing(Callback::Cancelable * onSuccessCallbac
 #endif
 }
 
-CHIP_ERROR BasicCluster::ResetToFactoryDefaults(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
+// Basic Cluster Attributes
+CHIP_ERROR BasicCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
 {
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterDiscoverAttributes(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
+CHIP_ERROR BasicCluster::ReadAttributeInteractionModelVersion(Callback::Cancelable * onSuccessCallback,
+                                                              Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadInteractionModelVersionAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
 
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kResetToFactoryDefaultsCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
+CHIP_ERROR BasicCluster::ReadAttributeVendorName(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadVendorNameAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
 
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
+CHIP_ERROR BasicCluster::ReadAttributeVendorID(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadVendorIDAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
 
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
+CHIP_ERROR BasicCluster::ReadAttributeProductName(Callback::Cancelable * onSuccessCallback,
+                                                  Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadProductNameAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
 
-    // Command takes no arguments.
+CHIP_ERROR BasicCluster::ReadAttributeProductID(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadProductIDAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
 
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
+CHIP_ERROR BasicCluster::ReadAttributeUserLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadUserLabelAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
 
-    return mDevice->SendCommands();
-#else
+CHIP_ERROR BasicCluster::WriteAttributeUserLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
+                                                 chip::ByteSpan value)
+{
     uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeBasicClusterResetToFactoryDefaultsCommand(seqNum, mEndpoint);
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterWriteUserLabelAttribute(seqNum, mEndpoint, value);
     return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
 }
 
-// Basic Cluster Attributes
-CHIP_ERROR BasicCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
+CHIP_ERROR BasicCluster::ReadAttributeLocation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
 {
     uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeBasicClusterDiscoverAttributes(seqNum, mEndpoint);
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadLocationAttribute(seqNum, mEndpoint);
     return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
 }
-CHIP_ERROR BasicCluster::ReadAttributeZclVersion(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
+
+CHIP_ERROR BasicCluster::WriteAttributeLocation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
+                                                chip::ByteSpan value)
 {
     uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadZclVersionAttribute(seqNum, mEndpoint);
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterWriteLocationAttribute(seqNum, mEndpoint, value);
     return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
 }
 
-CHIP_ERROR BasicCluster::ReadAttributePowerSource(Callback::Cancelable * onSuccessCallback,
-                                                  Callback::Cancelable * onFailureCallback)
+CHIP_ERROR BasicCluster::ReadAttributeHardwareVersion(Callback::Cancelable * onSuccessCallback,
+                                                      Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadHardwareVersionAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
+
+CHIP_ERROR BasicCluster::ReadAttributeHardwareVersionString(Callback::Cancelable * onSuccessCallback,
+                                                            Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadHardwareVersionStringAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
+
+CHIP_ERROR BasicCluster::ReadAttributeSoftwareVersion(Callback::Cancelable * onSuccessCallback,
+                                                      Callback::Cancelable * onFailureCallback)
+{
+    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadSoftwareVersionAttribute(seqNum, mEndpoint);
+    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
+}
+
+CHIP_ERROR BasicCluster::ReadAttributeSoftwareVersionString(Callback::Cancelable * onSuccessCallback,
+                                                            Callback::Cancelable * onFailureCallback)
 {
     uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadPowerSourceAttribute(seqNum, mEndpoint);
+    System::PacketBufferHandle encodedCommand = encodeBasicClusterReadSoftwareVersionStringAttribute(seqNum, mEndpoint);
     return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
 }
 
@@ -319,7 +373,7 @@ CHIP_ERROR BindingCluster::Bind(Callback::Cancelable * onSuccessCallback, Callba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kBindCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -360,7 +414,7 @@ CHIP_ERROR BindingCluster::Unbind(Callback::Cancelable * onSuccessCallback, Call
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kUnbindCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -416,7 +470,7 @@ CHIP_ERROR ColorControlCluster::MoveColor(Callback::Cancelable * onSuccessCallba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveColorCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -458,7 +512,7 @@ CHIP_ERROR ColorControlCluster::MoveColorTemperature(Callback::Cancelable * onSu
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveColorTemperatureCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -502,7 +556,7 @@ CHIP_ERROR ColorControlCluster::MoveHue(Callback::Cancelable * onSuccessCallback
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveHueCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -542,7 +596,7 @@ CHIP_ERROR ColorControlCluster::MoveSaturation(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveSaturationCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -583,7 +637,7 @@ CHIP_ERROR ColorControlCluster::MoveToColor(Callback::Cancelable * onSuccessCall
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveToColorCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -626,7 +680,7 @@ CHIP_ERROR ColorControlCluster::MoveToColorTemperature(Callback::Cancelable * on
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveToColorTemperatureCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -667,7 +721,7 @@ CHIP_ERROR ColorControlCluster::MoveToHue(Callback::Cancelable * onSuccessCallba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveToHueCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -710,7 +764,7 @@ CHIP_ERROR ColorControlCluster::MoveToHueAndSaturation(Callback::Cancelable * on
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveToHueAndSaturationCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -753,7 +807,7 @@ CHIP_ERROR ColorControlCluster::MoveToSaturation(Callback::Cancelable * onSucces
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveToSaturationCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -794,7 +848,7 @@ CHIP_ERROR ColorControlCluster::StepColor(Callback::Cancelable * onSuccessCallba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStepColorCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -838,7 +892,7 @@ CHIP_ERROR ColorControlCluster::StepColorTemperature(Callback::Cancelable * onSu
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStepColorTemperatureCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -886,7 +940,7 @@ CHIP_ERROR ColorControlCluster::StepHue(Callback::Cancelable * onSuccessCallback
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStepHueCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -929,7 +983,7 @@ CHIP_ERROR ColorControlCluster::StepSaturation(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStepSaturationCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -971,7 +1025,7 @@ CHIP_ERROR ColorControlCluster::StopMoveStep(Callback::Cancelable * onSuccessCal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStopMoveStepCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1610,7 +1664,7 @@ CHIP_ERROR ContentLaunchCluster::LaunchContent(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kLaunchContentCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1640,7 +1694,7 @@ CHIP_ERROR ContentLaunchCluster::LaunchURL(Callback::Cancelable * onSuccessCallb
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kLaunchURLCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1687,7 +1741,7 @@ CHIP_ERROR DoorLockCluster::ClearAllPins(Callback::Cancelable * onSuccessCallbac
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearAllPinsCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1717,7 +1771,7 @@ CHIP_ERROR DoorLockCluster::ClearAllRfids(Callback::Cancelable * onSuccessCallba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearAllRfidsCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1748,7 +1802,7 @@ CHIP_ERROR DoorLockCluster::ClearHolidaySchedule(Callback::Cancelable * onSucces
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearHolidayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1781,7 +1835,7 @@ CHIP_ERROR DoorLockCluster::ClearPin(Callback::Cancelable * onSuccessCallback, C
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearPinCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1814,7 +1868,7 @@ CHIP_ERROR DoorLockCluster::ClearRfid(Callback::Cancelable * onSuccessCallback,
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearRfidCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1847,7 +1901,7 @@ CHIP_ERROR DoorLockCluster::ClearWeekdaySchedule(Callback::Cancelable * onSucces
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearWeekdayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1883,7 +1937,7 @@ CHIP_ERROR DoorLockCluster::ClearYeardaySchedule(Callback::Cancelable * onSucces
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kClearYeardayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1919,7 +1973,7 @@ CHIP_ERROR DoorLockCluster::GetHolidaySchedule(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetHolidayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1952,7 +2006,7 @@ CHIP_ERROR DoorLockCluster::GetLogRecord(Callback::Cancelable * onSuccessCallbac
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetLogRecordCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -1985,7 +2039,7 @@ CHIP_ERROR DoorLockCluster::GetPin(Callback::Cancelable * onSuccessCallback, Cal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetPinCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2018,7 +2072,7 @@ CHIP_ERROR DoorLockCluster::GetRfid(Callback::Cancelable * onSuccessCallback, Ca
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetRfidCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2051,7 +2105,7 @@ CHIP_ERROR DoorLockCluster::GetUserType(Callback::Cancelable * onSuccessCallback
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetUserTypeCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2084,7 +2138,7 @@ CHIP_ERROR DoorLockCluster::GetWeekdaySchedule(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetWeekdayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2120,7 +2174,7 @@ CHIP_ERROR DoorLockCluster::GetYeardaySchedule(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetYeardayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2147,7 +2201,8 @@ CHIP_ERROR DoorLockCluster::GetYeardaySchedule(Callback::Cancelable * onSuccessC
 #endif
 }
 
-CHIP_ERROR DoorLockCluster::LockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, char * pin)
+CHIP_ERROR DoorLockCluster::LockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
+                                     chip::ByteSpan pin)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
     VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
@@ -2155,7 +2210,7 @@ CHIP_ERROR DoorLockCluster::LockDoor(Callback::Cancelable * onSuccessCallback, C
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kLockDoorCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2189,7 +2244,7 @@ CHIP_ERROR DoorLockCluster::SetHolidaySchedule(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetHolidayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2221,7 +2276,7 @@ CHIP_ERROR DoorLockCluster::SetHolidaySchedule(Callback::Cancelable * onSuccessC
 }
 
 CHIP_ERROR DoorLockCluster::SetPin(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                   uint16_t userId, uint8_t userStatus, uint8_t userType, char * pin)
+                                   uint16_t userId, uint8_t userStatus, uint8_t userType, chip::ByteSpan pin)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
     VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
@@ -2229,7 +2284,7 @@ CHIP_ERROR DoorLockCluster::SetPin(Callback::Cancelable * onSuccessCallback, Cal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetPinCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2261,7 +2316,7 @@ CHIP_ERROR DoorLockCluster::SetPin(Callback::Cancelable * onSuccessCallback, Cal
 }
 
 CHIP_ERROR DoorLockCluster::SetRfid(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                    uint16_t userId, uint8_t userStatus, uint8_t userType, char * id)
+                                    uint16_t userId, uint8_t userStatus, uint8_t userType, chip::ByteSpan id)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
     VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
@@ -2269,7 +2324,7 @@ CHIP_ERROR DoorLockCluster::SetRfid(Callback::Cancelable * onSuccessCallback, Ca
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetRfidCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2309,7 +2364,7 @@ CHIP_ERROR DoorLockCluster::SetUserType(Callback::Cancelable * onSuccessCallback
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetUserTypeCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2345,7 +2400,7 @@ CHIP_ERROR DoorLockCluster::SetWeekdaySchedule(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetWeekdayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2391,7 +2446,7 @@ CHIP_ERROR DoorLockCluster::SetYeardaySchedule(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetYeardayScheduleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2423,7 +2478,7 @@ CHIP_ERROR DoorLockCluster::SetYeardaySchedule(Callback::Cancelable * onSuccessC
 }
 
 CHIP_ERROR DoorLockCluster::UnlockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                       char * pin)
+                                       chip::ByteSpan pin)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
     VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
@@ -2431,7 +2486,7 @@ CHIP_ERROR DoorLockCluster::UnlockDoor(Callback::Cancelable * onSuccessCallback,
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kUnlockDoorCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2456,7 +2511,7 @@ CHIP_ERROR DoorLockCluster::UnlockDoor(Callback::Cancelable * onSuccessCallback,
 }
 
 CHIP_ERROR DoorLockCluster::UnlockWithTimeout(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                              uint16_t timeoutInSeconds, char * pin)
+                                              uint16_t timeoutInSeconds, chip::ByteSpan pin)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
     VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
@@ -2464,7 +2519,7 @@ CHIP_ERROR DoorLockCluster::UnlockWithTimeout(Callback::Cancelable * onSuccessCa
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kUnlockWithTimeoutCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2556,7 +2611,7 @@ CHIP_ERROR GeneralCommissioningCluster::ArmFailSafe(Callback::Cancelable * onSuc
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kArmFailSafeCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2594,7 +2649,7 @@ CHIP_ERROR GeneralCommissioningCluster::CommissioningComplete(Callback::Cancelab
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kCommissioningCompleteCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2626,7 +2681,7 @@ CHIP_ERROR GeneralCommissioningCluster::SetFabric(Callback::Cancelable * onSucce
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSetFabricCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2699,7 +2754,7 @@ CHIP_ERROR GeneralCommissioningCluster::ReadAttributeClusterRevision(Callback::C
 
 // Groups Cluster Commands
 CHIP_ERROR GroupsCluster::AddGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                   uint16_t groupId, char * groupName)
+                                   uint16_t groupId, chip::ByteSpan groupName)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
     VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
@@ -2707,7 +2762,7 @@ CHIP_ERROR GroupsCluster::AddGroup(Callback::Cancelable * onSuccessCallback, Cal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddGroupCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2734,7 +2789,7 @@ CHIP_ERROR GroupsCluster::AddGroup(Callback::Cancelable * onSuccessCallback, Cal
 }
 
 CHIP_ERROR GroupsCluster::AddGroupIfIdentifying(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                                uint16_t groupId, char * groupName)
+                                                uint16_t groupId, chip::ByteSpan groupName)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
     VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
@@ -2742,7 +2797,7 @@ CHIP_ERROR GroupsCluster::AddGroupIfIdentifying(Callback::Cancelable * onSuccess
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddGroupIfIdentifyingCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2778,7 +2833,7 @@ CHIP_ERROR GroupsCluster::GetGroupMembership(Callback::Cancelable * onSuccessCal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetGroupMembershipCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2813,7 +2868,7 @@ CHIP_ERROR GroupsCluster::RemoveAllGroups(Callback::Cancelable * onSuccessCallba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveAllGroupsCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2844,7 +2899,7 @@ CHIP_ERROR GroupsCluster::RemoveGroup(Callback::Cancelable * onSuccessCallback,
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveGroupCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2877,7 +2932,7 @@ CHIP_ERROR GroupsCluster::ViewGroup(Callback::Cancelable * onSuccessCallback, Ca
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kViewGroupCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -2996,7 +3051,7 @@ CHIP_ERROR IdentifyCluster::Identify(Callback::Cancelable * onSuccessCallback, C
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kIdentifyCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3028,7 +3083,7 @@ CHIP_ERROR IdentifyCluster::IdentifyQuery(Callback::Cancelable * onSuccessCallba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kIdentifyQueryCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3091,7 +3146,7 @@ CHIP_ERROR LevelControlCluster::Move(Callback::Cancelable * onSuccessCallback, C
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3131,7 +3186,7 @@ CHIP_ERROR LevelControlCluster::MoveToLevel(Callback::Cancelable * onSuccessCall
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveToLevelCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3172,7 +3227,7 @@ CHIP_ERROR LevelControlCluster::MoveToLevelWithOnOff(Callback::Cancelable * onSu
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveToLevelWithOnOffCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3208,7 +3263,7 @@ CHIP_ERROR LevelControlCluster::MoveWithOnOff(Callback::Cancelable * onSuccessCa
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kMoveWithOnOffCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3244,7 +3299,7 @@ CHIP_ERROR LevelControlCluster::Step(Callback::Cancelable * onSuccessCallback, C
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStepCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3286,7 +3341,7 @@ CHIP_ERROR LevelControlCluster::StepWithOnOff(Callback::Cancelable * onSuccessCa
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStepWithOnOffCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3324,7 +3379,7 @@ CHIP_ERROR LevelControlCluster::Stop(Callback::Cancelable * onSuccessCallback, C
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStopCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3358,7 +3413,7 @@ CHIP_ERROR LevelControlCluster::StopWithOnOff(Callback::Cancelable * onSuccessCa
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStopWithOnOffCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3428,7 +3483,7 @@ CHIP_ERROR LowPowerCluster::Sleep(Callback::Cancelable * onSuccessCallback, Call
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSleepCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3475,7 +3530,7 @@ CHIP_ERROR MediaPlaybackCluster::FastForwardRequest(Callback::Cancelable * onSuc
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kFastForwardRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3505,7 +3560,7 @@ CHIP_ERROR MediaPlaybackCluster::NextRequest(Callback::Cancelable * onSuccessCal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kNextRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3535,7 +3590,7 @@ CHIP_ERROR MediaPlaybackCluster::PauseRequest(Callback::Cancelable * onSuccessCa
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kPauseRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3565,7 +3620,7 @@ CHIP_ERROR MediaPlaybackCluster::PlayRequest(Callback::Cancelable * onSuccessCal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kPlayRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3595,7 +3650,7 @@ CHIP_ERROR MediaPlaybackCluster::PreviousRequest(Callback::Cancelable * onSucces
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kPreviousRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3625,7 +3680,7 @@ CHIP_ERROR MediaPlaybackCluster::RewindRequest(Callback::Cancelable * onSuccessC
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRewindRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3656,7 +3711,7 @@ CHIP_ERROR MediaPlaybackCluster::SkipBackwardRequest(Callback::Cancelable * onSu
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSkipBackwardRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3687,7 +3742,7 @@ CHIP_ERROR MediaPlaybackCluster::SkipForwardRequest(Callback::Cancelable * onSuc
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSkipForwardRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3718,7 +3773,7 @@ CHIP_ERROR MediaPlaybackCluster::StartOverRequest(Callback::Cancelable * onSucce
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStartOverRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3748,7 +3803,7 @@ CHIP_ERROR MediaPlaybackCluster::StopRequest(Callback::Cancelable * onSuccessCal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStopRequestCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3805,7 +3860,7 @@ CHIP_ERROR NetworkCommissioningCluster::AddThreadNetwork(Callback::Cancelable *
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddThreadNetworkCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3844,7 +3899,7 @@ CHIP_ERROR NetworkCommissioningCluster::AddWiFiNetwork(Callback::Cancelable * on
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddWiFiNetworkCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3885,7 +3940,7 @@ CHIP_ERROR NetworkCommissioningCluster::DisableNetwork(Callback::Cancelable * on
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kDisableNetworkCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3924,7 +3979,7 @@ CHIP_ERROR NetworkCommissioningCluster::EnableNetwork(Callback::Cancelable * onS
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kEnableNetworkCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3963,7 +4018,7 @@ CHIP_ERROR NetworkCommissioningCluster::GetLastNetworkCommissioningResult(Callba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetLastNetworkCommissioningResultCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -3998,7 +4053,7 @@ CHIP_ERROR NetworkCommissioningCluster::RemoveNetwork(Callback::Cancelable * onS
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveNetworkCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4037,7 +4092,7 @@ CHIP_ERROR NetworkCommissioningCluster::ScanNetworks(Callback::Cancelable * onSu
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kScanNetworksCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4077,7 +4132,7 @@ CHIP_ERROR NetworkCommissioningCluster::UpdateThreadNetwork(Callback::Cancelable
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kUpdateThreadNetworkCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4116,7 +4171,7 @@ CHIP_ERROR NetworkCommissioningCluster::UpdateWiFiNetwork(Callback::Cancelable *
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kUpdateWiFiNetworkCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4172,7 +4227,7 @@ CHIP_ERROR OnOffCluster::Off(Callback::Cancelable * onSuccessCallback, Callback:
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kOffCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4202,7 +4257,7 @@ CHIP_ERROR OnOffCluster::On(Callback::Cancelable * onSuccessCallback, Callback::
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kOnCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4232,7 +4287,7 @@ CHIP_ERROR OnOffCluster::Toggle(Callback::Cancelable * onSuccessCallback, Callba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kToggleCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4292,7 +4347,7 @@ CHIP_ERROR OnOffCluster::ReadAttributeClusterRevision(Callback::Cancelable * onS
 
 // Scenes Cluster Commands
 CHIP_ERROR ScenesCluster::AddScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                   uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, char * sceneName,
+                                   uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, chip::ByteSpan sceneName,
                                    chip::ClusterId clusterId, uint8_t length, uint8_t value)
 {
 #ifdef CHIP_APP_USE_INTERACTION_MODEL
@@ -4301,7 +4356,7 @@ CHIP_ERROR ScenesCluster::AddScene(Callback::Cancelable * onSuccessCallback, Cal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddSceneCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4347,7 +4402,7 @@ CHIP_ERROR ScenesCluster::GetSceneMembership(Callback::Cancelable * onSuccessCal
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kGetSceneMembershipCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4380,7 +4435,7 @@ CHIP_ERROR ScenesCluster::RecallScene(Callback::Cancelable * onSuccessCallback,
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRecallSceneCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4418,7 +4473,7 @@ CHIP_ERROR ScenesCluster::RemoveAllScenes(Callback::Cancelable * onSuccessCallba
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveAllScenesCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4451,7 +4506,7 @@ CHIP_ERROR ScenesCluster::RemoveScene(Callback::Cancelable * onSuccessCallback,
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveSceneCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4486,7 +4541,7 @@ CHIP_ERROR ScenesCluster::StoreScene(Callback::Cancelable * onSuccessCallback, C
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStoreSceneCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
@@ -4521,7 +4576,7 @@ CHIP_ERROR ScenesCluster::ViewScene(Callback::Cancelable * onSuccessCallback, Ca
     (void) onFailureCallback;
 
     app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kViewSceneCommandId,
-                                              (chip::app::Command::kCommandPathFlag_EndpointIdValid) };
+                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
     app::Command * ZCLcommand             = mDevice->GetCommandSender();
 
     TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
index cb960d4..751dd90 100644 (file)
@@ -29,7 +29,7 @@ namespace Controller {
 
 constexpr ClusterId kApplicationBasicClusterId       = 0x050D;
 constexpr ClusterId kBarrierControlClusterId         = 0x0103;
-constexpr ClusterId kBasicClusterId                  = 0x0000;
+constexpr ClusterId kBasicClusterId                  = 0x0028;
 constexpr ClusterId kBindingClusterId                = 0xF000;
 constexpr ClusterId kColorControlClusterId           = 0x0300;
 constexpr ClusterId kContentLaunchClusterId          = 0xF002;
@@ -96,17 +96,31 @@ public:
 
     // Cluster Commands
     CHIP_ERROR MfgSpecificPing(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR ResetToFactoryDefaults(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
 
     // Cluster Attributes
     CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR ReadAttributeZclVersion(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR ReadAttributePowerSource(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeInteractionModelVersion(Callback::Cancelable * onSuccessCallback,
+                                                    Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeVendorName(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeVendorID(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeProductName(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeProductID(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeUserLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeLocation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeHardwareVersion(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeHardwareVersionString(Callback::Cancelable * onSuccessCallback,
+                                                  Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeSoftwareVersion(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR ReadAttributeSoftwareVersionString(Callback::Cancelable * onSuccessCallback,
+                                                  Callback::Cancelable * onFailureCallback);
     CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
+    CHIP_ERROR WriteAttributeUserLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
+                                       chip::ByteSpan value);
+    CHIP_ERROR WriteAttributeLocation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
+                                      chip::ByteSpan value);
 
 private:
-    static constexpr CommandId kMfgSpecificPingCommandId        = 0x00;
-    static constexpr CommandId kResetToFactoryDefaultsCommandId = 0x00;
+    static constexpr CommandId kMfgSpecificPingCommandId = 0x00;
 };
 
 class DLL_EXPORT BindingCluster : public ClusterBase
@@ -337,14 +351,14 @@ public:
                                   uint8_t scheduleId, uint16_t userId);
     CHIP_ERROR GetYeardaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
                                   uint8_t scheduleId, uint16_t userId);
-    CHIP_ERROR LockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, char * pin);
+    CHIP_ERROR LockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan pin);
     CHIP_ERROR SetHolidaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
                                   uint8_t scheduleId, uint32_t localStartTime, uint32_t localEndTime,
                                   uint8_t operatingModeDuringHoliday);
     CHIP_ERROR SetPin(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t userId,
-                      uint8_t userStatus, uint8_t userType, char * pin);
+                      uint8_t userStatus, uint8_t userType, chip::ByteSpan pin);
     CHIP_ERROR SetRfid(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t userId,
-                       uint8_t userStatus, uint8_t userType, char * id);
+                       uint8_t userStatus, uint8_t userType, chip::ByteSpan id);
     CHIP_ERROR SetUserType(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t userId,
                            uint8_t userType);
     CHIP_ERROR SetWeekdaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
@@ -352,9 +366,9 @@ public:
                                   uint8_t endHour, uint8_t endMinute);
     CHIP_ERROR SetYeardaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
                                   uint8_t scheduleId, uint16_t userId, uint32_t localStartTime, uint32_t localEndTime);
-    CHIP_ERROR UnlockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, char * pin);
+    CHIP_ERROR UnlockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan pin);
     CHIP_ERROR UnlockWithTimeout(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                 uint16_t timeoutInSeconds, char * pin);
+                                 uint16_t timeoutInSeconds, chip::ByteSpan pin);
 
     // Cluster Attributes
     CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
@@ -427,9 +441,9 @@ public:
 
     // Cluster Commands
     CHIP_ERROR AddGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
-                        char * groupName);
+                        chip::ByteSpan groupName);
     CHIP_ERROR AddGroupIfIdentifying(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
-                                     uint16_t groupId, char * groupName);
+                                     uint16_t groupId, chip::ByteSpan groupName);
     CHIP_ERROR GetGroupMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
                                   uint8_t groupCount, uint16_t groupList);
     CHIP_ERROR RemoveAllGroups(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
@@ -660,8 +674,8 @@ public:
 
     // Cluster Commands
     CHIP_ERROR AddScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
-                        uint8_t sceneId, uint16_t transitionTime, char * sceneName, chip::ClusterId clusterId, uint8_t length,
-                        uint8_t value);
+                        uint8_t sceneId, uint16_t transitionTime, chip::ByteSpan sceneName, chip::ClusterId clusterId,
+                        uint8_t length, uint8_t value);
     CHIP_ERROR GetSceneMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
                                   uint16_t groupId);
     CHIP_ERROR RecallScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
diff --git a/src/controller/CHIPPersistentStorageDelegate.h b/src/controller/CHIPPersistentStorageDelegate.h
deleted file mode 100644 (file)
index a2176f2..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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 <core/CHIPCore.h>
-#include <support/DLLUtil.h>
-
-namespace chip {
-namespace Controller {
-
-class DLL_EXPORT PersistentStorageResultDelegate
-{
-public:
-    enum class Operation : uint8_t
-    {
-        kGET = 0,
-        kSET,
-        kDELETE,
-    };
-
-    virtual ~PersistentStorageResultDelegate() {}
-
-    /**
-     * @brief
-     *   Called when a value is returned from the storage.
-     *   This is useful for GetKeyValue() API call.
-     *
-     * @param[in] key Key for which the value is being returned
-     * @param[in] value Value or nullptr if not found.
-     */
-    virtual void OnValue(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
-     * @param[in] op Operation that was being performed on the key
-     * @param[in] result CHIP_NO_ERROR or corresponding error code
-     */
-    virtual void OnStatus(const char * key, Operation op, CHIP_ERROR result) = 0;
-};
-
-class DLL_EXPORT PersistentStorageDelegate
-{
-public:
-    virtual ~PersistentStorageDelegate() {}
-
-    /**
-     * @brief
-     *   Set the callback object with methods that are called on completion
-     *   of the operation.
-     *
-     * @param[in] delegate The callback object
-     */
-    virtual void SetDelegate(PersistentStorageResultDelegate * delegate) = 0;
-
-    /**
-     * @brief
-     *   Lookup the key and call delegate object with it's stringified value
-     *
-     * @param[in] key Key to lookup
-     */
-    virtual void GetKeyValue(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.
-     *
-     * @param[in]      key Key to lookup
-     * @param[out]     value Value for the key
-     * @param[in, out] size Input value buffer size, output length of value.
-     *                 The output length could be larger than input value. In
-     *                 such cases, the user should allocate the buffer large
-     *                 enough (>= output length), and call the API again.
-     */
-    virtual CHIP_ERROR GetKeyValue(const char * key, char * value, uint16_t & size) { return CHIP_ERROR_NOT_IMPLEMENTED; }
-
-    /**
-     * @brief
-     *   Set the value for the key
-     *
-     * @param[in] key Key to be set
-     * @param[in] value Value to be set
-     */
-    virtual void SetKeyValue(const char * key, const char * value) = 0;
-
-    /**
-     * @brief
-     *   Deletes the value for the key
-     *
-     * @param[in] key Key to be deleted
-     */
-    virtual void DeleteKeyValue(const char * key) = 0;
-};
-
-} // namespace Controller
-} // namespace chip
diff --git a/src/controller/OnOffCluster.cpp b/src/controller/OnOffCluster.cpp
deleted file mode 100644 (file)
index c377517..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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 <app/chip-zcl-zpro-codec-api.h>
-#include <controller/OnOffCluster.h>
-
-namespace chip {
-namespace Controller {
-
-// TODO: Find a way to calculate maximum message length for clusters
-//       https://github.com/project-chip/connectedhomeip/issues/965
-constexpr uint16_t kMaxOnOffMessageLength = 64;
-
-CHIP_ERROR OnOffCluster::On(Callback::Callback<> * onCompletion)
-{
-    return SendCommand(encodeOnOffClusterOnCommand, kMaxOnOffMessageLength, onCompletion);
-}
-
-CHIP_ERROR OnOffCluster::Off(Callback::Callback<> * onCompletion)
-{
-    return SendCommand(encodeOnOffClusterOffCommand, kMaxOnOffMessageLength, onCompletion);
-}
-
-CHIP_ERROR OnOffCluster::Toggle(Callback::Callback<> * onCompletion)
-{
-    return SendCommand(encodeOnOffClusterToggleCommand, kMaxOnOffMessageLength, onCompletion);
-}
-
-CHIP_ERROR OnOffCluster::ReadAttributeOnOff(Callback::Callback<> * onCompletion)
-{
-    return SendCommand(encodeOnOffClusterReadOnOffAttribute, kMaxOnOffMessageLength, onCompletion);
-}
-
-CHIP_ERROR OnOffCluster::ReportAttributeOnOff(Callback::Callback<> * onChange, uint16_t minInterval, uint16_t maxInterval)
-{
-    return RequestAttributeReporting(encodeOnOffClusterReportOnOffAttribute, kMaxOnOffMessageLength, minInterval, maxInterval,
-                                     onChange);
-}
-
-CHIP_ERROR OnOffCluster::ReadAttributeClusterRevision(Callback::Callback<> * onCompletion)
-{
-    return CHIP_NO_ERROR;
-}
-
-} // namespace Controller
-} // namespace chip
diff --git a/src/controller/OnOffCluster.h b/src/controller/OnOffCluster.h
deleted file mode 100644 (file)
index 91a775d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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 <controller/CHIPCluster.h>
-#include <core/CHIPCallback.h>
-
-namespace chip {
-namespace Controller {
-
-constexpr ClusterId kOnOffClusterId = 0x0006;
-
-class DLL_EXPORT OnOffCluster : public ClusterBase
-{
-public:
-    OnOffCluster() : ClusterBase(kOnOffClusterId) {}
-    ~OnOffCluster() {}
-
-    CHIP_ERROR On(Callback::Callback<> * onCompletion);
-    CHIP_ERROR Off(Callback::Callback<> * onCompletion);
-    CHIP_ERROR Toggle(Callback::Callback<> * onCompletion);
-
-    CHIP_ERROR ReadAttributeOnOff(Callback::Callback<> * onCompletion);
-    CHIP_ERROR ReportAttributeOnOff(Callback::Callback<> * onChange, uint16_t minInterval, uint16_t maxInterval);
-
-    CHIP_ERROR ReadAttributeClusterRevision(Callback::Callback<> * onCompletion);
-};
-
-} // namespace Controller
-} // namespace chip
index a7167fd..6ee591f 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "writeTime": "Mon Mar 08 2021 19:19:29 GMT+0100 (Central European Standard Time)",
+  "writeTime": "Thu Mar 11 2021 17:28:29 GMT+0100 (Central European Standard Time)",
   "featureLevel": 11,
   "creator": "zap",
   "keyValuePairs": [
       "deviceTypeProfileId": null,
       "clusters": [
         {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "client",
-          "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
-          "commands": [
-            {
-              "name": "ResetToFactoryDefaults",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
-          ]
-        },
-        {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "commands": [],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "ZCL version",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x08",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "power source",
-              "code": 7,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
           "name": "Identify",
           "code": 3,
           "mfgCode": null,
           "define": "GROUPS_CLUSTER",
           "side": "client",
           "enabled": 0,
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ],
           "commands": [
             {
               "name": "AddGroup",
               "incoming": 1,
               "outgoing": 1
             }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
           ]
         },
         {
           "define": "DOOR_LOCK_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [
+            {
+              "name": "LockDoorResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "UnlockDoorResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
+          ]
+        },
+        {
+          "name": "Barrier Control",
+          "code": 259,
+          "mfgCode": null,
+          "define": "BARRIER_CONTROL_CLUSTER",
+          "side": "client",
+          "enabled": 0,
           "commands": [
             {
-              "name": "LockDoorResponse",
+              "name": "BarrierControlGoToPercent",
               "code": 0,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "UnlockDoorResponse",
+              "name": "BarrierControlStop",
               "code": 1,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             }
-          ]
-        },
-        {
-          "name": "Barrier Control",
-          "code": 259,
-          "mfgCode": null,
-          "define": "BARRIER_CONTROL_CLUSTER",
-          "side": "client",
-          "enabled": 0,
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "BarrierControlGoToPercent",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "BarrierControlStop",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "COLOR_CONTROL_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": []
+          ]
         },
         {
           "name": "Temperature Measurement",
       "deviceTypeProfileId": 259,
       "clusters": [
         {
-          "name": "Basic",
-          "code": 0,
+          "name": "Identify",
+          "code": 3,
           "mfgCode": null,
-          "define": "BASIC_CLUSTER",
+          "define": "IDENTIFY_CLUSTER",
           "side": "client",
           "enabled": 0,
           "commands": [
             {
-              "name": "ResetToFactoryDefaults",
+              "name": "Identify",
               "code": 0,
               "mfgCode": null,
               "source": "client",
               "outgoing": 1
             },
             {
-              "name": "MfgSpecificPing",
-              "code": 0,
-              "mfgCode": "4098",
+              "name": "IdentifyQuery",
+              "code": 1,
+              "mfgCode": null,
               "source": "client",
               "incoming": 1,
-              "outgoing": 0
+              "outgoing": 1
             }
           ],
           "attributes": [
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "3",
+              "defaultValue": "2",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
           ]
         },
         {
-          "name": "Basic",
-          "code": 0,
+          "name": "Identify",
+          "code": 3,
           "mfgCode": null,
-          "define": "BASIC_CLUSTER",
+          "define": "IDENTIFY_CLUSTER",
           "side": "server",
           "enabled": 1,
-          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "3",
+              "defaultValue": "2",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "ZCL version",
+              "name": "identify time",
               "code": 0,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x08",
+              "defaultValue": "0x0000",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
-            },
+            }
+          ],
+          "commands": [
             {
-              "name": "power source",
-              "code": 7,
+              "name": "IdentifyQueryResponse",
+              "code": 0,
               "mfgCode": null,
-              "side": "server",
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ]
+        },
+        {
+          "name": "Groups",
+          "code": 4,
+          "mfgCode": null,
+          "define": "GROUPS_CLUSTER",
+          "side": "client",
+          "enabled": 0,
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x00",
+              "defaultValue": "3",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ]
-        },
-        {
-          "name": "Identify",
-          "code": 3,
-          "mfgCode": null,
-          "define": "IDENTIFY_CLUSTER",
-          "side": "client",
-          "enabled": 0,
+          ],
           "commands": [
             {
-              "name": "Identify",
+              "name": "AddGroup",
               "code": 0,
               "mfgCode": null,
               "source": "client",
               "outgoing": 1
             },
             {
-              "name": "IdentifyQuery",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "2",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Identify",
-          "code": 3,
-          "mfgCode": null,
-          "define": "IDENTIFY_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "commands": [
-            {
-              "name": "IdentifyQueryResponse",
-              "code": 0,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "2",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "identify time",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x0000",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Groups",
-          "code": 4,
-          "mfgCode": null,
-          "define": "GROUPS_CLUSTER",
-          "side": "client",
-          "enabled": 0,
-          "commands": [
-            {
-              "name": "AddGroup",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "ViewGroup",
+              "name": "ViewGroup",
               "code": 1,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
           ]
         },
         {
           "define": "LEVEL_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "MoveToLevel",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
           ]
         },
         {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "client",
+          "enabled": 0,
+          "commands": [
+            {
+              "name": "MfgSpecificPing",
+              "code": 0,
+              "mfgCode": "4098",
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 0
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "StartUp",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ShutDown",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "Leave",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "InteractionModelVersion",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
           "name": "General Commissioning",
           "code": 48,
           "mfgCode": null,
           "define": "DOOR_LOCK_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "commands": [
+            {
+              "name": "LockDoorResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "UnlockDoorResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
+          ]
+        },
+        {
+          "name": "Barrier Control",
+          "code": 259,
+          "mfgCode": null,
+          "define": "BARRIER_CONTROL_CLUSTER",
+          "side": "client",
+          "enabled": 0,
           "commands": [
             {
-              "name": "LockDoorResponse",
+              "name": "BarrierControlGoToPercent",
               "code": 0,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "UnlockDoorResponse",
+              "name": "BarrierControlStop",
               "code": 1,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             }
-          ]
-        },
-        {
-          "name": "Barrier Control",
-          "code": 259,
-          "mfgCode": null,
-          "define": "BARRIER_CONTROL_CLUSTER",
-          "side": "client",
-          "enabled": 0,
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "BarrierControlGoToPercent",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "BarrierControlStop",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "BARRIER_CONTROL_CLUSTER",
           "side": "server",
           "enabled": 1,
-          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ]
+          ],
+          "commands": []
         },
         {
           "name": "Color Control",
           "define": "LOW_POWER_CLUSTER",
           "side": "client",
           "enabled": 0,
+          "commands": [
+            {
+              "name": "Sleep",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 0,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "Sleep",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 0,
-              "outgoing": 1
-            }
           ]
         },
         {
           "define": "NETWORK_COMMISSIONING_CLUSTER",
           "side": "server",
           "enabled": 1,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x0001",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
           "commands": [
             {
               "name": "ScanNetworksResponse",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
index 8c42fb1..3f48333 100644 (file)
@@ -100,6 +100,12 @@ pw_python_action("python") {
         "chip/ChipStack.py",
         "chip/ChipUtility.py",
         "chip/__init__.py",
+        "chip/ble/__init__.py",
+        "chip/ble/commissioning/__init__.py",
+        "chip/ble/get_adapters.py",
+        "chip/ble/library_handle.py",
+        "chip/ble/scan_devices.py",
+        "chip/ble/types.py",
         "chip/configuration/__init__.py",
         "chip/exceptions/__init__.py",
         "chip/internal/__init__.py",
@@ -123,22 +129,6 @@ pw_python_action("python") {
     },
   ]
 
-  if (chip_enable_ble) {
-    _py_manifest_files += [
-      {
-        src_dir = "."
-        sources = [
-          "chip/ble/__init__.py",
-          "chip/ble/commissioning/__init__.py",
-          "chip/ble/get_adapters.py",
-          "chip/ble/library_handle.py",
-          "chip/ble/scan_devices.py",
-          "chip/ble/types.py",
-        ]
-      },
-    ]
-  }
-
   _py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json"
 
   inputs = []
diff --git a/src/controller/python/ChipDeviceController-BleApplicationDelegate.cpp b/src/controller/python/ChipDeviceController-BleApplicationDelegate.cpp
deleted file mode 100644 (file)
index 962323c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2014-2017 Nest Labs, 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 "ChipDeviceController-BleApplicationDelegate.h"
-#include <ble/BleApplicationDelegate.h>
-
-void DeviceController_BleApplicationDelegate::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT connObj)
-{
-    // NO-OP
-
-    // TODO Python queue-based implementation
-}
diff --git a/src/controller/python/ChipDeviceController-BleApplicationDelegate.h b/src/controller/python/ChipDeviceController-BleApplicationDelegate.h
deleted file mode 100644 (file)
index fe8bfe9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2014-2017 Nest Labs, 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 <ble/BleApplicationDelegate.h>
-
-class DeviceController_BleApplicationDelegate : public chip::Ble::BleApplicationDelegate
-{
-    void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT connObj);
-};
diff --git a/src/controller/python/ChipDeviceController-BlePlatformDelegate.cpp b/src/controller/python/ChipDeviceController-BlePlatformDelegate.cpp
deleted file mode 100644 (file)
index c753b65..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2014-2017 Nest Labs, 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 "ChipDeviceController-BlePlatformDelegate.h"
-#include <ble/BlePlatformDelegate.h>
-
-using namespace chip::Ble;
-
-DeviceController_BlePlatformDelegate::DeviceController_BlePlatformDelegate(BleLayer * ble)
-{
-    Ble         = ble;
-    writeCB     = NULL;
-    subscribeCB = NULL;
-    closeCB     = NULL;
-}
-
-bool DeviceController_BlePlatformDelegate::SubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj,
-                                                                   const chip::Ble::ChipBleUUID * svcId,
-                                                                   const chip::Ble::ChipBleUUID * charId)
-{
-    const bool subscribe = true;
-
-    if (subscribeCB && svcId && charId)
-    {
-        return subscribeCB(connObj, static_cast<const void *>(svcId->bytes), static_cast<const void *>(charId->bytes), subscribe);
-    }
-
-    return false;
-}
-
-bool DeviceController_BlePlatformDelegate::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj,
-                                                                     const chip::Ble::ChipBleUUID * svcId,
-                                                                     const chip::Ble::ChipBleUUID * charId)
-{
-    const bool subscribe = true;
-
-    if (subscribeCB && svcId && charId)
-    {
-        return subscribeCB(connObj, static_cast<const void *>(svcId->bytes), static_cast<const void *>(charId->bytes), !subscribe);
-    }
-
-    return false;
-}
-
-bool DeviceController_BlePlatformDelegate::CloseConnection(BLE_CONNECTION_OBJECT connObj)
-{
-    if (closeCB)
-    {
-        return closeCB(connObj);
-    }
-
-    return false;
-}
-
-uint16_t DeviceController_BlePlatformDelegate::GetMTU(BLE_CONNECTION_OBJECT connObj) const
-{
-    // TODO Python queue-based implementation
-    return 0;
-}
-
-bool DeviceController_BlePlatformDelegate::SendIndication(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId,
-                                                          const chip::Ble::ChipBleUUID * charId,
-                                                          chip::System::PacketBufferHandle pBuf)
-{
-    // TODO Python queue-based implementation
-
-    // Going out of scope releases delegate's reference to pBuf. pBuf will be freed when both platform delegate and Chip stack free
-    // their references to it.
-    return false;
-}
-
-bool DeviceController_BlePlatformDelegate::SendWriteRequest(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId,
-                                                            const chip::Ble::ChipBleUUID * charId,
-                                                            chip::System::PacketBufferHandle pBuf)
-{
-    bool ret = false;
-
-    if (writeCB && svcId && charId && !pBuf.IsNull())
-    {
-        ret = writeCB(connObj, static_cast<const void *>(svcId->bytes), static_cast<const void *>(charId->bytes),
-                      static_cast<void *>(pBuf->Start()), pBuf->DataLength());
-    }
-
-    // Going out of scope releases delegate's reference to pBuf. pBuf will be freed when both platform delegate and Chip stack free
-    // their references to it. We release pBuf's reference here since its payload bytes were copied into a new NSData object by
-    // ChipBleMgr.py's writeCB, and in both the error and succees cases this code has no further use for the pBuf PacketBuffer.
-    return ret;
-}
-
-bool DeviceController_BlePlatformDelegate::SendReadRequest(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId,
-                                                           const chip::Ble::ChipBleUUID * charId,
-                                                           chip::System::PacketBufferHandle pBuf)
-{
-    // TODO Python queue-based implementation
-    return false;
-}
-
-bool DeviceController_BlePlatformDelegate::SendReadResponse(BLE_CONNECTION_OBJECT connObj, BLE_READ_REQUEST_CONTEXT requestContext,
-                                                            const chip::Ble::ChipBleUUID * svcId,
-                                                            const chip::Ble::ChipBleUUID * charId)
-{
-    // TODO Python queue-based implementation
-    return false;
-}
diff --git a/src/controller/python/ChipDeviceController-BlePlatformDelegate.h b/src/controller/python/ChipDeviceController-BlePlatformDelegate.h
deleted file mode 100644 (file)
index 9f14ea7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2014-2017 Nest Labs, 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 <ble/BleLayer.h>
-#include <ble/BlePlatformDelegate.h>
-
-typedef bool (*WriteBleCharacteristicCBFunct)(void * connObj, const void * svcId, const void * charId, const void * buffer,
-                                              uint16_t length);
-typedef bool (*SubscribeBleCharacteristicCBFunct)(void * connObj, const void * svcId, const void * charId, bool subscribe);
-typedef bool (*CloseBleCBFunct)(void * connObj);
-
-class DeviceController_BlePlatformDelegate : public chip::Ble::BlePlatformDelegate
-{
-public:
-    DeviceController_BlePlatformDelegate(chip::Ble::BleLayer * ble);
-
-    // Set callback used to send GATT write request
-    inline void SetWriteCharCB(WriteBleCharacteristicCBFunct cb) { writeCB = cb; };
-    inline void SetSubscribeCharCB(SubscribeBleCharacteristicCBFunct cb) { subscribeCB = cb; };
-    inline void SetCloseCB(CloseBleCBFunct cb) { closeCB = cb; };
-
-    // Virtuals from BlePlatformDelegate:
-    bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId,
-                                 const chip::Ble::ChipBleUUID * charId);
-    bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId,
-                                   const chip::Ble::ChipBleUUID * charId);
-    bool CloseConnection(BLE_CONNECTION_OBJECT connObj);
-    uint16_t GetMTU(BLE_CONNECTION_OBJECT connObj) const;
-    bool SendIndication(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId, const chip::Ble::ChipBleUUID * charId,
-                        chip::System::PacketBufferHandle pBuf);
-    bool SendWriteRequest(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId,
-                          const chip::Ble::ChipBleUUID * charId, chip::System::PacketBufferHandle pBuf);
-    bool SendReadRequest(BLE_CONNECTION_OBJECT connObj, const chip::Ble::ChipBleUUID * svcId, const chip::Ble::ChipBleUUID * charId,
-                         chip::System::PacketBufferHandle pBuf);
-    bool SendReadResponse(BLE_CONNECTION_OBJECT connObj, BLE_READ_REQUEST_CONTEXT requestContext,
-                          const chip::Ble::ChipBleUUID * svcId, const chip::Ble::ChipBleUUID * charId);
-
-private:
-    chip::Ble::BleLayer * Ble;
-    WriteBleCharacteristicCBFunct writeCB;
-    SubscribeBleCharacteristicCBFunct subscribeCB;
-    CloseBleCBFunct closeCB;
-};
index d5a5dc4..a1000ed 100644 (file)
@@ -67,15 +67,6 @@ CHIP_ERROR chip_ime_AppendCommand_Basic_MfgSpecificPing(chip::Controller::Device
     clusterBasic.Associate(device, ZCLendpointId);
     return clusterBasic.MfgSpecificPing(nullptr, nullptr);
 }
-CHIP_ERROR chip_ime_AppendCommand_Basic_ResetToFactoryDefaults(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                               chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::BasicCluster clusterBasic;
-    (void) ZCLgroupId;
-    clusterBasic.Associate(device, ZCLendpointId);
-    return clusterBasic.ResetToFactoryDefaults(nullptr, nullptr);
-}
 // End of Cluster Basic
 
 // Cluster Binding
@@ -402,13 +393,13 @@ CHIP_ERROR chip_ime_AppendCommand_DoorLock_GetYeardaySchedule(chip::Controller::
     return clusterDoorLock.GetYeardaySchedule(nullptr, nullptr, scheduleId, userId);
 }
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_LockDoor(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                    chip::GroupId ZCLgroupId, char * pin)
+                                                    chip::GroupId ZCLgroupId, const uint8_t * pin, uint32_t pin_Len)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::DoorLockCluster clusterDoorLock;
     (void) ZCLgroupId;
     clusterDoorLock.Associate(device, ZCLendpointId);
-    return clusterDoorLock.LockDoor(nullptr, nullptr, pin);
+    return clusterDoorLock.LockDoor(nullptr, nullptr, chip::ByteSpan(pin, pin_Len));
 }
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetHolidaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                               chip::GroupId ZCLgroupId, uint8_t scheduleId, uint32_t localStartTime,
@@ -423,23 +414,23 @@ CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetHolidaySchedule(chip::Controller::
 }
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetPin(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                   chip::GroupId ZCLgroupId, uint16_t userId, uint8_t userStatus, uint8_t userType,
-                                                  char * pin)
+                                                  const uint8_t * pin, uint32_t pin_Len)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::DoorLockCluster clusterDoorLock;
     (void) ZCLgroupId;
     clusterDoorLock.Associate(device, ZCLendpointId);
-    return clusterDoorLock.SetPin(nullptr, nullptr, userId, userStatus, userType, pin);
+    return clusterDoorLock.SetPin(nullptr, nullptr, userId, userStatus, userType, chip::ByteSpan(pin, pin_Len));
 }
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetRfid(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                    chip::GroupId ZCLgroupId, uint16_t userId, uint8_t userStatus, uint8_t userType,
-                                                   char * id)
+                                                   const uint8_t * id, uint32_t id_Len)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::DoorLockCluster clusterDoorLock;
     (void) ZCLgroupId;
     clusterDoorLock.Associate(device, ZCLendpointId);
-    return clusterDoorLock.SetRfid(nullptr, nullptr, userId, userStatus, userType, id);
+    return clusterDoorLock.SetRfid(nullptr, nullptr, userId, userStatus, userType, chip::ByteSpan(id, id_Len));
 }
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetUserType(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                        chip::GroupId ZCLgroupId, uint16_t userId, uint8_t userType)
@@ -473,22 +464,23 @@ CHIP_ERROR chip_ime_AppendCommand_DoorLock_SetYeardaySchedule(chip::Controller::
     return clusterDoorLock.SetYeardaySchedule(nullptr, nullptr, scheduleId, userId, localStartTime, localEndTime);
 }
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_UnlockDoor(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                      chip::GroupId ZCLgroupId, char * pin)
+                                                      chip::GroupId ZCLgroupId, const uint8_t * pin, uint32_t pin_Len)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::DoorLockCluster clusterDoorLock;
     (void) ZCLgroupId;
     clusterDoorLock.Associate(device, ZCLendpointId);
-    return clusterDoorLock.UnlockDoor(nullptr, nullptr, pin);
+    return clusterDoorLock.UnlockDoor(nullptr, nullptr, chip::ByteSpan(pin, pin_Len));
 }
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_UnlockWithTimeout(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                             chip::GroupId ZCLgroupId, uint16_t timeoutInSeconds, char * pin)
+                                                             chip::GroupId ZCLgroupId, uint16_t timeoutInSeconds,
+                                                             const uint8_t * pin, uint32_t pin_Len)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::DoorLockCluster clusterDoorLock;
     (void) ZCLgroupId;
     clusterDoorLock.Associate(device, ZCLendpointId);
-    return clusterDoorLock.UnlockWithTimeout(nullptr, nullptr, timeoutInSeconds, pin);
+    return clusterDoorLock.UnlockWithTimeout(nullptr, nullptr, timeoutInSeconds, chip::ByteSpan(pin, pin_Len));
 }
 // End of Cluster DoorLock
 
@@ -530,22 +522,24 @@ CHIP_ERROR chip_ime_AppendCommand_GeneralCommissioning_SetFabric(chip::Controlle
 
 // Cluster Groups
 CHIP_ERROR chip_ime_AppendCommand_Groups_AddGroup(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                  chip::GroupId ZCLgroupId, uint16_t groupId, char * groupName)
+                                                  chip::GroupId ZCLgroupId, uint16_t groupId, const uint8_t * groupName,
+                                                  uint32_t groupName_Len)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::GroupsCluster clusterGroups;
     (void) ZCLgroupId;
     clusterGroups.Associate(device, ZCLendpointId);
-    return clusterGroups.AddGroup(nullptr, nullptr, groupId, groupName);
+    return clusterGroups.AddGroup(nullptr, nullptr, groupId, chip::ByteSpan(groupName, groupName_Len));
 }
 CHIP_ERROR chip_ime_AppendCommand_Groups_AddGroupIfIdentifying(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                               chip::GroupId ZCLgroupId, uint16_t groupId, char * groupName)
+                                                               chip::GroupId ZCLgroupId, uint16_t groupId,
+                                                               const uint8_t * groupName, uint32_t groupName_Len)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::GroupsCluster clusterGroups;
     (void) ZCLgroupId;
     clusterGroups.Associate(device, ZCLendpointId);
-    return clusterGroups.AddGroupIfIdentifying(nullptr, nullptr, groupId, groupName);
+    return clusterGroups.AddGroupIfIdentifying(nullptr, nullptr, groupId, chip::ByteSpan(groupName, groupName_Len));
 }
 CHIP_ERROR chip_ime_AppendCommand_Groups_GetGroupMembership(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                             chip::GroupId ZCLgroupId, uint8_t groupCount, uint16_t groupList)
@@ -940,14 +934,15 @@ CHIP_ERROR chip_ime_AppendCommand_OnOff_Toggle(chip::Controller::Device * device
 // Cluster Scenes
 CHIP_ERROR chip_ime_AppendCommand_Scenes_AddScene(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                   chip::GroupId ZCLgroupId, uint16_t groupId, uint8_t sceneId,
-                                                  uint16_t transitionTime, char * sceneName, chip::ClusterId clusterId,
-                                                  uint8_t length, uint8_t value)
+                                                  uint16_t transitionTime, const uint8_t * sceneName, uint32_t sceneName_Len,
+                                                  chip::ClusterId clusterId, uint8_t length, uint8_t value)
 {
     VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
     chip::Controller::ScenesCluster clusterScenes;
     (void) ZCLgroupId;
     clusterScenes.Associate(device, ZCLendpointId);
-    return clusterScenes.AddScene(nullptr, nullptr, groupId, sceneId, transitionTime, sceneName, clusterId, length, value);
+    return clusterScenes.AddScene(nullptr, nullptr, groupId, sceneId, transitionTime, chip::ByteSpan(sceneName, sceneName_Len),
+                                  clusterId, length, value);
 }
 CHIP_ERROR chip_ime_AppendCommand_Scenes_GetSceneMembership(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                             chip::GroupId ZCLgroupId, uint16_t groupId)
index cabec7a..9b03894 100644 (file)
@@ -126,6 +126,8 @@ try:
     #
     packages=[
             'chip',
+            'chip.ble',
+            'chip.ble.commissioning',
             'chip.configuration',
             'chip.exceptions',
             'chip.internal',
@@ -134,10 +136,6 @@ try:
             'chip.tlv',
     ]
 
-    if os.path.isdir(os.path.join(tmpDir, 'chip', 'ble')):
-      packages += ['chip.ble']
-      packages += ['chip.ble.commissioning']
-
     # Invoke the setuptools 'bdist_wheel' command to generate a wheel containing
     # the CHIP python packages, shared libraries and scripts.
     setup(
index d644614..fb981a5 100644 (file)
@@ -47,8 +47,6 @@ class ChipCluster:
             "Basic": {
                 "MfgSpecificPing": {
                 },
-                "ResetToFactoryDefaults": {
-                },
             },
             "Binding": {
                 "Bind": {
@@ -211,7 +209,7 @@ class ChipCluster:
                     "userId": "int",
                 },
                 "LockDoor": {
-                    "pin": "str",
+                    "pin": "bytes",
                 },
                 "SetHolidaySchedule": {
                     "scheduleId": "int",
@@ -223,13 +221,13 @@ class ChipCluster:
                     "userId": "int",
                     "userStatus": "int",
                     "userType": "int",
-                    "pin": "str",
+                    "pin": "bytes",
                 },
                 "SetRfid": {
                     "userId": "int",
                     "userStatus": "int",
                     "userType": "int",
-                    "id": "str",
+                    "id": "bytes",
                 },
                 "SetUserType": {
                     "userId": "int",
@@ -251,11 +249,11 @@ class ChipCluster:
                     "localEndTime": "int",
                 },
                 "UnlockDoor": {
-                    "pin": "str",
+                    "pin": "bytes",
                 },
                 "UnlockWithTimeout": {
                     "timeoutInSeconds": "int",
-                    "pin": "str",
+                    "pin": "bytes",
                 },
             },
             "GeneralCommissioning": {
@@ -276,11 +274,11 @@ class ChipCluster:
             "Groups": {
                 "AddGroup": {
                     "groupId": "int",
-                    "groupName": "str",
+                    "groupName": "bytes",
                 },
                 "AddGroupIfIdentifying": {
                     "groupId": "int",
-                    "groupName": "str",
+                    "groupName": "bytes",
                 },
                 "GetGroupMembership": {
                     "groupCount": "int",
@@ -430,7 +428,7 @@ class ChipCluster:
                     "groupId": "int",
                     "sceneId": "int",
                     "transitionTime": "int",
-                    "sceneName": "str",
+                    "sceneName": "bytes",
                     "clusterId": "int",
                     "length": "int",
                     "value": "int",
@@ -490,13 +488,6 @@ class ChipCluster:
             )
         )
 
-    def ClusterBasic_CommandResetToFactoryDefaults(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_Basic_ResetToFactoryDefaults(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
     def ClusterBinding_CommandBind(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, nodeId: int, groupId: int, endpointId: int, clusterId: int):
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_Binding_Bind(
@@ -721,11 +712,11 @@ class ChipCluster:
             )
         )
 
-    def ClusterDoorLock_CommandLockDoor(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, pin: str):
+    def ClusterDoorLock_CommandLockDoor(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, pin: bytes):
         pin = pin.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_DoorLock_LockDoor(
-                device, ZCLendpoint, ZCLgroupid, pin
+                device, ZCLendpoint, ZCLgroupid, pin, len(pin)
             )
         )
 
@@ -736,19 +727,19 @@ class ChipCluster:
             )
         )
 
-    def ClusterDoorLock_CommandSetPin(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, userId: int, userStatus: int, userType: int, pin: str):
+    def ClusterDoorLock_CommandSetPin(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, userId: int, userStatus: int, userType: int, pin: bytes):
         pin = pin.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_DoorLock_SetPin(
-                device, ZCLendpoint, ZCLgroupid, userId, userStatus, userType, pin
+                device, ZCLendpoint, ZCLgroupid, userId, userStatus, userType, pin, len(pin)
             )
         )
 
-    def ClusterDoorLock_CommandSetRfid(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, userId: int, userStatus: int, userType: int, id: str):
+    def ClusterDoorLock_CommandSetRfid(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, userId: int, userStatus: int, userType: int, id: bytes):
         id = id.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_DoorLock_SetRfid(
-                device, ZCLendpoint, ZCLgroupid, userId, userStatus, userType, id
+                device, ZCLendpoint, ZCLgroupid, userId, userStatus, userType, id, len(id)
             )
         )
 
@@ -773,19 +764,19 @@ class ChipCluster:
             )
         )
 
-    def ClusterDoorLock_CommandUnlockDoor(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, pin: str):
+    def ClusterDoorLock_CommandUnlockDoor(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, pin: bytes):
         pin = pin.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockDoor(
-                device, ZCLendpoint, ZCLgroupid, pin
+                device, ZCLendpoint, ZCLgroupid, pin, len(pin)
             )
         )
 
-    def ClusterDoorLock_CommandUnlockWithTimeout(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, timeoutInSeconds: int, pin: str):
+    def ClusterDoorLock_CommandUnlockWithTimeout(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, timeoutInSeconds: int, pin: bytes):
         pin = pin.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockWithTimeout(
-                device, ZCLendpoint, ZCLgroupid, timeoutInSeconds, pin
+                device, ZCLendpoint, ZCLgroupid, timeoutInSeconds, pin, len(pin)
             )
         )
 
@@ -810,19 +801,19 @@ class ChipCluster:
             )
         )
 
-    def ClusterGroups_CommandAddGroup(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, groupId: int, groupName: str):
+    def ClusterGroups_CommandAddGroup(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, groupId: int, groupName: bytes):
         groupName = groupName.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_Groups_AddGroup(
-                device, ZCLendpoint, ZCLgroupid, groupId, groupName
+                device, ZCLendpoint, ZCLgroupid, groupId, groupName, len(groupName)
             )
         )
 
-    def ClusterGroups_CommandAddGroupIfIdentifying(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, groupId: int, groupName: str):
+    def ClusterGroups_CommandAddGroupIfIdentifying(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, groupId: int, groupName: bytes):
         groupName = groupName.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_Groups_AddGroupIfIdentifying(
-                device, ZCLendpoint, ZCLgroupid, groupId, groupName
+                device, ZCLendpoint, ZCLgroupid, groupId, groupName, len(groupName)
             )
         )
 
@@ -1085,11 +1076,11 @@ class ChipCluster:
             )
         )
 
-    def ClusterScenes_CommandAddScene(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, groupId: int, sceneId: int, transitionTime: int, sceneName: str, clusterId: int, length: int, value: int):
+    def ClusterScenes_CommandAddScene(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, groupId: int, sceneId: int, transitionTime: int, sceneName: bytes, clusterId: int, length: int, value: int):
         sceneName = sceneName.encode("utf-8") + b'\x00'
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_Scenes_AddScene(
-                device, ZCLendpoint, ZCLgroupid, groupId, sceneId, transitionTime, sceneName, clusterId, length, value
+                device, ZCLendpoint, ZCLgroupid, groupId, sceneId, transitionTime, sceneName, len(sceneName), clusterId, length, value
             )
         )
 
@@ -1149,9 +1140,6 @@ class ChipCluster:
         # Cluster Basic Command MfgSpecificPing
         self._chipLib.chip_ime_AppendCommand_Basic_MfgSpecificPing.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
         self._chipLib.chip_ime_AppendCommand_Basic_MfgSpecificPing.restype = ctypes.c_uint32
-        # Cluster Basic Command ResetToFactoryDefaults
-        self._chipLib.chip_ime_AppendCommand_Basic_ResetToFactoryDefaults.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_Basic_ResetToFactoryDefaults.restype = ctypes.c_uint32
         # Cluster Binding
         # Cluster Binding Command Bind
         self._chipLib.chip_ime_AppendCommand_Binding_Bind.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint64, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16]
@@ -1253,16 +1241,16 @@ class ChipCluster:
         self._chipLib.chip_ime_AppendCommand_DoorLock_GetYeardaySchedule.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16]
         self._chipLib.chip_ime_AppendCommand_DoorLock_GetYeardaySchedule.restype = ctypes.c_uint32
         # Cluster DoorLock Command LockDoor
-        self._chipLib.chip_ime_AppendCommand_DoorLock_LockDoor.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p]
+        self._chipLib.chip_ime_AppendCommand_DoorLock_LockDoor.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_DoorLock_LockDoor.restype = ctypes.c_uint32
         # Cluster DoorLock Command SetHolidaySchedule
         self._chipLib.chip_ime_AppendCommand_DoorLock_SetHolidaySchedule.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint8]
         self._chipLib.chip_ime_AppendCommand_DoorLock_SetHolidaySchedule.restype = ctypes.c_uint32
         # Cluster DoorLock Command SetPin
-        self._chipLib.chip_ime_AppendCommand_DoorLock_SetPin.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_char_p]
+        self._chipLib.chip_ime_AppendCommand_DoorLock_SetPin.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_char_p, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_DoorLock_SetPin.restype = ctypes.c_uint32
         # Cluster DoorLock Command SetRfid
-        self._chipLib.chip_ime_AppendCommand_DoorLock_SetRfid.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_char_p]
+        self._chipLib.chip_ime_AppendCommand_DoorLock_SetRfid.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8, ctypes.c_char_p, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_DoorLock_SetRfid.restype = ctypes.c_uint32
         # Cluster DoorLock Command SetUserType
         self._chipLib.chip_ime_AppendCommand_DoorLock_SetUserType.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8]
@@ -1274,10 +1262,10 @@ class ChipCluster:
         self._chipLib.chip_ime_AppendCommand_DoorLock_SetYeardaySchedule.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint32, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_DoorLock_SetYeardaySchedule.restype = ctypes.c_uint32
         # Cluster DoorLock Command UnlockDoor
-        self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockDoor.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p]
+        self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockDoor.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockDoor.restype = ctypes.c_uint32
         # Cluster DoorLock Command UnlockWithTimeout
-        self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockWithTimeout.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_char_p]
+        self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockWithTimeout.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_DoorLock_UnlockWithTimeout.restype = ctypes.c_uint32
         # Cluster GeneralCommissioning
         # Cluster GeneralCommissioning Command ArmFailSafe
@@ -1291,10 +1279,10 @@ class ChipCluster:
         self._chipLib.chip_ime_AppendCommand_GeneralCommissioning_SetFabric.restype = ctypes.c_uint32
         # Cluster Groups
         # Cluster Groups Command AddGroup
-        self._chipLib.chip_ime_AppendCommand_Groups_AddGroup.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_char_p]
+        self._chipLib.chip_ime_AppendCommand_Groups_AddGroup.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_Groups_AddGroup.restype = ctypes.c_uint32
         # Cluster Groups Command AddGroupIfIdentifying
-        self._chipLib.chip_ime_AppendCommand_Groups_AddGroupIfIdentifying.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_char_p]
+        self._chipLib.chip_ime_AppendCommand_Groups_AddGroupIfIdentifying.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32]
         self._chipLib.chip_ime_AppendCommand_Groups_AddGroupIfIdentifying.restype = ctypes.c_uint32
         # Cluster Groups Command GetGroupMembership
         self._chipLib.chip_ime_AppendCommand_Groups_GetGroupMembership.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16]
@@ -1416,7 +1404,7 @@ class ChipCluster:
         self._chipLib.chip_ime_AppendCommand_OnOff_Toggle.restype = ctypes.c_uint32
         # Cluster Scenes
         # Cluster Scenes Command AddScene
-        self._chipLib.chip_ime_AppendCommand_Scenes_AddScene.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8]
+        self._chipLib.chip_ime_AppendCommand_Scenes_AddScene.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8]
         self._chipLib.chip_ime_AppendCommand_Scenes_AddScene.restype = ctypes.c_uint32
         # Cluster Scenes Command GetSceneMembership
         self._chipLib.chip_ime_AppendCommand_Scenes_GetSceneMembership.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16]
diff --git a/src/controller/python/chip/ChipTLV.py b/src/controller/python/chip/ChipTLV.py
deleted file mode 100644 (file)
index bf74c34..0000000
+++ /dev/null
@@ -1,681 +0,0 @@
-#!/usr/bin/env python3
-# coding=utf-8
-
-#
-#   Copyright (c) 2020 Project CHIP Authors
-#   Copyright (c) 2019-2020 Google LLC.
-#   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.
-#
-
-#
-#   @file
-#         This file contains definitions for working with data encoded in Chip TLV format
-#
-
-
-from __future__ import absolute_import
-from __future__ import print_function
-
-import struct
-from collections import Mapping, Sequence, OrderedDict
-
-
-TLV_TYPE_SIGNED_INTEGER = 0x00
-TLV_TYPE_UNSIGNED_INTEGER = 0x04
-TLV_TYPE_BOOLEAN = 0x08
-TLV_TYPE_FLOATING_POINT_NUMBER = 0x0A
-TLV_TYPE_UTF8_STRING = 0x0C
-TLV_TYPE_BYTE_STRING = 0x10
-TLV_TYPE_NULL = 0x14
-TLV_TYPE_STRUCTURE = 0x15
-TLV_TYPE_ARRAY = 0x16
-TLV_TYPE_PATH = 0x17
-
-TLV_TAG_CONTROL_ANONYMOUS = 0x00
-TLV_TAG_CONTROL_CONTEXT_SPECIFIC = 0x20
-TLV_TAG_CONTROL_COMMON_PROFILE_2Bytes = 0x40
-TLV_TAG_CONTROL_COMMON_PROFILE_4Bytes = 0x60
-TLV_TAG_CONTROL_IMPLICIT_PROFILE_2Bytes = 0x80
-TLV_TAG_CONTROL_IMPLICIT_PROFILE_4Bytes = 0xA0
-TLV_TAG_CONTROL_FULLY_QUALIFIED_6Bytes = 0xC0
-TLV_TAG_CONTROL_FULLY_QUALIFIED_8Bytes = 0xE0
-
-TLVBoolean_False = TLV_TYPE_BOOLEAN
-TLVBoolean_True = TLV_TYPE_BOOLEAN + 1
-
-TLVEndOfContainer = 0x18
-
-INT8_MIN = -128
-INT16_MIN = -32768
-INT32_MIN = -2147483648
-INT64_MIN = -9223372036854775808
-
-INT8_MAX = 127
-INT16_MAX = 32767
-INT32_MAX = 2147483647
-INT64_MAX = 9223372036854775807
-
-UINT8_MAX = 255
-UINT16_MAX = 65535
-UINT32_MAX = 4294967295
-UINT64_MAX = 18446744073709551615
-
-ElementTypes = {
-    0x00: "Signed Integer 1-byte value",
-    0x01: "Signed Integer 2-byte value",
-    0x02: "Signed Integer 4-byte value",
-    0x03: "Signed Integer 8-byte value",
-    0x04: "Unsigned Integer 1-byte value",
-    0x05: "Unsigned Integer 2-byte value",
-    0x06: "Unsigned Integer 4-byte value",
-    0x07: "Unsigned Integer 8-byte value",
-    0x08: "Boolean False",
-    0x09: "Boolean True",
-    0x0A: "Floating Point 4-byte value",
-    0x0B: "Floating Point 8-byte value",
-    0x0C: "UTF-8 String 1-byte length",
-    0x0D: "UTF-8 String 2-byte length",
-    0x0E: "UTF-8 String 4-byte length",
-    0x0F: "UTF-8 String 8-byte length",
-    0x10: "Byte String 1-byte length",
-    0x11: "Byte String 2-byte length",
-    0x12: "Byte String 4-byte length",
-    0x13: "Byte String 8-byte length",
-    0x14: "Null",
-    0x15: "Structure",
-    0x16: "Array",
-    0x17: "Path",
-    0x18: "End of Collection",
-}
-
-TagControls = {
-    0x00: "Anonymous",
-    0x20: "Context 1-byte",
-    0x40: "Common Profile 2-byte",
-    0x60: "Common Profile 4-byte",
-    0x80: "Implicit Profile 2-byte",
-    0xA0: "Implicit Profile 4-byte",
-    0xC0: "Fully Qualified 6-byte",
-    0xE0: "Fully Qualified 8-byte",
-}
-
-
-class TLVWriter(object):
-    def __init__(self, encoding=None, implicitProfile=None):
-        self._encoding = encoding if encoding is not None else bytearray()
-        self._implicitProfile = implicitProfile
-        self._containerStack = []
-
-    @property
-    def encoding(self):
-        """The object into which encoded TLV data is written.
-
-        By default this is a bytearray object.
-        """
-        return self._encoding
-
-    @encoding.setter
-    def encoding(self, val):
-        self._encoding = val
-
-    @property
-    def implicitProfile(self):
-        """The Chip profile id used when encoding implicit profile tags.
-
-        Setting this value will result in an implicit profile tag being encoded
-        whenever the profile of the tag to be encoded matches the specified implicit
-        profile id.
-
-        Setting this value to None (the default) disabled encoding of implicit
-        profile tags.
-        """
-        return self._implicitProfile
-
-    @implicitProfile.setter
-    def implicitProfile(self, val):
-        self._implicitProfile = val
-
-    def put(self, tag, val):
-        """Write a value in TLV format with the specified TLV tag.
-
-        val can be a Python object which will be encoded as follows:
-        - Python bools, floats and strings are encoded as their respective TLV types.
-        - Python ints are encoded as unsigned TLV integers if zero or positive; signed TLV
-          integers if negative.
-        - None is encoded as a TLV Null.
-        - bytes and bytearray objects are encoded as TVL byte strings.
-        - Mapping-like objects (e.g. dict) are encoded as TLV structures.  The keys of the
-          map object are expected to be tag values, as described below for the tag argument.
-          Map values are encoded recursively, using the same rules as defined for the val
-          argument. The encoding order of elements depends on the type of the map object.
-          Elements within a dict are automatically encoded tag numerical order. Elements
-          within other forms of mapping object (e.g. OrderedDict) are encoded in the
-          object's natural iteration order.
-        - Sequence-like objects (e.g. arrays) are written as TLV arrays. Elements within
-          the array are encoded recursively, using the same rules as defined for the val
-          argument.
-
-        tag can be a small int (0-255), a tuple of two integers, or None.
-        If tag is an integer, it is encoded as a TLV context-specific tag.
-        If tag is a two-integer tuple, it is encoded as a TLV profile-specific tag, with
-          the first integer encoded as the profile id and the second as the tag number.
-        If tag is None, it is encoded as a TLV anonymous tag.
-        """
-        if val is None:
-            self.putNull(tag)
-        elif isinstance(val, bool):
-            self.putBool(tag, val)
-        elif isinstance(val, int):
-            if val < 0:
-                self.putSignedInt(tag, val)
-            else:
-                self.putUnsignedInt(tag, val)
-        elif isinstance(val, float):
-            self.putFloat(tag, val)
-        elif isinstance(val, str):
-            self.putString(tag, val)
-        elif isinstance(val, bytes) or isinstance(val, bytearray):
-            self.putBytes(tag, val)
-        elif isinstance(val, Mapping):
-            self.startStructure(tag)
-            if type(val) == dict:
-                val = OrderedDict(
-                    sorted(val.items(), key=lambda item: tlvTagToSortKey(item[0]))
-                )
-            for containedTag, containedVal in val.items():
-                self.put(containedTag, containedVal)
-            self.endContainer()
-        elif isinstance(val, Sequence):
-            self.startArray(tag)
-            for containedVal in val:
-                self.put(None, containedVal)
-            self.endContainer()
-        else:
-            raise ValueError("Attempt to TLV encode unsupported value")
-
-    def putSignedInt(self, tag, val):
-        """Write a value as a TLV signed integer with the specified TLV tag."""
-        if val >= INT8_MIN and val <= INT8_MAX:
-            format = "<b"
-        elif val >= INT16_MIN and val <= INT16_MAX:
-            format = "<h"
-        elif val >= INT32_MIN and val <= INT32_MAX:
-            format = "<l"
-        elif val >= INT64_MIN and val <= INT64_MAX:
-            format = "<q"
-        else:
-            raise ValueError("Integer value out of range")
-        val = struct.pack(format, val)
-        controlAndTag = self._encodeControlAndTag(
-            TLV_TYPE_SIGNED_INTEGER, tag, lenOfLenOrVal=len(val)
-        )
-        self._encoding.extend(controlAndTag)
-        self._encoding.extend(val)
-
-    def putUnsignedInt(self, tag, val):
-        """Write a value as a TLV unsigned integer with the specified TLV tag."""
-        val = self._encodeUnsignedInt(val)
-        controlAndTag = self._encodeControlAndTag(
-            TLV_TYPE_UNSIGNED_INTEGER, tag, lenOfLenOrVal=len(val)
-        )
-        self._encoding.extend(controlAndTag)
-        self._encoding.extend(val)
-
-    def putFloat(self, tag, val):
-        """Write a value as a TLV float with the specified TLV tag."""
-        val = struct.pack("d", val)
-        controlAndTag = self._encodeControlAndTag(
-            TLV_TYPE_FLOATING_POINT_NUMBER, tag, lenOfLenOrVal=len(val)
-        )
-        self._encoding.extend(controlAndTag)
-        self._encoding.extend(val)
-
-    def putString(self, tag, val):
-        """Write a value as a TLV string with the specified TLV tag."""
-        val = val.encode("utf-8")
-        valLen = self._encodeUnsignedInt(len(val))
-        controlAndTag = self._encodeControlAndTag(
-            TLV_TYPE_UTF8_STRING, tag, lenOfLenOrVal=len(valLen)
-        )
-        self._encoding.extend(controlAndTag)
-        self._encoding.extend(valLen)
-        self._encoding.extend(val)
-
-    def putBytes(self, tag, val):
-        """Write a value as a TLV byte string with the specified TLV tag."""
-        valLen = self._encodeUnsignedInt(len(val))
-        controlAndTag = self._encodeControlAndTag(
-            TLV_TYPE_BYTE_STRING, tag, lenOfLenOrVal=len(valLen)
-        )
-        self._encoding.extend(controlAndTag)
-        self._encoding.extend(valLen)
-        self._encoding.extend(val)
-
-    def putBool(self, tag, val):
-        """Write a value as a TLV boolean with the specified TLV tag."""
-        if val:
-            type = TLVBoolean_True
-        else:
-            type = TLVBoolean_False
-        controlAndTag = self._encodeControlAndTag(type, tag)
-        self._encoding.extend(controlAndTag)
-
-    def putNull(self, tag):
-        """Write a TLV null with the specified TLV tag."""
-        controlAndTag = self._encodeControlAndTag(TLV_TYPE_NULL, tag)
-        self._encoding.extend(controlAndTag)
-
-    def startContainer(self, tag, containerType):
-        """Start writing a TLV container with the specified TLV tag.
-
-        containerType can be one of TLV_TYPE_STRUCTURE, TLV_TYPE_ARRAY or
-        TLV_TYPE_PATH.
-        """
-        self._verifyValidContainerType(containerType)
-        controlAndTag = self._encodeControlAndTag(containerType, tag)
-        self._encoding.extend(controlAndTag)
-        self._containerStack.insert(0, containerType)
-
-    def startStructure(self, tag):
-        """Start writing a TLV structure with the specified TLV tag."""
-        self.startContainer(tag, containerType=TLV_TYPE_STRUCTURE)
-
-    def startArray(self, tag):
-        """Start writing a TLV array with the specified TLV tag."""
-        self.startContainer(tag, containerType=TLV_TYPE_ARRAY)
-
-    def startPath(self, tag):
-        """Start writing a TLV path with the specified TLV tag."""
-        self.startContainer(tag, containerType=TLV_TYPE_PATH)
-
-    def endContainer(self):
-        """End writing the current TLV container."""
-        self._containerStack.pop(0)
-        controlAndTag = self._encodeControlAndTag(TLVEndOfContainer, None)
-        self._encoding.extend(controlAndTag)
-
-    def _encodeControlAndTag(self, type, tag, lenOfLenOrVal=0):
-        controlByte = type
-        if lenOfLenOrVal == 2:
-            controlByte |= 1
-        elif lenOfLenOrVal == 4:
-            controlByte |= 2
-        elif lenOfLenOrVal == 8:
-            controlByte |= 3
-        if tag is None:
-            if (
-                type != TLVEndOfContainer
-                and len(self._containerStack) != 0
-                and self._containerStack[0] == TLV_TYPE_STRUCTURE
-            ):
-                raise ValueError("Attempt to encode anonymous tag within TLV structure")
-            controlByte |= TLV_TAG_CONTROL_ANONYMOUS
-            return struct.pack("<B", controlByte)
-        if isinstance(tag, int):
-            if tag < 0 or tag > UINT8_MAX:
-                raise ValueError("Context-specific TLV tag number out of range")
-            if len(self._containerStack) == 0:
-                raise ValueError(
-                    "Attempt to encode context-specific TLV tag at top level"
-                )
-            if self._containerStack[0] == TLV_TYPE_ARRAY:
-                raise ValueError(
-                    "Attempt to encode context-specific tag within TLV array"
-                )
-            controlByte |= TLV_TAG_CONTROL_CONTEXT_SPECIFIC
-            return struct.pack("<BB", controlByte, tag)
-        if isinstance(tag, tuple):
-            (profile, tagNum) = tag
-            if not isinstance(tagNum, int):
-                raise ValueError("Invalid object given for TLV tag")
-            if tagNum < 0 or tagNum > UINT32_MAX:
-                raise ValueError("TLV tag number out of range")
-            if profile != None:
-                if not isinstance(profile, int):
-                    raise ValueError("Invalid object given for TLV profile id")
-                if profile < 0 or profile > UINT32_MAX:
-                    raise ValueError("TLV profile id value out of range")
-            if (
-                len(self._containerStack) != 0
-                and self._containerStack[0] == TLV_TYPE_ARRAY
-            ):
-                raise ValueError(
-                    "Attempt to encode profile-specific tag within TLV array"
-                )
-            if profile is None or profile == self._implicitProfile:
-                if tagNum <= UINT16_MAX:
-                    controlByte |= TLV_TAG_CONTROL_IMPLICIT_PROFILE_2Bytes
-                    return struct.pack("<BH", controlByte, tagNum)
-                else:
-                    controlByte |= TLV_TAG_CONTROL_IMPLICIT_PROFILE_4Bytes
-                    return struct.pack("<BL", controlByte, tagNum)
-            elif profile == 0:
-                if tagNum <= UINT16_MAX:
-                    controlByte |= TLV_TAG_CONTROL_COMMON_PROFILE_2Bytes
-                    return struct.pack("<BH", controlByte, tagNum)
-                else:
-                    controlByte |= TLV_TAG_CONTROL_COMMON_PROFILE_4Bytes
-                    return struct.pack("<BL", controlByte, tagNum)
-            else:
-                if tagNum <= UINT16_MAX:
-                    controlByte |= TLV_TAG_CONTROL_FULLY_QUALIFIED_6Bytes
-                    return struct.pack("<BLH", controlByte, profile, tagNum)
-                else:
-                    controlByte |= TLV_TAG_CONTROL_FULLY_QUALIFIED_8Bytes
-                    return struct.pack("<BLL", controlByte, profile, tagNum)
-        raise ValueError("Invalid object given for TLV tag")
-
-    @staticmethod
-    def _encodeUnsignedInt(val):
-        if val < 0:
-            raise ValueError("Integer value out of range")
-        if val <= UINT8_MAX:
-            format = "<B"
-        elif val <= UINT16_MAX:
-            format = "<H"
-        elif val <= UINT32_MAX:
-            format = "<L"
-        elif val <= UINT64_MAX:
-            format = "<Q"
-        else:
-            raise ValueError("Integer value out of range")
-        return struct.pack(format, val)
-
-    @staticmethod
-    def _verifyValidContainerType(containerType):
-        if (
-            containerType != TLV_TYPE_STRUCTURE
-            and containerType != TLV_TYPE_ARRAY
-            and containerType != TLV_TYPE_PATH
-        ):
-            raise ValueError("Invalid TLV container type")
-
-
-class TLVReader(object):
-    def __init__(self, tlv):
-        self._tlv = tlv
-        self._bytesRead = 0
-        self._decodings = []
-
-    @property
-    def decoding(self):
-        return self._decodings
-
-    def get(self):
-        """Get the dictionary representation of tlv data"""
-        out = {}
-        self._get(self._tlv, self._decodings, out)
-        return out
-
-    def _decodeControlByte(self, tlv, decoding):
-        (controlByte,) = struct.unpack("<B", tlv[self._bytesRead : self._bytesRead + 1])
-        controlTypeIndex = controlByte & 0xE0
-        decoding["tagControl"] = TagControls[controlTypeIndex]
-        elementtypeIndex = controlByte & 0x1F
-        decoding["type"] = ElementTypes[elementtypeIndex]
-        self._bytesRead += 1
-
-    def _decodeControlAndTag(self, tlv, decoding):
-        """The control byte specifies the type of a TLV element and how its tag, length and value fields are encoded.
-        The control byte consists of two subfields: an element type field which occupies the lower 5 bits,
-        and a tag control field which occupies the upper 3 bits. The element type field encodes the element’s type
-        as well as how the corresponding length and value fields are encoded.  In the case of Booleans and the
-        null value, the element type field also encodes the value itself."""
-
-        self._decodeControlByte(tlv, decoding)
-
-        if decoding["tagControl"] == "Anonymous":
-            decoding["tag"] = None
-            decoding["tagLen"] = 0
-        elif decoding["tagControl"] == "Context 1-byte":
-            (decoding["tag"],) = struct.unpack(
-                "<B", tlv[self._bytesRead : self._bytesRead + 1]
-            )
-            decoding["tagLen"] = 1
-            self._bytesRead += 1
-        elif decoding["tagControl"] == "Common Profile 2-byte":
-            profile = 0
-            (tag,) = struct.unpack("<H", tlv[self._bytesRead : self._bytesRead + 2])
-            decoding["profileTag"] = (profile, tag)
-            decoding["tagLen"] = 2
-            self._bytesRead += 2
-        elif decoding["tagControl"] == "Common Profile 4-byte":
-            profile = 0
-            (tag,) = struct.unpack("<L", tlv[self._bytesRead : self._bytesRead + 4])
-            decoding["profileTag"] = (profile, tag)
-            decoding["tagLen"] = 4
-            self._bytesRead += 4
-        elif decoding["tagControl"] == "Implicit Profile 2-byte":
-            profile = None
-            (tag,) = struct.unpack("<H", tlv[self._bytesRead : self._bytesRead + 2])
-            decoding["profileTag"] = (profile, tag)
-            decoding["tagLen"] = 2
-            self._bytesRead += 2
-        elif decoding["tagControl"] == "Implicit Profile 4-byte":
-            profile = None
-            (tag,) = struct.unpack("<L", tlv[self._bytesRead : self._bytesRead + 4])
-            decoding["profileTag"] = (profile, tag)
-            decoding["tagLen"] = 4
-            self._bytesRead += 4
-        elif decoding["tagControl"] == "Fully Qualified 6-byte":
-            (profile,) = struct.unpack("<L", tlv[self._bytesRead : self._bytesRead + 4])
-            (tag,) = struct.unpack("<H", tlv[self._bytesRead + 4 : self._bytesRead + 6])
-            decoding["profileTag"] = (profile, tag)
-            decoding["tagLen"] = 2
-            self._bytesRead += 6
-        elif decoding["tagControl"] == "Fully Qualified 8-byte":
-            (profile,) = struct.unpack("<L", tlv[self._bytesRead : self._bytesRead + 4])
-            (tag,) = struct.unpack("<L", tlv[self._bytesRead + 4 : self._bytesRead + 8])
-            decoding["profileTag"] = (profile, tag)
-            decoding["tagLen"] = 4
-            self._bytesRead += 8
-
-    def _decodeStrLength(self, tlv, decoding):
-        """UTF-8 or Byte StringLength fields are encoded in 0, 1, 2 or 4 byte widths, as specified by
-        the element type field. If the element type needs a length field grab the next bytes as length"""
-        if "length" in decoding["type"]:
-            if "1-byte" in decoding["type"]:
-                (decoding["strDataLen"],) = struct.unpack(
-                    "<B", tlv[self._bytesRead : self._bytesRead + 1]
-                )
-                decoding["strDataLenLen"] = 1
-                self._bytesRead += 1
-            elif "2-byte" in decoding["type"]:
-                (decoding["strDataLen"],) = struct.unpack(
-                    "<H", tlv[self._bytesRead : self._bytesRead + 2]
-                )
-                decoding["strDataLenLen"] = 2
-                self._bytesRead += 2
-            elif "4-byte" in decoding["type"]:
-                (decoding["strDataLen"],) = struct.unpack(
-                    "<L", tlv[self._bytesRead : self._bytesRead + 4]
-                )
-                decoding["strDataLenLen"] = 4
-                self._bytesRead += 4
-            elif "8-byte" in decoding["type"]:
-                (decoding["strDataLen"],) = struct.unpack(
-                    "<Q", tlv[self._bytesRead : self._bytesRead + 8]
-                )
-                decoding["strDataLenLen"] = 8
-                self._bytesRead += 8
-        else:
-            decoding["strDataLen"] = 0
-            decoding["strDataLenLen"] = 0
-
-    def _decodeVal(self, tlv, decoding):
-        """decode primitive tlv value to the corresponding python value, tlv array and path are decoded as
-        python list, tlv structure is decoded as python dictionary"""
-        if decoding["type"] == "Structure":
-            decoding["value"] = {}
-            decoding["Structure"] = []
-            self._get(tlv, decoding["Structure"], decoding["value"])
-        elif decoding["type"] == "Array":
-            decoding["value"] = []
-            decoding["Array"] = []
-            self._get(tlv, decoding["Array"], decoding["value"])
-        elif decoding["type"] == "Path":
-            decoding["value"] = []
-            decoding["Path"] = []
-            self._get(tlv, decoding["Path"], decoding["value"])
-        elif decoding["type"] == "Null":
-            decoding["value"] = None
-        elif decoding["type"] == "End of Collection":
-            decoding["value"] = None
-        elif decoding["type"] == "Boolean True":
-            decoding["value"] = True
-        elif decoding["type"] == "Boolean False":
-            decoding["value"] = False
-        elif decoding["type"] == "Unsigned Integer 1-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<B", tlv[self._bytesRead : self._bytesRead + 1]
-            )
-            self._bytesRead += 1
-        elif decoding["type"] == "Signed Integer 1-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<b", tlv[self._bytesRead : self._bytesRead + 1]
-            )
-            self._bytesRead += 1
-        elif decoding["type"] == "Unsigned Integer 2-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<H", tlv[self._bytesRead : self._bytesRead + 2]
-            )
-            self._bytesRead += 2
-        elif decoding["type"] == "Signed Integer 2-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<h", tlv[self._bytesRead : self._bytesRead + 2]
-            )
-            self._bytesRead += 2
-        elif decoding["type"] == "Unsigned Integer 4-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<L", tlv[self._bytesRead : self._bytesRead + 4]
-            )
-            self._bytesRead += 4
-        elif decoding["type"] == "Signed Integer 4-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<l", tlv[self._bytesRead : self._bytesRead + 4]
-            )
-            self._bytesRead += 4
-        elif decoding["type"] == "Unsigned Integer 8-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<Q", tlv[self._bytesRead : self._bytesRead + 8]
-            )
-            self._bytesRead += 8
-        elif decoding["type"] == "Signed Integer 8-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<q", tlv[self._bytesRead : self._bytesRead + 8]
-            )
-            self._bytesRead += 8
-        elif decoding["type"] == "Floating Point 4-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<f", tlv[self._bytesRead : self._bytesRead + 4]
-            )
-            self._bytesRead += 4
-        elif decoding["type"] == "Floating Point 8-byte value":
-            (decoding["value"],) = struct.unpack(
-                "<d", tlv[self._bytesRead : self._bytesRead + 8]
-            )
-            self._bytesRead += 8
-        elif "UTF-8 String" in decoding["type"]:
-            (val,) = struct.unpack(
-                "<%ds" % decoding["strDataLen"],
-                tlv[self._bytesRead : self._bytesRead + decoding["strDataLen"]],
-            )
-            try:
-                decoding["value"] = str(val, "utf-8")
-            except Exception as ex:
-                decoding["value"] = val
-            self._bytesRead += decoding["strDataLen"]
-        elif "Byte String" in decoding["type"]:
-            (val,) = struct.unpack(
-                "<%ds" % decoding["strDataLen"],
-                tlv[self._bytesRead : self._bytesRead + decoding["strDataLen"]],
-            )
-
-            decoding["value"] = val
-            self._bytesRead += decoding["strDataLen"]
-        else:
-            raise ValueError("Attempt to decode unsupported TLV type")
-
-    def _get(self, tlv, decodings, out):
-        endOfEncoding = False
-
-        while len(tlv[self._bytesRead :]) > 0 and endOfEncoding == False:
-            decoding = {}
-            self._decodeControlAndTag(tlv, decoding)
-            self._decodeStrLength(tlv, decoding)
-            self._decodeVal(tlv, decoding)
-            decodings.append(decoding)
-
-            if decoding["type"] == "End of Collection":
-                endOfEncoding = True
-            else:
-                if "profileTag" in list(decoding.keys()):
-                    out[decoding["profileTag"]] = decoding["value"]
-                elif "tag" in list(decoding.keys()):
-                    if decoding["tag"] is not None:
-                        out[decoding["tag"]] = decoding["value"]
-                    else:
-                        if isinstance(out, Mapping):
-                            out["Any"] = decoding["value"]
-                        elif isinstance(out, Sequence):
-                            out.append(decoding["value"])
-                else:
-                    raise ValueError("Attempt to decode unsupported TLV tag")
-
-
-def tlvTagToSortKey(tag):
-    if tag is None:
-        return -1
-    if isinstance(tag, int):
-        majorOrder = 0
-    elif isinstance(tag, tuple):
-        (profileId, tag) = tag
-        if profileId is None:
-            majorOrder = 1
-        else:
-            majorOrder = profileId + 2
-    else:
-        raise ValueError("Invalid TLV tag")
-    return (majorOrder << 32) + tag
-
-
-if __name__ == "__main__":
-    val = dict(
-        [
-            (1, 0),
-            (2, 65536),
-            (3, True),
-            (4, None),
-            (5, "Hello!"),
-            (6, bytearray([0xDE, 0xAD, 0xBE, 0xEF])),
-            (7, ["Goodbye!", 71024724507, False]),
-            ((0x235A0000, 42), "FOO"),
-            ((None, 42), "BAR"),
-        ]
-    )
-
-    writer = TLVWriter()
-    encodedVal = writer.put(None, val)
-
-    reader = TLVReader(writer.encoding)
-    out = reader.get()
-
-    print("TLVReader input: " + str(val))
-    print("TLVReader output: " + str(out["Any"]))
-
-    if val == out["Any"]:
-        print("Test Success")
-    else:
-        print("Test Failure")
index 90246c4..b7800ec 100644 (file)
@@ -143,8 +143,7 @@ void ChipCertificateSet::Clear()
     mCertCount = 0;
 }
 
-CHIP_ERROR ChipCertificateSet::LoadCert(const uint8_t * chipCert, uint32_t chipCertLen,
-                                        BitFlags<uint8_t, CertDecodeFlags> decodeFlags)
+CHIP_ERROR ChipCertificateSet::LoadCert(const uint8_t * chipCert, uint32_t chipCertLen, BitFlags<CertDecodeFlags> decodeFlags)
 {
     CHIP_ERROR err;
     TLVReader reader;
@@ -161,7 +160,7 @@ exit:
     return err;
 }
 
-CHIP_ERROR ChipCertificateSet::LoadCert(TLVReader & reader, BitFlags<uint8_t, CertDecodeFlags> decodeFlags)
+CHIP_ERROR ChipCertificateSet::LoadCert(TLVReader & reader, BitFlags<CertDecodeFlags> decodeFlags)
 {
     CHIP_ERROR err;
     ASN1Writer writer; // ASN1Writer is used to encode TBS portion of the certificate for the purpose of signature
@@ -192,8 +191,7 @@ CHIP_ERROR ChipCertificateSet::LoadCert(TLVReader & reader, BitFlags<uint8_t, Ce
 
         // Verify the cert has both the Subject Key Id and Authority Key Id extensions present.
         // Only certs with both these extensions are supported for the purposes of certificate validation.
-        VerifyOrExit(cert->mCertFlags.Has(CertFlags::kExtPresent_SubjectKeyId) &&
-                         cert->mCertFlags.Has(CertFlags::kExtPresent_AuthKeyId),
+        VerifyOrExit(cert->mCertFlags.HasAll(CertFlags::kExtPresent_SubjectKeyId, CertFlags::kExtPresent_AuthKeyId),
                      err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT);
 
         // Verify the cert was signed with ECDSA-SHA256. This is the only signature algorithm currently supported.
@@ -248,8 +246,7 @@ exit:
     return err;
 }
 
-CHIP_ERROR ChipCertificateSet::LoadCerts(const uint8_t * chipCerts, uint32_t chipCertsLen,
-                                         BitFlags<uint8_t, CertDecodeFlags> decodeFlags)
+CHIP_ERROR ChipCertificateSet::LoadCerts(const uint8_t * chipCerts, uint32_t chipCertsLen, BitFlags<CertDecodeFlags> decodeFlags)
 {
     CHIP_ERROR err;
     TLVReader reader;
@@ -275,7 +272,7 @@ exit:
     return err;
 }
 
-CHIP_ERROR ChipCertificateSet::LoadCerts(TLVReader & reader, BitFlags<uint8_t, CertDecodeFlags> decodeFlags)
+CHIP_ERROR ChipCertificateSet::LoadCerts(TLVReader & reader, BitFlags<CertDecodeFlags> decodeFlags)
 {
     CHIP_ERROR err;
     uint8_t initialCertCount = mCertCount;
@@ -463,7 +460,7 @@ exit:
 }
 
 CHIP_ERROR ChipCertificateSet::ValidateCert(const ChipCertificateData * cert, ValidationContext & context,
-                                            BitFlags<uint8_t, CertValidateFlags> validateFlags, uint8_t depth)
+                                            BitFlags<CertValidateFlags> validateFlags, uint8_t depth)
 {
     CHIP_ERROR err               = CHIP_NO_ERROR;
     ChipCertificateData * caCert = nullptr;
@@ -499,19 +496,19 @@ CHIP_ERROR ChipCertificateSet::ValidateCert(const ChipCertificateData * cert, Va
     {
         // If a set of desired key usages has been specified, verify that the key usage extension exists
         // in the certificate and that the corresponding usages are supported.
-        if (context.mRequiredKeyUsages.Raw() != 0)
+        if (context.mRequiredKeyUsages.HasAny())
         {
             VerifyOrExit(cert->mCertFlags.Has(CertFlags::kExtPresent_KeyUsage) &&
-                             cert->mKeyUsageFlags.Has(context.mRequiredKeyUsages.Raw()),
+                             cert->mKeyUsageFlags.HasAll(context.mRequiredKeyUsages),
                          err = CHIP_ERROR_CERT_USAGE_NOT_ALLOWED);
         }
 
         // If a set of desired key purposes has been specified, verify that the extended key usage extension
         // exists in the certificate and that the corresponding purposes are supported.
-        if (context.mRequiredKeyPurposes.Raw() != 0)
+        if (context.mRequiredKeyPurposes.HasAny())
         {
             VerifyOrExit(cert->mCertFlags.Has(CertFlags::kExtPresent_ExtendedKeyUsage) &&
-                             cert->mKeyPurposeFlags.Has(context.mRequiredKeyPurposes.Raw()),
+                             cert->mKeyPurposeFlags.HasAll(context.mRequiredKeyPurposes),
                          err = CHIP_ERROR_CERT_USAGE_NOT_ALLOWED);
         }
 
@@ -577,8 +574,8 @@ exit:
 }
 
 CHIP_ERROR ChipCertificateSet::FindValidCert(const ChipDN & subjectDN, const CertificateKeyId & subjectKeyId,
-                                             ValidationContext & context, BitFlags<uint8_t, CertValidateFlags> validateFlags,
-                                             uint8_t depth, ChipCertificateData *& cert)
+                                             ValidationContext & context, BitFlags<CertValidateFlags> validateFlags, uint8_t depth,
+                                             ChipCertificateData *& cert)
 {
     CHIP_ERROR err;
 
@@ -646,9 +643,9 @@ void ChipCertificateData::Clear()
     mPubKeyCurveOID = 0;
     mPubKeyAlgoOID  = 0;
     mSigAlgoOID     = 0;
-    mCertFlags.SetRaw(0);
-    mKeyUsageFlags.SetRaw(0);
-    mKeyPurposeFlags.SetRaw(0);
+    mCertFlags.ClearAll();
+    mKeyUsageFlags.ClearAll();
+    mKeyPurposeFlags.ClearAll();
     mPathLenConstraint = 0;
     mCertType          = kCertType_NotSpecified;
     mSignature.R       = nullptr;
@@ -663,9 +660,9 @@ void ValidationContext::Reset()
     mEffectiveTime = 0;
     mTrustAnchor   = nullptr;
     mSigningCert   = nullptr;
-    mRequiredKeyUsages.SetRaw(0);
-    mRequiredKeyPurposes.SetRaw(0);
-    mValidateFlags.SetRaw(0);
+    mRequiredKeyUsages.ClearAll();
+    mRequiredKeyPurposes.ClearAll();
+    mValidateFlags.ClearAll();
     mRequiredCertType = kCertType_NotSpecified;
 }
 
index 4774efd..362d8ce 100644 (file)
@@ -241,22 +241,22 @@ struct ChipCertificateData
 
     void Clear();
 
-    ChipDN mSubjectDN;                                   /**< Certificate Subject DN. */
-    ChipDN mIssuerDN;                                    /**< Certificate Issuer DN. */
-    CertificateKeyId mSubjectKeyId;                      /**< Certificate Subject public key identifier. */
-    CertificateKeyId mAuthKeyId;                         /**< Certificate Authority public key identifier. */
-    uint32_t mNotBeforeTime;                             /**< Certificate validity: Not Before field. */
-    uint32_t mNotAfterTime;                              /**< Certificate validity: Not After field. */
-    const uint8_t * mPublicKey;                          /**< Pointer to the certificate public key. */
-    uint8_t mPublicKeyLen;                               /**< Certificate public key length. */
-    uint16_t mPubKeyCurveOID;                            /**< Public key Elliptic Curve CHIP OID. */
-    uint16_t mPubKeyAlgoOID;                             /**< Public key algorithm CHIP OID. */
-    uint16_t mSigAlgoOID;                                /**< Certificate signature algorithm CHIP OID. */
-    BitFlags<uint16_t, CertFlags> mCertFlags;            /**< Certificate data flags. */
-    BitFlags<uint16_t, KeyUsageFlags> mKeyUsageFlags;    /**< Certificate key usage extensions flags. */
-    BitFlags<uint8_t, KeyPurposeFlags> mKeyPurposeFlags; /**< Certificate extended key usage extensions flags. */
-    uint8_t mPathLenConstraint;                          /**< Basic constraint: path length. */
-    uint8_t mCertType;                                   /**< Certificate type. */
+    ChipDN mSubjectDN;                          /**< Certificate Subject DN. */
+    ChipDN mIssuerDN;                           /**< Certificate Issuer DN. */
+    CertificateKeyId mSubjectKeyId;             /**< Certificate Subject public key identifier. */
+    CertificateKeyId mAuthKeyId;                /**< Certificate Authority public key identifier. */
+    uint32_t mNotBeforeTime;                    /**< Certificate validity: Not Before field. */
+    uint32_t mNotAfterTime;                     /**< Certificate validity: Not After field. */
+    const uint8_t * mPublicKey;                 /**< Pointer to the certificate public key. */
+    uint8_t mPublicKeyLen;                      /**< Certificate public key length. */
+    uint16_t mPubKeyCurveOID;                   /**< Public key Elliptic Curve CHIP OID. */
+    uint16_t mPubKeyAlgoOID;                    /**< Public key algorithm CHIP OID. */
+    uint16_t mSigAlgoOID;                       /**< Certificate signature algorithm CHIP OID. */
+    BitFlags<CertFlags> mCertFlags;             /**< Certificate data flags. */
+    BitFlags<KeyUsageFlags> mKeyUsageFlags;     /**< Certificate key usage extensions flags. */
+    BitFlags<KeyPurposeFlags> mKeyPurposeFlags; /**< Certificate extended key usage extensions flags. */
+    uint8_t mPathLenConstraint;                 /**< Basic constraint: path length. */
+    uint8_t mCertType;                          /**< Certificate type. */
     struct
     {
         const uint8_t * R; /**< Pointer to the R element of the signature, encoded as ASN.1 DER Integer. */
@@ -275,16 +275,16 @@ struct ChipCertificateData
  */
 struct ValidationContext
 {
-    uint32_t mEffectiveTime;                                 /**< Current CHIP Epoch UTC time. */
-    const ChipCertificateData * mTrustAnchor;                /**< Pointer to the Trust Anchor Certificate data structure. */
-    const ChipCertificateData * mSigningCert;                /**< Pointer to the Signing Certificate data structure. */
-    BitFlags<uint16_t, KeyUsageFlags> mRequiredKeyUsages;    /**< Key usage extensions that should be present in the
-                                                                validated certificate. */
-    BitFlags<uint8_t, KeyPurposeFlags> mRequiredKeyPurposes; /**< Extended Key usage extensions that should be present
-                                                                in the validated certificate. */
-    BitFlags<uint8_t, CertValidateFlags> mValidateFlags;     /**< Certificate validation flags, specifying how a certificate
-                                                                should be validated. */
-    uint8_t mRequiredCertType;                               /**< Required certificate type. */
+    uint32_t mEffectiveTime;                        /**< Current CHIP Epoch UTC time. */
+    const ChipCertificateData * mTrustAnchor;       /**< Pointer to the Trust Anchor Certificate data structure. */
+    const ChipCertificateData * mSigningCert;       /**< Pointer to the Signing Certificate data structure. */
+    BitFlags<KeyUsageFlags> mRequiredKeyUsages;     /**< Key usage extensions that should be present in the
+                                                       validated certificate. */
+    BitFlags<KeyPurposeFlags> mRequiredKeyPurposes; /**< Extended Key usage extensions that should be present
+                                                       in the validated certificate. */
+    BitFlags<CertValidateFlags> mValidateFlags;     /**< Certificate validation flags, specifying how a certificate
+                                                       should be validated. */
+    uint8_t mRequiredCertType;                      /**< Required certificate type. */
 
     void Reset();
 };
@@ -350,7 +350,7 @@ public:
      *
      * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
      **/
-    CHIP_ERROR LoadCert(const uint8_t * chipCert, uint32_t chipCertLen, BitFlags<uint8_t, CertDecodeFlags> decodeFlags);
+    CHIP_ERROR LoadCert(const uint8_t * chipCert, uint32_t chipCertLen, BitFlags<CertDecodeFlags> decodeFlags);
 
     /**
      * @brief Load CHIP certificate into set.
@@ -363,7 +363,7 @@ public:
      *
      * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
      **/
-    CHIP_ERROR LoadCert(chip::TLV::TLVReader & reader, BitFlags<uint8_t, CertDecodeFlags> decodeFlags);
+    CHIP_ERROR LoadCert(chip::TLV::TLVReader & reader, BitFlags<CertDecodeFlags> decodeFlags);
 
     /**
      * @brief Load CHIP certificates into set.
@@ -377,7 +377,7 @@ public:
      *
      * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
      **/
-    CHIP_ERROR LoadCerts(const uint8_t * chipCerts, uint32_t chipCertsLen, BitFlags<uint8_t, CertDecodeFlags> decodeFlags);
+    CHIP_ERROR LoadCerts(const uint8_t * chipCerts, uint32_t chipCertsLen, BitFlags<CertDecodeFlags> decodeFlags);
 
     /**
      * @brief Load CHIP certificates into set.
@@ -391,7 +391,7 @@ public:
      *
      * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
      **/
-    CHIP_ERROR LoadCerts(chip::TLV::TLVReader & reader, BitFlags<uint8_t, CertDecodeFlags> decodeFlags);
+    CHIP_ERROR LoadCerts(chip::TLV::TLVReader & reader, BitFlags<CertDecodeFlags> decodeFlags);
 
     /**
      * @brief Add trusted anchor key to the certificate set.
@@ -505,7 +505,7 @@ private:
      * @return Returns a CHIP_ERROR on validation or other error, CHIP_NO_ERROR otherwise
      **/
     CHIP_ERROR FindValidCert(const ChipDN & subjectDN, const CertificateKeyId & subjectKeyId, ValidationContext & context,
-                             BitFlags<uint8_t, CertValidateFlags> validateFlags, uint8_t depth, ChipCertificateData *& cert);
+                             BitFlags<CertValidateFlags> validateFlags, uint8_t depth, ChipCertificateData *& cert);
 
     /**
      * @brief Validate CHIP certificate.
@@ -518,7 +518,7 @@ private:
      * @return Returns a CHIP_ERROR on validation or other error, CHIP_NO_ERROR otherwise
      **/
     CHIP_ERROR ValidateCert(const ChipCertificateData * cert, ValidationContext & context,
-                            BitFlags<uint8_t, CertValidateFlags> validateFlags, uint8_t depth);
+                            BitFlags<CertValidateFlags> validateFlags, uint8_t depth);
 };
 
 /**
index 51cdbf8..4f88549 100644 (file)
@@ -363,8 +363,7 @@ static CHIP_ERROR ConvertExtension(ASN1Reader & reader, TLVWriter & writer)
                 VerifyOrExit(keyUsageBits <= UINT16_MAX, err = ASN1_ERROR_INVALID_ENCODING);
 
                 // Check that only supported flags are set.
-                BitFlags<uint16_t, KeyUsageFlags> keyUsageFlags;
-                keyUsageFlags.SetRaw(static_cast<uint16_t>(keyUsageBits));
+                BitFlags<KeyUsageFlags> keyUsageFlags(static_cast<uint16_t>(keyUsageBits));
                 VerifyOrExit(keyUsageFlags.HasOnly(
                                  KeyUsageFlags::kDigitalSignature, KeyUsageFlags::kNonRepudiation, KeyUsageFlags::kKeyEncipherment,
                                  KeyUsageFlags::kDataEncipherment, KeyUsageFlags::kKeyAgreement, KeyUsageFlags::kKeyCertSign,
index bb6fe2c..3a2c09c 100644 (file)
@@ -382,7 +382,6 @@ static CHIP_ERROR DecodeConvertKeyUsageExtension(TLVReader & reader, ASN1Writer
 {
     CHIP_ERROR err;
     uint64_t keyUsageBits;
-    BitFlags<uint16_t, KeyUsageFlags> keyUsageFlags;
 
     certData.mCertFlags.Set(CertFlags::kExtPresent_KeyUsage);
 
@@ -395,16 +394,18 @@ static CHIP_ERROR DecodeConvertKeyUsageExtension(TLVReader & reader, ASN1Writer
 
     VerifyOrExit(keyUsageBits <= UINT16_MAX, err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT);
 
-    keyUsageFlags.SetRaw(static_cast<uint16_t>(keyUsageBits));
-    VerifyOrExit(keyUsageFlags.HasOnly(KeyUsageFlags::kDigitalSignature, KeyUsageFlags::kNonRepudiation,
-                                       KeyUsageFlags::kKeyEncipherment, KeyUsageFlags::kDataEncipherment,
-                                       KeyUsageFlags::kKeyAgreement, KeyUsageFlags::kKeyCertSign, KeyUsageFlags::kCRLSign,
-                                       KeyUsageFlags::kEncipherOnly, KeyUsageFlags::kEncipherOnly),
-                 err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT);
+    {
+        BitFlags<KeyUsageFlags> keyUsageFlags(static_cast<uint16_t>(keyUsageBits));
+        VerifyOrExit(keyUsageFlags.HasOnly(KeyUsageFlags::kDigitalSignature, KeyUsageFlags::kNonRepudiation,
+                                           KeyUsageFlags::kKeyEncipherment, KeyUsageFlags::kDataEncipherment,
+                                           KeyUsageFlags::kKeyAgreement, KeyUsageFlags::kKeyCertSign, KeyUsageFlags::kCRLSign,
+                                           KeyUsageFlags::kEncipherOnly, KeyUsageFlags::kEncipherOnly),
+                     err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT);
 
-    ASN1_ENCODE_BIT_STRING(static_cast<uint16_t>(keyUsageBits));
+        ASN1_ENCODE_BIT_STRING(static_cast<uint16_t>(keyUsageBits));
 
-    certData.mKeyUsageFlags = keyUsageFlags;
+        certData.mKeyUsageFlags = keyUsageFlags;
+    }
 
 exit:
     return err;
index 3689389..2126f59 100644 (file)
@@ -46,7 +46,7 @@ extern const uint8_t gTestCerts[] = {
 
 extern const size_t gNumTestCerts = sizeof(gTestCerts) / sizeof(gTestCerts[0]);
 
-CHIP_ERROR GetTestCert(uint8_t certType, BitFlags<uint8_t, TestCertLoadFlags> certLoadFlags, const uint8_t *& certData,
+CHIP_ERROR GetTestCert(uint8_t certType, BitFlags<TestCertLoadFlags> certLoadFlags, const uint8_t *& certData,
                        uint32_t & certDataLen)
 {
     CHIP_ERROR err;
@@ -103,8 +103,8 @@ const char * GetTestCertName(uint8_t certType)
     return nullptr;
 }
 
-CHIP_ERROR LoadTestCert(ChipCertificateSet & certSet, uint8_t certType, BitFlags<uint8_t, TestCertLoadFlags> certLoadFlags,
-                        BitFlags<uint8_t, CertDecodeFlags> decodeFlags)
+CHIP_ERROR LoadTestCert(ChipCertificateSet & certSet, uint8_t certType, BitFlags<TestCertLoadFlags> certLoadFlags,
+                        BitFlags<CertDecodeFlags> decodeFlags)
 {
     CHIP_ERROR err;
     ChipCertificateData * cert;
index 3a21694..15cd65f 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <asn1/ASN1OID.h>
 #include <core/CHIPConfig.h>
+#include <support/BitFlags.h>
 #include <support/CodeUtils.h>
 
 namespace chip {
@@ -58,11 +59,11 @@ enum class TestCertLoadFlags : uint8_t
     kSetAppDefinedCertType = 0x20,
 };
 
-extern CHIP_ERROR GetTestCert(uint8_t certType, BitFlags<uint8_t, TestCertLoadFlags> certLoadFlags, const uint8_t *& certData,
+extern CHIP_ERROR GetTestCert(uint8_t certType, BitFlags<TestCertLoadFlags> certLoadFlags, const uint8_t *& certData,
                               uint32_t & certDataLen);
 extern const char * GetTestCertName(uint8_t certType);
-extern CHIP_ERROR LoadTestCert(ChipCertificateSet & certSet, uint8_t certType, BitFlags<uint8_t, TestCertLoadFlags> certLoadFlags,
-                               BitFlags<uint8_t, CertDecodeFlags> decodeFlags);
+extern CHIP_ERROR LoadTestCert(ChipCertificateSet & certSet, uint8_t certType, BitFlags<TestCertLoadFlags> certLoadFlags,
+                               BitFlags<CertDecodeFlags> decodeFlags);
 
 extern const uint8_t gTestCerts[];
 extern const size_t gNumTestCerts;
index deeb94b..92ffdc1 100644 (file)
@@ -48,59 +48,59 @@ enum
                                 // (in either CHIP or DER form), or to decode the certificates.
 };
 
-static const BitFlags<uint8_t, CertValidateFlags> sIgnoreNotBeforeFlag(CertValidateFlags::kIgnoreNotBefore);
-static const BitFlags<uint8_t, CertValidateFlags> sIgnoreNotAfterFlag(CertValidateFlags::kIgnoreNotAfter);
-
-static const BitFlags<uint8_t, CertDecodeFlags> sNullDecodeFlag;
-static const BitFlags<uint8_t, CertDecodeFlags> sGenTBSHashFlag(CertDecodeFlags::kGenerateTBSHash);
-static const BitFlags<uint8_t, CertDecodeFlags> sTrustAnchorFlag(CertDecodeFlags::kIsTrustAnchor);
-
-static const BitFlags<uint8_t, TestCertLoadFlags> sNullLoadFlag;
-static const BitFlags<uint8_t, TestCertLoadFlags> sDerFormFlag(TestCertLoadFlags::kDERForm);
-static const BitFlags<uint8_t, TestCertLoadFlags> sSupIsCAFlag(TestCertLoadFlags::kSuppressIsCA);
-static const BitFlags<uint8_t, TestCertLoadFlags> sSupKeyUsageFlag(TestCertLoadFlags::kSuppressKeyUsage);
-static const BitFlags<uint8_t, TestCertLoadFlags> sSupKeyCertSignFlag(TestCertLoadFlags::kSuppressKeyCertSign);
-static const BitFlags<uint8_t, TestCertLoadFlags> sPathLenZeroFlag(TestCertLoadFlags::kSetPathLenConstZero);
-static const BitFlags<uint8_t, TestCertLoadFlags> sAppDefCertTypeFlag(TestCertLoadFlags::kSetAppDefinedCertType);
-
-static const BitFlags<uint8_t, KeyPurposeFlags> sNullKPFlag;
-static const BitFlags<uint8_t, KeyPurposeFlags> sSA(KeyPurposeFlags::kServerAuth);
-static const BitFlags<uint8_t, KeyPurposeFlags> sCA(KeyPurposeFlags::kClientAuth);
-static const BitFlags<uint8_t, KeyPurposeFlags> sCS(KeyPurposeFlags::kCodeSigning);
-static const BitFlags<uint8_t, KeyPurposeFlags> sEP(KeyPurposeFlags::kEmailProtection);
-static const BitFlags<uint8_t, KeyPurposeFlags> sTS(KeyPurposeFlags::kTimeStamping);
-static const BitFlags<uint8_t, KeyPurposeFlags> sOS(KeyPurposeFlags::kOCSPSigning);
-static const BitFlags<uint8_t, KeyPurposeFlags> sSAandCA(sSA.Raw() | sCA.Raw());
-static const BitFlags<uint8_t, KeyPurposeFlags> sSAandCS(sSA.Raw() | sCS.Raw());
-static const BitFlags<uint8_t, KeyPurposeFlags> sSAandEP(sSA.Raw() | sEP.Raw());
-static const BitFlags<uint8_t, KeyPurposeFlags> sSAandTS(sSA.Raw() | sTS.Raw());
-
-static const BitFlags<uint16_t, KeyUsageFlags> sNullKUFlag;
-static const BitFlags<uint16_t, KeyUsageFlags> sDS(KeyUsageFlags::kDigitalSignature);
-static const BitFlags<uint16_t, KeyUsageFlags> sNR(KeyUsageFlags::kNonRepudiation);
-static const BitFlags<uint16_t, KeyUsageFlags> sKE(KeyUsageFlags::kKeyEncipherment);
-static const BitFlags<uint16_t, KeyUsageFlags> sDE(KeyUsageFlags::kDataEncipherment);
-static const BitFlags<uint16_t, KeyUsageFlags> sKA(KeyUsageFlags::kKeyAgreement);
-static const BitFlags<uint16_t, KeyUsageFlags> sKC(KeyUsageFlags::kKeyCertSign);
-static const BitFlags<uint16_t, KeyUsageFlags> sCR(KeyUsageFlags::kCRLSign);
-static const BitFlags<uint16_t, KeyUsageFlags> sEO(KeyUsageFlags::kEncipherOnly);
-static const BitFlags<uint16_t, KeyUsageFlags> sDO(KeyUsageFlags::kDecipherOnly);
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandNR(sDS.Raw() | sNR.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandKE(sDS.Raw() | sKE.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandDE(sDS.Raw() | sDE.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandKA(sDS.Raw() | sKA.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandKC(sDS.Raw() | sKC.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandCR(sDS.Raw() | sCR.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandEO(sDS.Raw() | sEO.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sDSandDO(sDS.Raw() | sDO.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandDS(sKC.Raw() | sDS.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandNR(sKC.Raw() | sNR.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandKE(sKC.Raw() | sKE.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandDE(sKC.Raw() | sDE.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandKA(sKC.Raw() | sKA.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandCR(sKC.Raw() | sCR.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandEO(sKC.Raw() | sEO.Raw());
-static const BitFlags<uint16_t, KeyUsageFlags> sKCandDO(sKC.Raw() | sDO.Raw());
+static const BitFlags<CertValidateFlags> sIgnoreNotBeforeFlag(CertValidateFlags::kIgnoreNotBefore);
+static const BitFlags<CertValidateFlags> sIgnoreNotAfterFlag(CertValidateFlags::kIgnoreNotAfter);
+
+static const BitFlags<CertDecodeFlags> sNullDecodeFlag;
+static const BitFlags<CertDecodeFlags> sGenTBSHashFlag(CertDecodeFlags::kGenerateTBSHash);
+static const BitFlags<CertDecodeFlags> sTrustAnchorFlag(CertDecodeFlags::kIsTrustAnchor);
+
+static const BitFlags<TestCertLoadFlags> sNullLoadFlag;
+static const BitFlags<TestCertLoadFlags> sDerFormFlag(TestCertLoadFlags::kDERForm);
+static const BitFlags<TestCertLoadFlags> sSupIsCAFlag(TestCertLoadFlags::kSuppressIsCA);
+static const BitFlags<TestCertLoadFlags> sSupKeyUsageFlag(TestCertLoadFlags::kSuppressKeyUsage);
+static const BitFlags<TestCertLoadFlags> sSupKeyCertSignFlag(TestCertLoadFlags::kSuppressKeyCertSign);
+static const BitFlags<TestCertLoadFlags> sPathLenZeroFlag(TestCertLoadFlags::kSetPathLenConstZero);
+static const BitFlags<TestCertLoadFlags> sAppDefCertTypeFlag(TestCertLoadFlags::kSetAppDefinedCertType);
+
+static const BitFlags<KeyPurposeFlags> sNullKPFlag;
+static const BitFlags<KeyPurposeFlags> sSA(KeyPurposeFlags::kServerAuth);
+static const BitFlags<KeyPurposeFlags> sCA(KeyPurposeFlags::kClientAuth);
+static const BitFlags<KeyPurposeFlags> sCS(KeyPurposeFlags::kCodeSigning);
+static const BitFlags<KeyPurposeFlags> sEP(KeyPurposeFlags::kEmailProtection);
+static const BitFlags<KeyPurposeFlags> sTS(KeyPurposeFlags::kTimeStamping);
+static const BitFlags<KeyPurposeFlags> sOS(KeyPurposeFlags::kOCSPSigning);
+static const BitFlags<KeyPurposeFlags> sSAandCA(sSA, sCA);
+static const BitFlags<KeyPurposeFlags> sSAandCS(sSA, sCS);
+static const BitFlags<KeyPurposeFlags> sSAandEP(sSA, sEP);
+static const BitFlags<KeyPurposeFlags> sSAandTS(sSA, sTS);
+
+static const BitFlags<KeyUsageFlags> sNullKUFlag;
+static const BitFlags<KeyUsageFlags> sDS(KeyUsageFlags::kDigitalSignature);
+static const BitFlags<KeyUsageFlags> sNR(KeyUsageFlags::kNonRepudiation);
+static const BitFlags<KeyUsageFlags> sKE(KeyUsageFlags::kKeyEncipherment);
+static const BitFlags<KeyUsageFlags> sDE(KeyUsageFlags::kDataEncipherment);
+static const BitFlags<KeyUsageFlags> sKA(KeyUsageFlags::kKeyAgreement);
+static const BitFlags<KeyUsageFlags> sKC(KeyUsageFlags::kKeyCertSign);
+static const BitFlags<KeyUsageFlags> sCR(KeyUsageFlags::kCRLSign);
+static const BitFlags<KeyUsageFlags> sEO(KeyUsageFlags::kEncipherOnly);
+static const BitFlags<KeyUsageFlags> sDO(KeyUsageFlags::kDecipherOnly);
+static const BitFlags<KeyUsageFlags> sDSandNR(sDS, sNR);
+static const BitFlags<KeyUsageFlags> sDSandKE(sDS, sKE);
+static const BitFlags<KeyUsageFlags> sDSandDE(sDS, sDE);
+static const BitFlags<KeyUsageFlags> sDSandKA(sDS, sKA);
+static const BitFlags<KeyUsageFlags> sDSandKC(sDS, sKC);
+static const BitFlags<KeyUsageFlags> sDSandCR(sDS, sCR);
+static const BitFlags<KeyUsageFlags> sDSandEO(sDS, sEO);
+static const BitFlags<KeyUsageFlags> sDSandDO(sDS, sDO);
+static const BitFlags<KeyUsageFlags> sKCandDS(sKC, sDS);
+static const BitFlags<KeyUsageFlags> sKCandNR(sKC, sNR);
+static const BitFlags<KeyUsageFlags> sKCandKE(sKC, sKE);
+static const BitFlags<KeyUsageFlags> sKCandDE(sKC, sDE);
+static const BitFlags<KeyUsageFlags> sKCandKA(sKC, sKA);
+static const BitFlags<KeyUsageFlags> sKCandCR(sKC, sCR);
+static const BitFlags<KeyUsageFlags> sKCandEO(sKC, sEO);
+static const BitFlags<KeyUsageFlags> sKCandDO(sKC, sDO);
 
 static CHIP_ERROR LoadStandardCerts(ChipCertificateSet & certSet)
 {
@@ -207,8 +207,8 @@ static void TestChipCert_CertValidation(nlTestSuite * inSuite, void * inContext)
         struct
         {
             uint8_t Type;
-            BitFlags<uint8_t, CertDecodeFlags> DecodeFlags;
-            BitFlags<uint8_t, TestCertLoadFlags> LoadFlags;
+            BitFlags<CertDecodeFlags> DecodeFlags;
+            BitFlags<TestCertLoadFlags> LoadFlags;
         } InputCerts[kMaxCertsPerTestCase];
     };
 
@@ -475,8 +475,8 @@ static void TestChipCert_CertUsage(nlTestSuite * inSuite, void * inContext)
     struct UsageTestCase
     {
         uint8_t mCertIndex;
-        BitFlags<uint16_t, KeyUsageFlags> mRequiredKeyUsages;
-        BitFlags<uint8_t, KeyPurposeFlags> mRequiredKeyPurposes;
+        BitFlags<KeyUsageFlags> mRequiredKeyUsages;
+        BitFlags<KeyPurposeFlags> mRequiredKeyPurposes;
         CHIP_ERROR mExpectedResult;
     };
 
diff --git a/src/darwin/Framework/CHIP/CHIPCallbackBridge.h b/src/darwin/Framework/CHIP/CHIPCallbackBridge.h
deleted file mode 100644 (file)
index 1b1f1a4..0000000
+++ /dev/null
@@ -1,40 +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.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "CHIPDeviceCallback.h"
-#import "CHIPError.h"
-
-#include <controller/CHIPDevice.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-class CHIPCallbackBridge : public chip::Callback::Callback<>
-{
-public:
-    CHIPCallbackBridge(CHIPDeviceCallback handler, dispatch_queue_t queue);
-    ~CHIPCallbackBridge();
-
-    static void CallbackFn(void * context);
-
-private:
-    CHIPDeviceCallback mHandler;
-    dispatch_queue_t mQueue;
-};
-
-NS_ASSUME_NONNULL_END
diff --git a/src/darwin/Framework/CHIP/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/CHIPCallbackBridge.mm
deleted file mode 100644 (file)
index f78c697..0000000
+++ /dev/null
@@ -1,41 +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.
- */
-
-#import "CHIPCallbackBridge.h"
-#import "CHIPError.h"
-#import <Foundation/Foundation.h>
-
-CHIPCallbackBridge::CHIPCallbackBridge(CHIPDeviceCallback handler, dispatch_queue_t queue)
-    : Callback::Callback<>(CallbackFn, this)
-    , mHandler(handler)
-    , mQueue(queue)
-{
-}
-
-CHIPCallbackBridge::~CHIPCallbackBridge() {}
-
-void CHIPCallbackBridge::CallbackFn(void * context)
-{
-    CHIPCallbackBridge * callback = reinterpret_cast<CHIPCallbackBridge *>(context);
-    if (callback && callback->mQueue) {
-        dispatch_async(callback->mQueue, ^{
-            callback->mHandler([CHIPError errorForCHIPErrorCode:CHIP_NO_ERROR]);
-            callback->Cancel();
-            delete callback;
-        });
-    }
-}
diff --git a/src/darwin/Framework/CHIP/CHIPDeviceCallback.h b/src/darwin/Framework/CHIP/CHIPDeviceCallback.h
deleted file mode 100644 (file)
index 4ca6b5a..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "CHIPError.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef void (^CHIPDeviceCallback)(NSError * error);
-
-NS_ASSUME_NONNULL_END
diff --git a/src/darwin/Framework/CHIP/CHIPDeviceStatusDelegate.h b/src/darwin/Framework/CHIP/CHIPDeviceStatusDelegate.h
deleted file mode 100644 (file)
index efa618b..0000000
+++ /dev/null
@@ -1,37 +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.
- */
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- * The protocol definition for the CHIPDevicePairingDelegate
- *
- * All delegate methods will be called on the supplied Delegate Queue.
- */
-@protocol CHIPDeviceStatusDelegate <NSObject>
-@required
-/**
- * Notify the delegate when a message is received from the device
- *
- */
-- (void)onMessageReceived:(NSData *)message;
-
-@end
-
-NS_ASSUME_NONNULL_END
diff --git a/src/darwin/Framework/CHIP/CHIPDeviceStatusDelegateBridge.h b/src/darwin/Framework/CHIP/CHIPDeviceStatusDelegateBridge.h
deleted file mode 100644 (file)
index c15cc93..0000000
+++ /dev/null
@@ -1,42 +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.
- */
-
-#import "CHIPDeviceStatusDelegate.h"
-#import <Foundation/Foundation.h>
-
-#include <controller/CHIPDevice.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-class CHIPDeviceStatusDelegateBridge : public chip::Controller::DeviceStatusDelegate
-{
-public:
-    CHIPDeviceStatusDelegateBridge();
-    ~CHIPDeviceStatusDelegateBridge();
-
-    void setDelegate(id<CHIPDeviceStatusDelegate> delegate, dispatch_queue_t queue);
-
-    void OnMessage(chip::System::PacketBufferHandle message) override;
-
-    void OnStatusChange() override;
-
-private:
-    id<CHIPDeviceStatusDelegate> mDelegate;
-    dispatch_queue_t mQueue;
-};
-
-NS_ASSUME_NONNULL_END
diff --git a/src/darwin/Framework/CHIP/CHIPDeviceStatusDelegateBridge.mm b/src/darwin/Framework/CHIP/CHIPDeviceStatusDelegateBridge.mm
deleted file mode 100644 (file)
index fb020fb..0000000
+++ /dev/null
@@ -1,62 +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.
- */
-
-#import "CHIPDeviceStatusDelegateBridge.h"
-#import <Foundation/Foundation.h>
-
-CHIPDeviceStatusDelegateBridge::CHIPDeviceStatusDelegateBridge(void)
-    : mDelegate(nil)
-{
-}
-
-CHIPDeviceStatusDelegateBridge::~CHIPDeviceStatusDelegateBridge() {}
-
-void CHIPDeviceStatusDelegateBridge::setDelegate(id<CHIPDeviceStatusDelegate> delegate, dispatch_queue_t queue)
-{
-    if (delegate && queue) {
-        mDelegate = delegate;
-        mQueue = queue;
-    } else {
-        mDelegate = nil;
-        mQueue = nil;
-    }
-}
-
-void CHIPDeviceStatusDelegateBridge::OnMessage(chip::System::PacketBufferHandle message)
-{
-    NSLog(@"DeviceStatusDelegate received message from the device");
-
-    size_t data_len = message->DataLength();
-    // convert to NSData
-    NSMutableData * dataBuffer = [[NSMutableData alloc] initWithBytes:message->Start() length:data_len];
-    message.FreeHead();
-
-    while (!message.IsNull()) {
-        data_len = message->DataLength();
-        [dataBuffer appendBytes:message->Start() length:data_len];
-        message.FreeHead();
-    }
-
-    id<CHIPDeviceStatusDelegate> strongDelegate = mDelegate;
-    if (strongDelegate && mQueue) {
-        dispatch_async(mQueue, ^{
-            [strongDelegate onMessageReceived:dataBuffer];
-        });
-    }
-}
-
-void CHIPDeviceStatusDelegateBridge::OnStatusChange() { NSLog(@"CHIPDeviceStatusDelegateBridge device status changed"); }
diff --git a/src/darwin/Framework/CHIP/CHIPOnOff.h b/src/darwin/Framework/CHIP/CHIPOnOff.h
deleted file mode 100644 (file)
index 352a133..0000000
+++ /dev/null
@@ -1,42 +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.
- */
-
-#ifndef CHIP_ONOFF_H
-#define CHIP_ONOFF_H
-
-#import <CHIP/CHIPDeviceCallback.h>
-#import <Foundation/Foundation.h>
-
-@class CHIPDevice;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface CHIPOnOff : NSObject
-
-- (nullable instancetype)initWithDevice:(CHIPDevice *)device endpoint:(uint8_t)endpoint queue:(dispatch_queue_t)queue;
-- (BOOL)lightOn:(CHIPDeviceCallback)onCompletion;
-- (BOOL)lightOff:(CHIPDeviceCallback)onCompletion;
-- (BOOL)toggleLight:(CHIPDeviceCallback)onCompletion;
-
-- (instancetype)init NS_UNAVAILABLE;
-+ (instancetype)new NS_UNAVAILABLE;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif /* CHIP_ONOFF_H */
diff --git a/src/darwin/Framework/CHIP/CHIPOnOff.mm b/src/darwin/Framework/CHIP/CHIPOnOff.mm
deleted file mode 100644 (file)
index 82db62f..0000000
+++ /dev/null
@@ -1,97 +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.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "CHIPCallbackBridge.h"
-#import "CHIPDevice.h"
-#import "CHIPDevice_Internal.h"
-#import "CHIPOnOff.h"
-
-#include <controller/OnOffCluster.h>
-
-@interface CHIPOnOff ()
-
-@property (readonly) chip::Controller::OnOffCluster cppCluster;
-@property (readonly, nonatomic) dispatch_queue_t callbackQueue;
-@end
-
-@implementation CHIPOnOff
-
-- (instancetype)initWithDevice:(CHIPDevice *)device endpoint:(chip::EndpointId)endpoint queue:(dispatch_queue_t)queue
-{
-    CHIP_ERROR err = _cppCluster.Associate([device internalDevice], endpoint);
-
-    if (err != CHIP_NO_ERROR) {
-        return nil;
-    }
-
-    if (self = [super init]) {
-        _callbackQueue = queue;
-    }
-    return self;
-}
-
-- (BOOL)lightOn:(CHIPDeviceCallback)onCompletion
-{
-    CHIPCallbackBridge * callback = new CHIPCallbackBridge(onCompletion, _callbackQueue);
-    if (!callback) {
-        return NO;
-    }
-
-    CHIP_ERROR err = self.cppCluster.On(callback);
-    if (err != CHIP_NO_ERROR) {
-        callback->Cancel();
-        delete callback;
-        return NO;
-    }
-    return YES;
-}
-
-- (BOOL)lightOff:(CHIPDeviceCallback)onCompletion
-{
-    CHIPCallbackBridge * callback = new CHIPCallbackBridge(onCompletion, _callbackQueue);
-    if (!callback) {
-        return NO;
-    }
-
-    CHIP_ERROR err = self.cppCluster.Off(callback);
-    if (err != CHIP_NO_ERROR) {
-        callback->Cancel();
-        delete callback;
-        return NO;
-    }
-    return YES;
-}
-
-- (BOOL)toggleLight:(CHIPDeviceCallback)onCompletion
-{
-    CHIPCallbackBridge * callback = new CHIPCallbackBridge(onCompletion, _callbackQueue);
-    if (!callback) {
-        return NO;
-    }
-
-    CHIP_ERROR err = self.cppCluster.Toggle(callback);
-    if (err != CHIP_NO_ERROR) {
-        callback->Cancel();
-        delete callback;
-        return NO;
-    }
-    return YES;
-}
-
-@end
index 0bba747..55a9cdb 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "writeTime": "Sat Feb 20 2021 16:22:34 GMT+0800 (China Standard Time)",
+  "writeTime": "Thu Mar 11 2021 18:15:06 GMT+0100 (Central European Standard Time)",
   "featureLevel": 11,
   "creator": "zap",
   "keyValuePairs": [
   "package": [
     {
       "pathRelativity": "relativeToZap",
-      "path": "../../../../app/zap-templates/zcl/zcl.json",
+      "path": "../../../src/app/zap-templates/zcl/zcl.json",
       "version": "ZCL Test Data",
       "type": "zcl-properties"
+    },
+    {
+      "pathRelativity": "relativeToZap",
+      "path": "../../../src/app/zap-templates/app-templates.json",
+      "version": "chip-v1",
+      "type": "gen-templates-json"
     }
   ],
   "endpointTypes": [
       "deviceTypeProfileId": 259,
       "clusters": [
         {
-          "name": "Basic",
-          "code": 0,
+          "name": "Identify",
+          "code": 3,
           "mfgCode": null,
-          "define": "BASIC_CLUSTER",
+          "define": "IDENTIFY_CLUSTER",
           "side": "client",
           "enabled": 1,
           "commands": [
             {
-              "name": "ResetToFactoryDefaults",
+              "name": "Identify",
               "code": 0,
               "mfgCode": null,
               "source": "client",
               "outgoing": 1
             },
             {
-              "name": "MfgSpecificPing",
-              "code": 0,
-              "mfgCode": "4098",
+              "name": "IdentifyQuery",
+              "code": 1,
+              "mfgCode": null,
               "source": "client",
-              "incoming": 0,
+              "incoming": 1,
               "outgoing": 1
             }
           ],
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ]
-        },
-        {
-          "name": "Basic",
-          "code": 0,
-          "mfgCode": null,
-          "define": "BASIC_CLUSTER",
-          "side": "server",
-          "enabled": 0,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "3",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "ZCL version",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x08",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            },
-            {
-              "name": "power source",
-              "code": 7,
-              "mfgCode": null,
-              "side": "server",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x00",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
-          ],
-          "commands": []
-        },
-        {
-          "name": "Identify",
-          "code": 3,
-          "mfgCode": null,
-          "define": "IDENTIFY_CLUSTER",
-          "side": "client",
-          "enabled": 1,
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
               "defaultValue": "2",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": [
-            {
-              "name": "Identify",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "IdentifyQuery",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
           ]
         },
         {
           ]
         },
         {
-          "name": "Door Lock",
-          "code": 257,
+          "name": "Basic",
+          "code": 40,
           "mfgCode": null,
-          "define": "DOOR_LOCK_CLUSTER",
+          "define": "BASIC_CLUSTER",
           "side": "client",
           "enabled": 1,
           "commands": [
             {
-              "name": "LockDoor",
+              "name": "MfgSpecificPing",
               "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "UnlockDoor",
-              "code": 1,
-              "mfgCode": null,
+              "mfgCode": "4098",
               "source": "client",
-              "incoming": 1,
+              "incoming": 0,
               "outgoing": 1
-            },
+            }
+          ],
+          "attributes": [
             {
-              "name": "UnlockWithTimeout",
-              "code": 3,
+              "name": "cluster revision",
+              "code": 65533,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_CLUSTER",
+          "side": "server",
+          "enabled": 0,
+          "commands": [
             {
-              "name": "GetLogRecord",
-              "code": 4,
+              "name": "StartUp",
+              "code": 0,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "source": "server",
+              "incoming": 0,
+              "outgoing": 0
             },
             {
-              "name": "SetPin",
-              "code": 5,
+              "name": "ShutDown",
+              "code": 1,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "source": "server",
+              "incoming": 0,
+              "outgoing": 0
             },
             {
-              "name": "GetPin",
-              "code": 6,
+              "name": "Leave",
+              "code": 2,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            },
+              "source": "server",
+              "incoming": 0,
+              "outgoing": 0
+            }
+          ],
+          "attributes": [
             {
-              "name": "ClearPin",
-              "code": 7,
+              "name": "cluster revision",
+              "code": 65533,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "ClearAllPins",
-              "code": 8,
+              "name": "InteractionModelVersion",
+              "code": 0,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "SetWeekdaySchedule",
-              "code": 11,
+              "name": "VendorName",
+              "code": 1,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "GetWeekdaySchedule",
-              "code": 12,
+              "name": "VendorID",
+              "code": 2,
               "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             },
             {
-              "name": "ClearWeekdaySchedule",
-              "code": 13,
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "General Commissioning",
+          "code": 48,
+          "mfgCode": null,
+          "define": "GENERAL_COMMISSIONING_CLUSTER",
+          "side": "client",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "SetFabric",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ArmFailSafe",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "CommissioningComplete",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "General Commissioning",
+          "code": 48,
+          "mfgCode": null,
+          "define": "GENERAL_COMMISSIONING_CLUSTER",
+          "side": "server",
+          "enabled": 0,
+          "commands": [
+            {
+              "name": "SetFabricResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ArmFailSafeResponse",
+              "code": 3,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "CommissioningCompleteResponse",
+              "code": 7,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "FabricId",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "o",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Breadcrumb",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Door Lock",
+          "code": 257,
+          "mfgCode": null,
+          "define": "DOOR_LOCK_CLUSTER",
+          "side": "client",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "LockDoor",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "UnlockDoor",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "UnlockWithTimeout",
+              "code": 3,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "GetLogRecord",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "SetPin",
+              "code": 5,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "GetPin",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ClearPin",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ClearAllPins",
+              "code": 8,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "SetWeekdaySchedule",
+              "code": 11,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "GetWeekdaySchedule",
+              "code": 12,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ClearWeekdaySchedule",
+              "code": 13,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
           "define": "BARRIER_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 1,
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ],
           "commands": [
             {
               "name": "BarrierControlGoToPercent",
               "incoming": 1,
               "outgoing": 1
             }
-          ],
-          "attributes": [
-            {
-              "name": "cluster revision",
-              "code": 65533,
-              "mfgCode": null,
-              "side": "client",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "0x0001",
-              "reportable": 0,
-              "minInterval": 0,
-              "maxInterval": 65344,
-              "reportableChange": 0
-            }
           ]
         },
         {
               "reportableChange": 0
             },
             {
-              "name": "tolerance",
-              "code": 3,
+              "name": "tolerance",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 0,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "IAS Zone",
+          "code": 1280,
+          "mfgCode": null,
+          "define": "IAS_ZONE_CLUSTER",
+          "side": "client",
+          "enabled": 0,
+          "commands": [
+            {
+              "name": "ZoneEnrollResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "2",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "IAS Zone",
+          "code": 1280,
+          "mfgCode": null,
+          "define": "IAS_ZONE_CLUSTER",
+          "side": "server",
+          "enabled": 0,
+          "commands": [
+            {
+              "name": "ZoneStatusChangeNotification",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "ZoneEnrollRequest",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "2",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "zone state",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "zone type",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "zone status",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0000",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "IAS CIE address",
+              "code": 16,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "Zone ID",
+              "code": 17,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0xff",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Low Power",
+          "code": 1288,
+          "mfgCode": null,
+          "define": "LOW_POWER_CLUSTER",
+          "side": "client",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "Sleep",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Low Power",
+          "code": 1288,
+          "mfgCode": null,
+          "define": "LOW_POWER_CLUSTER",
+          "side": "server",
+          "enabled": 0,
+          "commands": [],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
               "mfgCode": null,
               "side": "server",
-              "included": 0,
+              "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
-              "reportable": 1,
+              "defaultValue": "0x0001",
+              "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
           ]
         },
         {
-          "name": "IAS Zone",
-          "code": 1280,
+          "name": "Application Basic",
+          "code": 1293,
           "mfgCode": null,
-          "define": "IAS_ZONE_CLUSTER",
+          "define": "APPLICATION_BASIC_CLUSTER",
           "side": "client",
-          "enabled": 0,
-          "commands": [
-            {
-              "name": "ZoneEnrollResponse",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "incoming": 1,
-              "outgoing": 1
-            }
-          ],
+          "enabled": 1,
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "2",
+              "defaultValue": "0x0001",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
           ]
         },
         {
-          "name": "IAS Zone",
-          "code": 1280,
+          "name": "Application Basic",
+          "code": 1293,
           "mfgCode": null,
-          "define": "IAS_ZONE_CLUSTER",
+          "define": "APPLICATION_BASIC_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "2",
+              "defaultValue": "0x0001",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "zone state",
+              "name": "vendor name",
               "code": 0,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x00",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "zone type",
+              "name": "vendor id",
               "code": 1,
               "mfgCode": null,
               "side": "server",
               "reportableChange": 0
             },
             {
-              "name": "zone status",
+              "name": "application name",
               "code": 2,
               "mfgCode": null,
               "side": "server",
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x0000",
+              "defaultValue": "",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             },
             {
-              "name": "IAS CIE address",
-              "code": 16,
+              "name": "product id",
+              "code": 3,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "reportableChange": 0
             },
             {
-              "name": "Zone ID",
-              "code": 17,
+              "name": "application id",
+              "code": 5,
               "mfgCode": null,
               "side": "server",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0xff",
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "catalog vendor id",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "application satus",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x01",
               "reportable": 0,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
+          ]
+        },
+        {
+          "name": "Binding",
+          "code": 61440,
+          "mfgCode": null,
+          "define": "BINDING_CLUSTER",
+          "side": "client",
+          "enabled": 1,
           "commands": [
             {
-              "name": "ZoneStatusChangeNotification",
+              "name": "Bind",
               "code": 0,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "ZoneEnrollRequest",
+              "name": "Unbind",
               "code": 1,
               "mfgCode": null,
-              "source": "server",
+              "source": "client",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
-          "name": "Network Commissioning",
-          "code": 43690,
+          "name": "Binding",
+          "code": 61440,
           "mfgCode": null,
-          "define": "NETWORK_COMMISSIONING_CLUSTER",
-          "side": "client",
+          "define": "BINDING_CLUSTER",
+          "side": "server",
           "enabled": 0,
+          "commands": [],
           "attributes": [
             {
               "name": "cluster revision",
               "code": 65533,
               "mfgCode": null,
-              "side": "client",
+              "side": "server",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
+          ]
+        },
+        {
+          "name": "Media Playback",
+          "code": 61441,
+          "mfgCode": null,
+          "define": "MEDIA_PLAYBACK_CLUSTER",
+          "side": "client",
+          "enabled": 1,
           "commands": [
             {
-              "name": "ScanNetworks",
+              "name": "PlayRequest",
               "code": 0,
               "mfgCode": null,
               "source": "client",
               "outgoing": 1
             },
             {
-              "name": "AddWiFiNetwork",
+              "name": "PauseRequest",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "StopRequest",
               "code": 2,
               "mfgCode": null,
               "source": "client",
               "outgoing": 1
             },
             {
-              "name": "UpdateWiFiNetwork",
-              "code": 4,
+              "name": "StartOverRequest",
+              "code": 3,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "AddThreadNetwork",
-              "code": 6,
+              "name": "PreviousRequest",
+              "code": 4,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "UpdateThreadNetwork",
-              "code": 8,
+              "name": "NextRequest",
+              "code": 5,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "RemoveNetwork",
-              "code": 10,
+              "name": "RewindRequest",
+              "code": 6,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "EnableNetwork",
-              "code": 12,
+              "name": "FastForwardRequest",
+              "code": 7,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "DisableNetwork",
-              "code": 14,
+              "name": "SkipForwardRequest",
+              "code": 8,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             },
             {
-              "name": "GetLastNetworkCommissioningResult",
-              "code": 16,
+              "name": "SkipBackwardRequest",
+              "code": 9,
               "mfgCode": null,
               "source": "client",
               "incoming": 1,
               "outgoing": 1
             }
+          ],
+          "attributes": [
+            {
+              "name": "cluster revision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "client",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0001",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            }
           ]
         },
         {
-          "name": "Network Commissioning",
-          "code": 43690,
+          "name": "Media Playback",
+          "code": 61441,
           "mfgCode": null,
-          "define": "NETWORK_COMMISSIONING_CLUSTER",
+          "define": "MEDIA_PLAYBACK_CLUSTER",
           "side": "server",
           "enabled": 0,
           "commands": [
             {
-              "name": "ScanNetworksResponse",
-              "code": 1,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "AddWiFiNetworkResponse",
-              "code": 3,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "UpdateWiFiNetworkResponse",
-              "code": 5,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "AddThreadNetworkResponse",
-              "code": 7,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "UpdateThreadNetworkResponse",
-              "code": 9,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "RemoveNetworkResponse",
-              "code": 11,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "EnableNetworkResponse",
-              "code": 13,
-              "mfgCode": null,
-              "source": "server",
-              "incoming": 1,
-              "outgoing": 1
-            },
-            {
-              "name": "DisableNetworkResponse",
-              "code": 15,
+              "name": "Playback",
+              "code": 0,
               "mfgCode": null,
               "source": "server",
               "incoming": 1,
               "minInterval": 0,
               "maxInterval": 65344,
               "reportableChange": 0
+            },
+            {
+              "name": "current state",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 0,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
             }
           ]
         },
         {
-          "name": "Binding",
-          "code": 61440,
+          "name": "Content Launch",
+          "code": 61442,
           "mfgCode": null,
-          "define": "BINDING_CLUSTER",
+          "define": "CONTENT_LAUNCH_CLUSTER",
           "side": "client",
           "enabled": 1,
           "commands": [
             {
-              "name": "Bind",
+              "name": "LaunchContent",
               "code": 0,
               "mfgCode": null,
               "source": "client",
               "outgoing": 1
             },
             {
-              "name": "Unbind",
+              "name": "LaunchURL",
               "code": 1,
               "mfgCode": null,
               "source": "client",
           ]
         },
         {
-          "name": "Binding",
-          "code": 61440,
+          "name": "Content Launch",
+          "code": 61442,
           "mfgCode": null,
-          "define": "BINDING_CLUSTER",
+          "define": "CONTENT_LAUNCH_CLUSTER",
           "side": "server",
           "enabled": 0,
+          "commands": [
+            {
+              "name": "LaunchContentResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            },
+            {
+              "name": "LaunchURLResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "incoming": 1,
+              "outgoing": 1
+            }
+          ],
           "attributes": [
             {
               "name": "cluster revision",
               "maxInterval": 65344,
               "reportableChange": 0
             }
-          ],
-          "commands": []
+          ]
         }
       ]
     }
index 58b3d84..71fe6c6 100644 (file)
@@ -272,10 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
             case 0x38: // semi / Semi-precision
             case 0x39: // single / Single precision
             case 0x3A: // double / Double precision
-            case 0x41: // octstr / Octet string
-            case 0x42: // string / Character string
-            case 0x43: // octstr16 / Long octet string
-            case 0x44: // string16 / Long character string
             case 0x48: // array / Array
             case 0x49: // struct / Structure
             case 0x50: // set / Set
@@ -289,6 +285,48 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
                 return true;
             }
 
+            case 0x41: // octstr / Octet string
+            case 0x42: // string / Character string
+            {
+                // Short Strings must contains at least one byte for the length
+                CHECK_MESSAGE_LENGTH(1);
+                uint8_t length = chip::Encoding::Read8(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
+            case 0x43: // octstr16 / Long octet string
+            case 0x44: // string16 / Long character string
+            {
+                // Long Strings must contains at least two bytes for the length
+                CHECK_MESSAGE_LENGTH(2);
+                uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+                ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+                // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+                if (length == 0xFFFF)
+                {
+                    length = 0;
+                }
+
+                CHECK_MESSAGE_LENGTH(length);
+                Callback::Callback<StringAttributeCallback> * cb =
+                    Callback::Callback<StringAttributeCallback>::FromCancelable(onSuccessCallback);
+                cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+                break;
+            }
+
             case 0x08: // data8 / 8-bit data
             case 0x18: // map8 / 8-bit bitmap
             case 0x20: // uint8 / Unsigned  8-bit integer
@@ -648,6 +686,32 @@ 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:");
@@ -1132,6 +1196,48 @@ bool emberAfDoorLockClusterUnlockWithTimeoutResponseCallback(uint8_t status)
     return true;
 }
 
+bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(uint8_t errorCode, uint8_t * debugText)
+{
+    ChipLogProgress(Zcl, "ArmFailSafeResponse:");
+    ChipLogProgress(Zcl, "  errorCode: %" PRIu8 "", errorCode);
+    ChipLogProgress(Zcl, "  debugText: %s", debugText);
+
+    GET_RESPONSE_CALLBACKS("GeneralCommissioningClusterArmFailSafeResponseCallback");
+
+    Callback::Callback<GeneralCommissioningClusterArmFailSafeResponseCallback> * cb =
+        Callback::Callback<GeneralCommissioningClusterArmFailSafeResponseCallback>::FromCancelable(onSuccessCallback);
+    cb->mCall(cb->mContext, errorCode, debugText);
+    return true;
+}
+
+bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(uint8_t errorCode, uint8_t * debugText)
+{
+    ChipLogProgress(Zcl, "CommissioningCompleteResponse:");
+    ChipLogProgress(Zcl, "  errorCode: %" PRIu8 "", errorCode);
+    ChipLogProgress(Zcl, "  debugText: %s", debugText);
+
+    GET_RESPONSE_CALLBACKS("GeneralCommissioningClusterCommissioningCompleteResponseCallback");
+
+    Callback::Callback<GeneralCommissioningClusterCommissioningCompleteResponseCallback> * cb =
+        Callback::Callback<GeneralCommissioningClusterCommissioningCompleteResponseCallback>::FromCancelable(onSuccessCallback);
+    cb->mCall(cb->mContext, errorCode, debugText);
+    return true;
+}
+
+bool emberAfGeneralCommissioningClusterSetFabricResponseCallback(uint8_t errorCode, uint8_t * debugText)
+{
+    ChipLogProgress(Zcl, "SetFabricResponse:");
+    ChipLogProgress(Zcl, "  errorCode: %" PRIu8 "", errorCode);
+    ChipLogProgress(Zcl, "  debugText: %s", debugText);
+
+    GET_RESPONSE_CALLBACKS("GeneralCommissioningClusterSetFabricResponseCallback");
+
+    Callback::Callback<GeneralCommissioningClusterSetFabricResponseCallback> * cb =
+        Callback::Callback<GeneralCommissioningClusterSetFabricResponseCallback>::FromCancelable(onSuccessCallback);
+    cb->mCall(cb->mContext, errorCode, debugText);
+    return true;
+}
+
 bool emberAfGroupsClusterAddGroupResponseCallback(uint8_t status, uint16_t groupId)
 {
     ChipLogProgress(Zcl, "AddGroupResponse:");
@@ -1421,10 +1527,6 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
         case 0x38: // semi / Semi-precision
         case 0x39: // single / Single precision
         case 0x3A: // double / Double precision
-        case 0x41: // octstr / Octet string
-        case 0x42: // string / Character string
-        case 0x43: // octstr16 / Long octet string
-        case 0x44: // string16 / Long character string
         case 0x48: // array / Array
         case 0x49: // struct / Structure
         case 0x50: // set / Set
@@ -1435,6 +1537,48 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin
             return true;
         }
 
+        case 0x41: // octstr / Octet string
+        case 0x42: // string / Character string
+        {
+            // Short Strings must contains at least one byte for the length
+            CHECK_MESSAGE_LENGTH(1);
+            uint8_t length = chip::Encoding::Read8(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
+        case 0x43: // octstr16 / Long octet string
+        case 0x44: // string16 / Long character string
+        {
+            // Long Strings must contains at least two bytes for the length
+            CHECK_MESSAGE_LENGTH(2);
+            uint16_t length = chip::Encoding::LittleEndian::Read16(message);
+            ChipLogProgress(Zcl, "  length: 0x%02x", length);
+
+            // When the length is set to 0xFFFF, it represents a non-value. In this case the data field is zero length.
+            if (length == 0xFFFF)
+            {
+                length = 0;
+            }
+
+            CHECK_MESSAGE_LENGTH(length);
+            Callback::Callback<StringAttributeCallback> * cb =
+                Callback::Callback<StringAttributeCallback>::FromCancelable(onReportCallback);
+            cb->mCall(cb->mContext, chip::ByteSpan(message, length));
+            break;
+        }
+
         case 0x08: // data8 / 8-bit data
         case 0x18: // map8 / 8-bit bitmap
         case 0x20: // uint8 / Unsigned  8-bit integer
index 3e88cfc..00c37b8 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <inttypes.h>
+#include <lib/support/Span.h>
 
 // Global Response Callbacks
 typedef void (*DefaultSuccessCallback)(void * context);
@@ -33,10 +34,13 @@ typedef void (*Int32uAttributeCallback)(void * context, uint32_t value);
 typedef void (*Int32sAttributeCallback)(void * context, int32_t value);
 typedef void (*Int64uAttributeCallback)(void * context, uint64_t value);
 typedef void (*Int64sAttributeCallback)(void * context, int64_t value);
+typedef void (*StringAttributeCallback)(void * context, const chip::ByteSpan value);
 typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint16_t minInterval, uint16_t maxInterval);
 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);
@@ -68,12 +72,17 @@ typedef void (*DoorLockClusterSetWeekdayScheduleResponseCallback)(void * context
 typedef void (*DoorLockClusterSetYeardayScheduleResponseCallback)(void * context);
 typedef void (*DoorLockClusterUnlockDoorResponseCallback)(void * context);
 typedef void (*DoorLockClusterUnlockWithTimeoutResponseCallback)(void * context);
+typedef void (*GeneralCommissioningClusterArmFailSafeResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText);
+typedef void (*GeneralCommissioningClusterCommissioningCompleteResponseCallback)(void * context, uint8_t errorCode,
+                                                                                 uint8_t * debugText);
+typedef void (*GeneralCommissioningClusterSetFabricResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText);
 typedef void (*GroupsClusterAddGroupResponseCallback)(void * context, uint16_t groupId);
 typedef void (*GroupsClusterGetGroupMembershipResponseCallback)(void * context, uint8_t capacity, uint8_t groupCount,
                                                                 /* TYPE WARNING: array array defaults to */ uint8_t * groupList);
 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 adfa1de..847dc97 100644 (file)
@@ -43,6 +43,23 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
+ * Cluster Application Basic
+ *
+ */
+@interface CHIPApplicationBasic : CHIPCluster
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorId:(ResponseHandler)completionHandler;
+- (void)readAttributeApplicationName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductId:(ResponseHandler)completionHandler;
+- (void)readAttributeApplicationId:(ResponseHandler)completionHandler;
+- (void)readAttributeCatalogVendorId:(ResponseHandler)completionHandler;
+- (void)readAttributeApplicationSatus:(ResponseHandler)completionHandler;
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
+
+@end
+
+/**
  * Cluster Barrier Control
  *
  */
@@ -66,10 +83,20 @@ NS_ASSUME_NONNULL_BEGIN
 @interface CHIPBasic : CHIPCluster
 
 - (void)mfgSpecificPing:(ResponseHandler)completionHandler;
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler;
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler;
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler;
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler;
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler;
+- (void)readAttributeProductName:(ResponseHandler)completionHandler;
+- (void)readAttributeProductID:(ResponseHandler)completionHandler;
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler;
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeLocation:(ResponseHandler)completionHandler;
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler;
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler;
 - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
 
 @end
@@ -274,6 +301,19 @@ 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
  *
  */
@@ -293,7 +333,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
 - (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler;
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 - (void)setHolidaySchedule:(uint8_t)scheduleId
                 localStartTime:(uint32_t)localStartTime
                   localEndTime:(uint32_t)localEndTime
@@ -302,12 +342,12 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)setPin:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                  pin:(char *)pin
+                  pin:(NSString *)pin
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setRfid:(uint16_t)userId
            userStatus:(uint8_t)userStatus
              userType:(uint8_t)userType
-                   id:(char *)id
+                   id:(NSString *)id
     completionHandler:(ResponseHandler)completionHandler;
 - (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler;
 - (void)setWeekdaySchedule:(uint8_t)scheduleId
@@ -323,8 +363,8 @@ NS_ASSUME_NONNULL_BEGIN
             localStartTime:(uint32_t)localStartTime
               localEndTime:(uint32_t)localEndTime
          completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler;
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler;
 
 - (void)readAttributeLockState:(ResponseHandler)completionHandler;
 - (void)configureAttributeLockState:(uint16_t)minInterval
@@ -338,13 +378,39 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
+ * Cluster General Commissioning
+ *
+ */
+@interface CHIPGeneralCommissioning : CHIPCluster
+
+- (void)armFailSafe:(uint16_t)expiryLengthSeconds
+           breadcrumb:(uint64_t)breadcrumb
+            timeoutMs:(uint32_t)timeoutMs
+    completionHandler:(ResponseHandler)completionHandler;
+- (void)commissioningComplete:(ResponseHandler)completionHandler;
+- (void)setFabric:(NSData *)fabricId
+         fabricSecret:(NSData *)fabricSecret
+           breadcrumb:(uint64_t)breadcrumb
+            timeoutMs:(uint32_t)timeoutMs
+    completionHandler:(ResponseHandler)completionHandler;
+
+- (void)readAttributeFabricId:(ResponseHandler)completionHandler;
+- (void)readAttributeBreadcrumb:(ResponseHandler)completionHandler;
+- (void)writeAttributeBreadcrumb:(uint64_t)value completionHandler:(ResponseHandler)completionHandler;
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
+
+@end
+
+/**
  * Cluster Groups
  *
  */
 @interface CHIPGroups : CHIPCluster
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler;
+- (void)addGroupIfIdentifying:(uint16_t)groupId
+                    groupName:(NSString *)groupName
+            completionHandler:(ResponseHandler)completionHandler;
 - (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler;
 - (void)removeAllGroups:(ResponseHandler)completionHandler;
 - (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler;
@@ -414,6 +480,40 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
+ * Cluster Low Power
+ *
+ */
+@interface CHIPLowPower : CHIPCluster
+
+- (void)sleep:(ResponseHandler)completionHandler;
+
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
+
+@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
  *
  */
@@ -441,7 +541,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
index 3c869a7..cd60722 100644 (file)
@@ -89,26 +89,38 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPUnsupportedAttributeCallbackBridge : public Callback::Callback<DefaultSuccessCallback> {
+class CHIPStringAttributeCallbackBridge : public Callback::Callback<StringAttributeCallback> {
 public:
-    CHIPUnsupportedAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<DefaultSuccessCallback>(CallbackFn, this)
+    CHIPStringAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool octetString, bool keepAlive = false)
+        : Callback::Callback<StringAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mOctetString(octetString)
+        , mKeepAlive(keepAlive)
     {
     }
 
-    ~CHIPUnsupportedAttributeCallbackBridge() {};
+    ~CHIPStringAttributeCallbackBridge() {};
 
-    static void CallbackFn(void * context)
+    static void CallbackFn(void * context, chip::ByteSpan value)
     {
-        CHIPUnsupportedAttributeCallbackBridge * callback = reinterpret_cast<CHIPUnsupportedAttributeCallbackBridge *>(context);
+        CHIPStringAttributeCallbackBridge * callback = reinterpret_cast<CHIPStringAttributeCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:CHIPErrorCodeUndefinedError
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"Unsupported attribute type" }];
-                callback->mHandler(error, nil);
-                callback->Cancel();
-                delete callback;
+                if (callback->mOctetString) {
+                    NSData * data = [NSData dataWithBytes:value.data() length:value.size()];
+                    callback->mHandler(nil, @ { @"value" : data });
+                } else {
+                    NSString * str = [[NSString alloc] initWithBytes:value.data()
+                                                              length:value.size()
+                                                            encoding:NSUTF8StringEncoding];
+                    callback->mHandler(nil, @ { @"value" : str });
+                }
+
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
             });
         }
     };
@@ -116,6 +128,8 @@ public:
 private:
     ResponseHandler mHandler;
     dispatch_queue_t mQueue;
+    bool mOctetString;
+    bool mKeepAlive;
 };
 
 class CHIPBooleanAttributeCallbackBridge : public Callback::Callback<BooleanAttributeCallback> {
@@ -246,6 +260,38 @@ private:
     bool mKeepAlive;
 };
 
+class CHIPInt32uAttributeCallbackBridge : public Callback::Callback<Int32uAttributeCallback> {
+public:
+    CHIPInt32uAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
+        : Callback::Callback<Int32uAttributeCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+        , mKeepAlive(keepAlive)
+    {
+    }
+
+    ~CHIPInt32uAttributeCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint32_t value)
+    {
+        CHIPInt32uAttributeCallbackBridge * callback = reinterpret_cast<CHIPInt32uAttributeCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ { @"value" : [NSNumber numberWithUnsignedLong:value] });
+                if (!callback->mKeepAlive) {
+                    callback->Cancel();
+                    delete callback;
+                }
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+    bool mKeepAlive;
+};
+
 class CHIPInt16sAttributeCallbackBridge : public Callback::Callback<Int16sAttributeCallback> {
 public:
     CHIPInt16sAttributeCallbackBridge(ResponseHandler handler, dispatch_queue_t queue, bool keepAlive = false)
@@ -278,6 +324,70 @@ 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:
@@ -1000,6 +1110,105 @@ private:
     dispatch_queue_t mQueue;
 };
 
+class CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge
+    : public Callback::Callback<GeneralCommissioningClusterArmFailSafeResponseCallback> {
+public:
+    CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
+        : Callback::Callback<GeneralCommissioningClusterArmFailSafeResponseCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+    {
+    }
+
+    ~CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
+    {
+        CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge * callback
+            = reinterpret_cast<CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ {
+                    @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
+                    @"debugText" : [NSString stringWithFormat:@"%s", debugText],
+                });
+                callback->Cancel();
+                delete callback;
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+};
+
+class CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge
+    : public Callback::Callback<GeneralCommissioningClusterCommissioningCompleteResponseCallback> {
+public:
+    CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
+        : Callback::Callback<GeneralCommissioningClusterCommissioningCompleteResponseCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+    {
+    }
+
+    ~CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
+    {
+        CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * callback
+            = reinterpret_cast<CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ {
+                    @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
+                    @"debugText" : [NSString stringWithFormat:@"%s", debugText],
+                });
+                callback->Cancel();
+                delete callback;
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+};
+
+class CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge
+    : public Callback::Callback<GeneralCommissioningClusterSetFabricResponseCallback> {
+public:
+    CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
+        : Callback::Callback<GeneralCommissioningClusterSetFabricResponseCallback>(CallbackFn, this)
+        , mHandler(handler)
+        , mQueue(queue)
+    {
+    }
+
+    ~CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge() {};
+
+    static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText)
+    {
+        CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge * callback
+            = reinterpret_cast<CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge *>(context);
+        if (callback && callback->mQueue) {
+            dispatch_async(callback->mQueue, ^{
+                callback->mHandler(nil, @ {
+                    @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode],
+                    @"debugText" : [NSString stringWithFormat:@"%s", debugText],
+                });
+                callback->Cancel();
+                delete callback;
+            });
+        }
+    };
+
+private:
+    ResponseHandler mHandler;
+    dispatch_queue_t mQueue;
+};
+
 class CHIPGroupsClusterAddGroupResponseCallbackBridge : public Callback::Callback<GroupsClusterAddGroupResponseCallback> {
 public:
     CHIPGroupsClusterAddGroupResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
@@ -1162,6 +1371,35 @@ 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)
@@ -1394,20 +1632,21 @@ private:
 }
 @end
 
-@interface CHIPBarrierControl ()
-@property (readonly) Controller::BarrierControlCluster cppCluster;
+@interface CHIPApplicationBasic ()
+@property (readonly) Controller::ApplicationBasicCluster cppCluster;
 @end
 
-@implementation CHIPBarrierControl
+@implementation CHIPApplicationBasic
 
 - (Controller::ClusterBase *)getCluster
 {
     return &_cppCluster;
 }
 
-- (void)barrierControlGoToPercent:(uint8_t)percentOpen completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1420,16 +1659,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.BarrierControlGoToPercent(onSuccess->Cancel(), onFailure->Cancel(), percentOpen);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)barrierControlStop:(ResponseHandler)completionHandler
+
+- (void)readAttributeVendorId:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1442,7 +1682,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.BarrierControlStop(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeVendorId(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1450,9 +1690,10 @@ private:
     }
 }
 
-- (void)readAttributeBarrierMovingState:(ResponseHandler)completionHandler
+- (void)readAttributeApplicationName:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1465,7 +1706,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierMovingState(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationName(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1473,7 +1714,7 @@ private:
     }
 }
 
-- (void)readAttributeBarrierSafetyStatus:(ResponseHandler)completionHandler
+- (void)readAttributeProductId:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -1488,7 +1729,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierSafetyStatus(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeProductId(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1496,9 +1737,10 @@ private:
     }
 }
 
-- (void)readAttributeBarrierCapabilities:(ResponseHandler)completionHandler
+- (void)readAttributeApplicationId:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1511,7 +1753,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierCapabilities(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationId(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1519,7 +1761,30 @@ private:
     }
 }
 
-- (void)readAttributeBarrierPosition:(ResponseHandler)completionHandler
+- (void)readAttributeCatalogVendorId:(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.ReadAttributeCatalogVendorId(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeApplicationSatus:(ResponseHandler)completionHandler
 {
     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -1534,7 +1799,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierPosition(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeApplicationSatus(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1567,18 +1832,18 @@ private:
 
 @end
 
-@interface CHIPBasic ()
-@property (readonly) Controller::BasicCluster cppCluster;
+@interface CHIPBarrierControl ()
+@property (readonly) Controller::BarrierControlCluster cppCluster;
 @end
 
-@implementation CHIPBasic
+@implementation CHIPBarrierControl
 
 - (Controller::ClusterBase *)getCluster
 {
     return &_cppCluster;
 }
 
-- (void)mfgSpecificPing:(ResponseHandler)completionHandler
+- (void)barrierControlGoToPercent:(uint8_t)percentOpen completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -1593,14 +1858,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MfgSpecificPing(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.BarrierControlGoToPercent(onSuccess->Cancel(), onFailure->Cancel(), percentOpen);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)resetToFactoryDefaults:(ResponseHandler)completionHandler
+- (void)barrierControlStop:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -1615,7 +1880,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ResetToFactoryDefaults(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.BarrierControlStop(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1623,7 +1888,7 @@ private:
     }
 }
 
-- (void)readAttributeZclVersion:(ResponseHandler)completionHandler
+- (void)readAttributeBarrierMovingState:(ResponseHandler)completionHandler
 {
     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -1638,7 +1903,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeZclVersion(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierMovingState(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1646,9 +1911,9 @@ private:
     }
 }
 
-- (void)readAttributePowerSource:(ResponseHandler)completionHandler
+- (void)readAttributeBarrierSafetyStatus:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1661,7 +1926,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePowerSource(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierSafetyStatus(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1669,9 +1934,9 @@ private:
     }
 }
 
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
+- (void)readAttributeBarrierCapabilities:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1684,7 +1949,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierCapabilities(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1692,26 +1957,9 @@ private:
     }
 }
 
-@end
-
-@interface CHIPBinding ()
-@property (readonly) Controller::BindingCluster cppCluster;
-@end
-
-@implementation CHIPBinding
-
-- (Controller::ClusterBase *)getCluster
+- (void)readAttributeBarrierPosition:(ResponseHandler)completionHandler
 {
-    return &_cppCluster;
-}
-
-- (void)bind:(uint64_t)nodeId
-              groupId:(uint16_t)groupId
-           endpointId:(uint8_t)endpointId
-            clusterId:(uint16_t)clusterId
-    completionHandler:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1724,20 +1972,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.Bind(onSuccess->Cancel(), onFailure->Cancel(), nodeId, groupId, endpointId, clusterId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeBarrierPosition(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unbind:(uint64_t)nodeId
-              groupId:(uint16_t)groupId
-           endpointId:(uint8_t)endpointId
-            clusterId:(uint16_t)clusterId
-    completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1750,7 +1995,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.Unbind(onSuccess->Cancel(), onFailure->Cancel(), nodeId, groupId, endpointId, clusterId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1758,9 +2003,22 @@ private:
     }
 }
 
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
+@end
+
+@interface CHIPBasic ()
+@property (readonly) Controller::BasicCluster cppCluster;
+@end
+
+@implementation CHIPBasic
+
+- (Controller::ClusterBase *)getCluster
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    return &_cppCluster;
+}
+
+- (void)mfgSpecificPing:(ResponseHandler)completionHandler
+{
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1773,7 +2031,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.MfgSpecificPing(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -1781,26 +2039,9 @@ private:
     }
 }
 
-@end
-
-@interface CHIPColorControl ()
-@property (readonly) Controller::ColorControlCluster cppCluster;
-@end
-
-@implementation CHIPColorControl
-
-- (Controller::ClusterBase *)getCluster
-{
-    return &_cppCluster;
-}
-
-- (void)moveColor:(int16_t)rateX
-                rateY:(int16_t)rateY
-          optionsMask:(uint8_t)optionsMask
-      optionsOverride:(uint8_t)optionsOverride
-    completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeInteractionModelVersion:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1813,23 +2054,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.MoveColor(onSuccess->Cancel(), onFailure->Cancel(), rateX, rateY, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeInteractionModelVersion(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveColorTemperature:(uint8_t)moveMode
-                        rate:(uint16_t)rate
-     colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
-     colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
-                 optionsMask:(uint8_t)optionsMask
-             optionsOverride:(uint8_t)optionsOverride
-           completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeVendorName:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1842,21 +2078,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate,
-        colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeVendorName(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveHue:(uint8_t)moveMode
-                 rate:(uint8_t)rate
-          optionsMask:(uint8_t)optionsMask
-      optionsOverride:(uint8_t)optionsOverride
-    completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeVendorID:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1869,21 +2101,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.MoveHue(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeVendorID(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveSaturation:(uint8_t)moveMode
-                  rate:(uint8_t)rate
-           optionsMask:(uint8_t)optionsMask
-       optionsOverride:(uint8_t)optionsOverride
-     completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeProductName:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1896,22 +2125,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.MoveSaturation(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeProductName(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveToColor:(uint16_t)colorX
-               colorY:(uint16_t)colorY
-       transitionTime:(uint16_t)transitionTime
-          optionsMask:(uint8_t)optionsMask
-      optionsOverride:(uint8_t)optionsOverride
-    completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeProductID:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1924,21 +2148,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveToColor(
-        onSuccess->Cancel(), onFailure->Cancel(), colorX, colorY, transitionTime, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeProductID(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveToColorTemperature:(uint16_t)colorTemperature
-                transitionTime:(uint16_t)transitionTime
-                   optionsMask:(uint8_t)optionsMask
-               optionsOverride:(uint8_t)optionsOverride
-             completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeUserLabel:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -1951,20 +2172,15 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveToColorTemperature(
-        onSuccess->Cancel(), onFailure->Cancel(), colorTemperature, transitionTime, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeUserLabel(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveToHue:(uint8_t)hue
-            direction:(uint8_t)direction
-       transitionTime:(uint16_t)transitionTime
-          optionsMask:(uint8_t)optionsMask
-      optionsOverride:(uint8_t)optionsOverride
-    completionHandler:(ResponseHandler)completionHandler
+
+- (void)writeAttributeUserLabel:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -1979,22 +2195,20 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveToHue(
-        onSuccess->Cancel(), onFailure->Cancel(), hue, direction, transitionTime, optionsMask, optionsOverride);
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeUserLabel(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveToHueAndSaturation:(uint8_t)hue
-                    saturation:(uint8_t)saturation
-                transitionTime:(uint16_t)transitionTime
-                   optionsMask:(uint8_t)optionsMask
-               optionsOverride:(uint8_t)optionsOverride
-             completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeLocation:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2007,19 +2221,15 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveToHueAndSaturation(
-        onSuccess->Cancel(), onFailure->Cancel(), hue, saturation, transitionTime, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeLocation(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)moveToSaturation:(uint8_t)saturation
-          transitionTime:(uint16_t)transitionTime
-             optionsMask:(uint8_t)optionsMask
-         optionsOverride:(uint8_t)optionsOverride
-       completionHandler:(ResponseHandler)completionHandler
+
+- (void)writeAttributeLocation:(NSString *)value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2034,22 +2244,19 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveToSaturation(
-        onSuccess->Cancel(), onFailure->Cancel(), saturation, transitionTime, optionsMask, optionsOverride);
+    NSData * data = [value dataUsingEncoding:NSUTF8StringEncoding];
+    CHIP_ERROR err = self.cppCluster.WriteAttributeLocation(
+        onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) data.bytes, data.length));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)stepColor:(int16_t)stepX
-                stepY:(int16_t)stepY
-       transitionTime:(uint16_t)transitionTime
-          optionsMask:(uint8_t)optionsMask
-      optionsOverride:(uint8_t)optionsOverride
-    completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeHardwareVersion:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2062,24 +2269,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.StepColor(
-        onSuccess->Cancel(), onFailure->Cancel(), stepX, stepY, transitionTime, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersion(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)stepColorTemperature:(uint8_t)stepMode
-                    stepSize:(uint16_t)stepSize
-              transitionTime:(uint16_t)transitionTime
-     colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
-     colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
-                 optionsMask:(uint8_t)optionsMask
-             optionsOverride:(uint8_t)optionsOverride
-           completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeHardwareVersionString:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2092,22 +2293,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.StepColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize,
-        transitionTime, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeHardwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)stepHue:(uint8_t)stepMode
-             stepSize:(uint8_t)stepSize
-       transitionTime:(uint8_t)transitionTime
-          optionsMask:(uint8_t)optionsMask
-      optionsOverride:(uint8_t)optionsOverride
-    completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeSoftwareVersion:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt32uAttributeCallbackBridge * onSuccess = new CHIPInt32uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2120,22 +2316,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.StepHue(
-        onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersion(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)stepSaturation:(uint8_t)stepMode
-              stepSize:(uint8_t)stepSize
-        transitionTime:(uint8_t)transitionTime
-           optionsMask:(uint8_t)optionsMask
-       optionsOverride:(uint8_t)optionsOverride
-     completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeSoftwareVersionString:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2148,19 +2340,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.StepSaturation(
-        onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeSoftwareVersionString(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)stopMoveStep:(uint8_t)optionsMask
-      optionsOverride:(uint8_t)optionsOverride
-    completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2173,7 +2363,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.StopMoveStep(onSuccess->Cancel(), onFailure->Cancel(), optionsMask, optionsOverride);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2181,9 +2371,26 @@ private:
     }
 }
 
-- (void)readAttributeCurrentHue:(ResponseHandler)completionHandler
+@end
+
+@interface CHIPBinding ()
+@property (readonly) Controller::BindingCluster cppCluster;
+@end
+
+@implementation CHIPBinding
+
+- (Controller::ClusterBase *)getCluster
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    return &_cppCluster;
+}
+
+- (void)bind:(uint64_t)nodeId
+              groupId:(uint16_t)groupId
+           endpointId:(uint8_t)endpointId
+            clusterId:(uint16_t)clusterId
+    completionHandler:(ResponseHandler)completionHandler
+{
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2196,18 +2403,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.Bind(onSuccess->Cancel(), onFailure->Cancel(), nodeId, groupId, endpointId, clusterId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)configureAttributeCurrentHue:(uint16_t)minInterval
-                         maxInterval:(uint16_t)maxInterval
-                              change:(uint8_t)change
-                   completionHandler:(ResponseHandler)completionHandler
+- (void)unbind:(uint64_t)nodeId
+              groupId:(uint16_t)groupId
+           endpointId:(uint8_t)endpointId
+            clusterId:(uint16_t)clusterId
+    completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2222,8 +2429,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.ConfigureAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    CHIP_ERROR err = self.cppCluster.Unbind(onSuccess->Cancel(), onFailure->Cancel(), nodeId, groupId, endpointId, clusterId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2231,24 +2437,1080 @@ private:
     }
 }
 
-- (void)reportAttributeCurrentHue:(ResponseHandler)reportHandler
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
-    if (!onReport) {
-        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    if (!onSuccess) {
+        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentHue(onReport->Cancel());
+    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 onReport;
-        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
 
-- (void)readAttributeCurrentSaturation:(ResponseHandler)completionHandler
-{
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+@end
+
+@interface CHIPColorControl ()
+@property (readonly) Controller::ColorControlCluster cppCluster;
+@end
+
+@implementation CHIPColorControl
+
+- (Controller::ClusterBase *)getCluster
+{
+    return &_cppCluster;
+}
+
+- (void)moveColor:(int16_t)rateX
+                rateY:(int16_t)rateY
+          optionsMask:(uint8_t)optionsMask
+      optionsOverride:(uint8_t)optionsOverride
+    completionHandler:(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.MoveColor(onSuccess->Cancel(), onFailure->Cancel(), rateX, rateY, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveColorTemperature:(uint8_t)moveMode
+                        rate:(uint16_t)rate
+     colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
+     colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
+                 optionsMask:(uint8_t)optionsMask
+             optionsOverride:(uint8_t)optionsOverride
+           completionHandler:(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.MoveColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate,
+        colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveHue:(uint8_t)moveMode
+                 rate:(uint8_t)rate
+          optionsMask:(uint8_t)optionsMask
+      optionsOverride:(uint8_t)optionsOverride
+    completionHandler:(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.MoveHue(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveSaturation:(uint8_t)moveMode
+                  rate:(uint8_t)rate
+           optionsMask:(uint8_t)optionsMask
+       optionsOverride:(uint8_t)optionsOverride
+     completionHandler:(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.MoveSaturation(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveToColor:(uint16_t)colorX
+               colorY:(uint16_t)colorY
+       transitionTime:(uint16_t)transitionTime
+          optionsMask:(uint8_t)optionsMask
+      optionsOverride:(uint8_t)optionsOverride
+    completionHandler:(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.MoveToColor(
+        onSuccess->Cancel(), onFailure->Cancel(), colorX, colorY, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveToColorTemperature:(uint16_t)colorTemperature
+                transitionTime:(uint16_t)transitionTime
+                   optionsMask:(uint8_t)optionsMask
+               optionsOverride:(uint8_t)optionsOverride
+             completionHandler:(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.MoveToColorTemperature(
+        onSuccess->Cancel(), onFailure->Cancel(), colorTemperature, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveToHue:(uint8_t)hue
+            direction:(uint8_t)direction
+       transitionTime:(uint16_t)transitionTime
+          optionsMask:(uint8_t)optionsMask
+      optionsOverride:(uint8_t)optionsOverride
+    completionHandler:(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.MoveToHue(
+        onSuccess->Cancel(), onFailure->Cancel(), hue, direction, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveToHueAndSaturation:(uint8_t)hue
+                    saturation:(uint8_t)saturation
+                transitionTime:(uint16_t)transitionTime
+                   optionsMask:(uint8_t)optionsMask
+               optionsOverride:(uint8_t)optionsOverride
+             completionHandler:(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.MoveToHueAndSaturation(
+        onSuccess->Cancel(), onFailure->Cancel(), hue, saturation, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)moveToSaturation:(uint8_t)saturation
+          transitionTime:(uint16_t)transitionTime
+             optionsMask:(uint8_t)optionsMask
+         optionsOverride:(uint8_t)optionsOverride
+       completionHandler:(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.MoveToSaturation(
+        onSuccess->Cancel(), onFailure->Cancel(), saturation, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)stepColor:(int16_t)stepX
+                stepY:(int16_t)stepY
+       transitionTime:(uint16_t)transitionTime
+          optionsMask:(uint8_t)optionsMask
+      optionsOverride:(uint8_t)optionsOverride
+    completionHandler:(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.StepColor(
+        onSuccess->Cancel(), onFailure->Cancel(), stepX, stepY, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)stepColorTemperature:(uint8_t)stepMode
+                    stepSize:(uint16_t)stepSize
+              transitionTime:(uint16_t)transitionTime
+     colorTemperatureMinimum:(uint16_t)colorTemperatureMinimum
+     colorTemperatureMaximum:(uint16_t)colorTemperatureMaximum
+                 optionsMask:(uint8_t)optionsMask
+             optionsOverride:(uint8_t)optionsOverride
+           completionHandler:(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.StepColorTemperature(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize,
+        transitionTime, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)stepHue:(uint8_t)stepMode
+             stepSize:(uint8_t)stepSize
+       transitionTime:(uint8_t)transitionTime
+          optionsMask:(uint8_t)optionsMask
+      optionsOverride:(uint8_t)optionsOverride
+    completionHandler:(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.StepHue(
+        onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)stepSaturation:(uint8_t)stepMode
+              stepSize:(uint8_t)stepSize
+        transitionTime:(uint8_t)transitionTime
+           optionsMask:(uint8_t)optionsMask
+       optionsOverride:(uint8_t)optionsOverride
+     completionHandler:(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.StepSaturation(
+        onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+- (void)stopMoveStep:(uint8_t)optionsMask
+      optionsOverride:(uint8_t)optionsOverride
+    completionHandler:(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.StopMoveStep(onSuccess->Cancel(), onFailure->Cancel(), optionsMask, optionsOverride);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeCurrentHue:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)configureAttributeCurrentHue:(uint16_t)minInterval
+                         maxInterval:(uint16_t)maxInterval
+                              change:(uint8_t)change
+                   completionHandler:(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.ConfigureAttributeCurrentHue(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)reportAttributeCurrentHue:(ResponseHandler)reportHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    if (!onReport) {
+        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+        return;
+    }
+
+    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentHue(onReport->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onReport;
+        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeCurrentSaturation:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributeCurrentSaturation(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)configureAttributeCurrentSaturation:(uint16_t)minInterval
+                                maxInterval:(uint16_t)maxInterval
+                                     change:(uint8_t)change
+                          completionHandler:(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.ConfigureAttributeCurrentSaturation(
+        onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)reportAttributeCurrentSaturation:(ResponseHandler)reportHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    if (!onReport) {
+        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+        return;
+    }
+
+    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentSaturation(onReport->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onReport;
+        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeRemainingTime:(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.ReadAttributeRemainingTime(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeCurrentX:(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.ReadAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)configureAttributeCurrentX:(uint16_t)minInterval
+                       maxInterval:(uint16_t)maxInterval
+                            change:(uint16_t)change
+                 completionHandler:(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.ConfigureAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)reportAttributeCurrentX:(ResponseHandler)reportHandler
+{
+    CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    if (!onReport) {
+        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+        return;
+    }
+
+    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentX(onReport->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onReport;
+        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeCurrentY:(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.ReadAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)configureAttributeCurrentY:(uint16_t)minInterval
+                       maxInterval:(uint16_t)maxInterval
+                            change:(uint16_t)change
+                 completionHandler:(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.ConfigureAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)reportAttributeCurrentY:(ResponseHandler)reportHandler
+{
+    CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    if (!onReport) {
+        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+        return;
+    }
+
+    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentY(onReport->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onReport;
+        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeDriftCompensation:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributeDriftCompensation(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeCompensationText:(ResponseHandler)completionHandler
+{
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], false);
+    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.ReadAttributeCompensationText(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeColorTemperature:(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.ReadAttributeColorTemperature(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)configureAttributeColorTemperature:(uint16_t)minInterval
+                               maxInterval:(uint16_t)maxInterval
+                                    change:(uint16_t)change
+                         completionHandler:(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.ConfigureAttributeColorTemperature(
+        onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)reportAttributeColorTemperature:(ResponseHandler)reportHandler
+{
+    CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    if (!onReport) {
+        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+        return;
+    }
+
+    CHIP_ERROR err = self.cppCluster.ReportAttributeColorTemperature(onReport->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onReport;
+        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeColorMode:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributeColorMode(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeColorControlOptions:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)writeAttributeColorControlOptions:(uint8_t)value completionHandler:(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.WriteAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel(), value);
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeNumberOfPrimaries:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributeNumberOfPrimaries(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary1X:(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.ReadAttributePrimary1X(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary1Y:(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.ReadAttributePrimary1Y(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary1Intensity:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributePrimary1Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary2X:(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.ReadAttributePrimary2X(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary2Y:(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.ReadAttributePrimary2Y(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary2Intensity:(ResponseHandler)completionHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(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.ReadAttributePrimary2Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary3X:(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.ReadAttributePrimary3X(onSuccess->Cancel(), onFailure->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributePrimary3Y:(ResponseHandler)completionHandler
+{
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2261,7 +3523,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentSaturation(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Y(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2269,12 +3531,9 @@ private:
     }
 }
 
-- (void)configureAttributeCurrentSaturation:(uint16_t)minInterval
-                                maxInterval:(uint16_t)maxInterval
-                                     change:(uint8_t)change
-                          completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributePrimary3Intensity:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2287,8 +3546,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentSaturation(
-        onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Intensity(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2296,22 +3554,7 @@ private:
     }
 }
 
-- (void)reportAttributeCurrentSaturation:(ResponseHandler)reportHandler
-{
-    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
-    if (!onReport) {
-        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentSaturation(onReport->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onReport;
-        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeRemainingTime:(ResponseHandler)completionHandler
+- (void)readAttributePrimary4X:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2326,7 +3569,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeRemainingTime(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4X(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2334,7 +3577,7 @@ private:
     }
 }
 
-- (void)readAttributeCurrentX:(ResponseHandler)completionHandler
+- (void)readAttributePrimary4Y:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2349,7 +3592,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Y(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2357,12 +3600,9 @@ private:
     }
 }
 
-- (void)configureAttributeCurrentX:(uint16_t)minInterval
-                       maxInterval:(uint16_t)maxInterval
-                            change:(uint16_t)change
-                 completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributePrimary4Intensity:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2375,8 +3615,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.ConfigureAttributeCurrentX(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Intensity(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2384,22 +3623,30 @@ private:
     }
 }
 
-- (void)reportAttributeCurrentX:(ResponseHandler)reportHandler
+- (void)readAttributePrimary5X:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
-    if (!onReport) {
-        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    if (!onSuccess) {
+        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentX(onReport->Cancel());
+    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.ReadAttributePrimary5X(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
-        delete onReport;
-        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
 
-- (void)readAttributeCurrentY:(ResponseHandler)completionHandler
+- (void)readAttributePrimary5Y:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2414,7 +3661,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Y(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2422,12 +3669,9 @@ private:
     }
 }
 
-- (void)configureAttributeCurrentY:(uint16_t)minInterval
-                       maxInterval:(uint16_t)maxInterval
-                            change:(uint16_t)change
-                 completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributePrimary5Intensity:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2440,8 +3684,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.ConfigureAttributeCurrentY(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Intensity(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2449,24 +3692,32 @@ private:
     }
 }
 
-- (void)reportAttributeCurrentY:(ResponseHandler)reportHandler
+- (void)readAttributePrimary6X:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
-    if (!onReport) {
-        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    if (!onSuccess) {
+        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentY(onReport->Cancel());
+    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.ReadAttributePrimary6X(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
-        delete onReport;
-        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
 
-- (void)readAttributeDriftCompensation:(ResponseHandler)completionHandler
+- (void)readAttributePrimary6Y:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2479,7 +3730,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeDriftCompensation(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Y(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2487,10 +3738,9 @@ private:
     }
 }
 
-- (void)readAttributeCompensationText:(ResponseHandler)completionHandler
+- (void)readAttributePrimary6Intensity:(ResponseHandler)completionHandler
 {
-    CHIPUnsupportedAttributeCallbackBridge * onSuccess
-        = new CHIPUnsupportedAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2503,7 +3753,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCompensationText(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Intensity(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2511,7 +3761,7 @@ private:
     }
 }
 
-- (void)readAttributeColorTemperature:(ResponseHandler)completionHandler
+- (void)readAttributeWhitePointX:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2526,7 +3776,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorTemperature(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2534,10 +3784,7 @@ private:
     }
 }
 
-- (void)configureAttributeColorTemperature:(uint16_t)minInterval
-                               maxInterval:(uint16_t)maxInterval
-                                    change:(uint16_t)change
-                         completionHandler:(ResponseHandler)completionHandler
+- (void)writeAttributeWhitePointX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2552,8 +3799,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ConfigureAttributeColorTemperature(
-        onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2561,24 +3807,9 @@ private:
     }
 }
 
-- (void)reportAttributeColorTemperature:(ResponseHandler)reportHandler
-{
-    CHIPInt16uAttributeCallbackBridge * onReport = new CHIPInt16uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
-    if (!onReport) {
-        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReportAttributeColorTemperature(onReport->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onReport;
-        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeColorMode:(ResponseHandler)completionHandler
+- (void)readAttributeWhitePointY:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2591,7 +3822,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorMode(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2599,9 +3830,9 @@ private:
     }
 }
 
-- (void)readAttributeColorControlOptions:(ResponseHandler)completionHandler
+- (void)writeAttributeWhitePointY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2614,7 +3845,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2622,9 +3853,9 @@ private:
     }
 }
 
-- (void)writeAttributeColorControlOptions:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointRX:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2637,7 +3868,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorControlOptions(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2645,9 +3876,9 @@ private:
     }
 }
 
-- (void)readAttributeNumberOfPrimaries:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointRX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2660,7 +3891,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeNumberOfPrimaries(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2668,7 +3899,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary1X:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointRY:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2683,7 +3914,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1X(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2691,9 +3922,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary1Y:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointRY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2706,7 +3937,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Y(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2714,7 +3945,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary1Intensity:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointRIntensity:(ResponseHandler)completionHandler
 {
     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2729,7 +3960,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary1Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2737,9 +3968,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary2X:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointRIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2752,7 +3983,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2X(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2760,7 +3991,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary2Y:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointGX:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2775,7 +4006,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Y(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2783,9 +4014,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary2Intensity:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointGX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2798,7 +4029,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary2Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2806,7 +4037,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary3X:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointGY:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2821,7 +4052,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3X(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2829,9 +4060,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary3Y:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointGY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2844,7 +4075,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Y(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2852,7 +4083,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary3Intensity:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointGIntensity:(ResponseHandler)completionHandler
 {
     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2867,7 +4098,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary3Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2875,9 +4106,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary4X:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointGIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2890,7 +4121,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4X(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2898,7 +4129,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary4Y:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointBX:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2913,7 +4144,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Y(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2921,9 +4152,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary4Intensity:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointBX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2936,7 +4167,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary4Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2944,7 +4175,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary5X:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointBY:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -2959,7 +4190,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5X(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2967,9 +4198,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary5Y:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointBY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -2982,7 +4213,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Y(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -2990,7 +4221,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary5Intensity:(ResponseHandler)completionHandler
+- (void)readAttributeColorPointBIntensity:(ResponseHandler)completionHandler
 {
     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3005,7 +4236,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary5Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3013,9 +4244,9 @@ private:
     }
 }
 
-- (void)readAttributePrimary6X:(ResponseHandler)completionHandler
+- (void)writeAttributeColorPointBIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3028,7 +4259,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6X(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3036,7 +4267,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary6Y:(ResponseHandler)completionHandler
+- (void)readAttributeEnhancedCurrentHue:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3051,7 +4282,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Y(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3059,7 +4290,7 @@ private:
     }
 }
 
-- (void)readAttributePrimary6Intensity:(ResponseHandler)completionHandler
+- (void)readAttributeEnhancedColorMode:(ResponseHandler)completionHandler
 {
     CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3074,7 +4305,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributePrimary6Intensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedColorMode(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3082,9 +4313,9 @@ private:
     }
 }
 
-- (void)readAttributeWhitePointX:(ResponseHandler)completionHandler
+- (void)readAttributeColorLoopActive:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3097,7 +4328,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopActive(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3105,9 +4336,9 @@ private:
     }
 }
 
-- (void)writeAttributeWhitePointX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeColorLoopDirection:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3120,7 +4351,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointX(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopDirection(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3128,7 +4359,7 @@ private:
     }
 }
 
-- (void)readAttributeWhitePointY:(ResponseHandler)completionHandler
+- (void)readAttributeColorLoopTime:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3143,7 +4374,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopTime(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3151,9 +4382,9 @@ private:
     }
 }
 
-- (void)writeAttributeWhitePointY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeColorCapabilities:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3166,7 +4397,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeWhitePointY(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorCapabilities(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3174,7 +4405,7 @@ private:
     }
 }
 
-- (void)readAttributeColorPointRX:(ResponseHandler)completionHandler
+- (void)readAttributeColorTempPhysicalMin:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3189,7 +4420,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMin(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3197,9 +4428,9 @@ private:
     }
 }
 
-- (void)writeAttributeColorPointRX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeColorTempPhysicalMax:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3212,7 +4443,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRX(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMax(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3220,7 +4451,7 @@ private:
     }
 }
 
-- (void)readAttributeColorPointRY:(ResponseHandler)completionHandler
+- (void)readAttributeCoupleColorTempToLevelMinMireds:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3235,7 +4466,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeCoupleColorTempToLevelMinMireds(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3243,9 +4474,9 @@ private:
     }
 }
 
-- (void)writeAttributeColorPointRY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeStartUpColorTemperatureMireds:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3258,7 +4489,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRY(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3266,9 +4497,9 @@ private:
     }
 }
 
-- (void)readAttributeColorPointRIntensity:(ResponseHandler)completionHandler
+- (void)writeAttributeStartUpColorTemperatureMireds:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3281,7 +4512,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3289,9 +4520,9 @@ private:
     }
 }
 
-- (void)writeAttributeColorPointRIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3304,7 +4535,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointRIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3312,9 +4543,23 @@ private:
     }
 }
 
-- (void)readAttributeColorPointGX:(ResponseHandler)completionHandler
+@end
+
+@interface CHIPContentLaunch ()
+@property (readonly) Controller::ContentLaunchCluster cppCluster;
+@end
+
+@implementation CHIPContentLaunch
+
+- (Controller::ClusterBase *)getCluster
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    return &_cppCluster;
+}
+
+- (void)launchContent:(ResponseHandler)completionHandler
+{
+    CHIPContentLaunchClusterLaunchContentResponseCallbackBridge * onSuccess
+        = new CHIPContentLaunchClusterLaunchContentResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3327,17 +4572,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel());
+    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)writeAttributeColorPointGX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)launchURL:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPContentLaunchClusterLaunchURLResponseCallbackBridge * onSuccess
+        = new CHIPContentLaunchClusterLaunchURLResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3350,7 +4595,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGX(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.LaunchURL(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3358,7 +4603,7 @@ private:
     }
 }
 
-- (void)readAttributeColorPointGY:(ResponseHandler)completionHandler
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -3373,7 +4618,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -3381,9 +4626,23 @@ private:
     }
 }
 
-- (void)writeAttributeColorPointGY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+@end
+
+@interface CHIPDoorLock ()
+@property (readonly) Controller::DoorLockCluster cppCluster;
+@end
+
+@implementation CHIPDoorLock
+
+- (Controller::ClusterBase *)getCluster
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    return &_cppCluster;
+}
+
+- (void)clearAllPins:(ResponseHandler)completionHandler
+{
+    CHIPDoorLockClusterClearAllPinsResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterClearAllPinsResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3396,17 +4655,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGY(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ClearAllPins(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorPointGIntensity:(ResponseHandler)completionHandler
+- (void)clearAllRfids:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3419,17 +4678,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ClearAllRfids(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)writeAttributeColorPointGIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3442,17 +4701,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointGIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ClearHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorPointBX:(ResponseHandler)completionHandler
+- (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterClearPinResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterClearPinResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3465,17 +4724,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ClearPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)writeAttributeColorPointBX:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterClearRfidResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterClearRfidResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3488,17 +4747,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBX(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ClearRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorPointBY:(ResponseHandler)completionHandler
+- (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3511,17 +4770,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ClearWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)writeAttributeColorPointBY:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)clearYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3534,17 +4793,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBY(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.ClearYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorPointBIntensity:(ResponseHandler)completionHandler
+- (void)getHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3557,17 +4816,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.GetHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)writeAttributeColorPointBIntensity:(uint8_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)getLogRecord:(uint16_t)logIndex completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterGetLogRecordResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterGetLogRecordResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3580,17 +4839,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeColorPointBIntensity(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.GetLogRecord(onSuccess->Cancel(), onFailure->Cancel(), logIndex);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeEnhancedCurrentHue:(ResponseHandler)completionHandler
+- (void)getPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterGetPinResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterGetPinResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3603,17 +4862,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedCurrentHue(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.GetPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeEnhancedColorMode:(ResponseHandler)completionHandler
+- (void)getRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterGetRfidResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterGetRfidResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3626,17 +4885,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeEnhancedColorMode(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.GetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorLoopActive:(ResponseHandler)completionHandler
+- (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterGetUserTypeResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterGetUserTypeResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3649,17 +4908,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopActive(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.GetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorLoopDirection:(ResponseHandler)completionHandler
+- (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3672,17 +4931,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopDirection(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.GetWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorLoopTime:(ResponseHandler)completionHandler
+- (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3695,17 +4954,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorLoopTime(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.GetYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorCapabilities:(ResponseHandler)completionHandler
+- (void)lockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3718,17 +4977,23 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorCapabilities(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorTempPhysicalMin:(ResponseHandler)completionHandler
+- (void)setHolidaySchedule:(uint8_t)scheduleId
+                localStartTime:(uint32_t)localStartTime
+                  localEndTime:(uint32_t)localEndTime
+    operatingModeDuringHoliday:(uint8_t)operatingModeDuringHoliday
+             completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3741,17 +5006,22 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMin(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.SetHolidaySchedule(
+        onSuccess->Cancel(), onFailure->Cancel(), scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeColorTempPhysicalMax:(ResponseHandler)completionHandler
+- (void)setPin:(uint16_t)userId
+           userStatus:(uint8_t)userStatus
+             userType:(uint8_t)userType
+                  pin:(NSString *)pin
+    completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterSetPinResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterSetPinResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3764,17 +5034,23 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeColorTempPhysicalMax(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeCoupleColorTempToLevelMinMireds:(ResponseHandler)completionHandler
+- (void)setRfid:(uint16_t)userId
+           userStatus:(uint8_t)userStatus
+             userType:(uint8_t)userType
+                   id:(NSString *)id
+    completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterSetRfidResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterSetRfidResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3787,17 +5063,19 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCoupleColorTempToLevelMinMireds(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType,
+        chip::ByteSpan((const uint8_t *) [id dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeStartUpColorTemperatureMireds:(ResponseHandler)completionHandler
+- (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterSetUserTypeResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterSetUserTypeResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3810,17 +5088,24 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.SetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId, userType);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)writeAttributeStartUpColorTemperatureMireds:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+- (void)setWeekdaySchedule:(uint8_t)scheduleId
+                    userId:(uint16_t)userId
+                  daysMask:(uint8_t)daysMask
+                 startHour:(uint8_t)startHour
+               startMinute:(uint8_t)startMinute
+                   endHour:(uint8_t)endHour
+                 endMinute:(uint8_t)endMinute
+         completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3833,17 +5118,22 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeStartUpColorTemperatureMireds(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.SetWeekdaySchedule(
+        onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, daysMask, startHour, startMinute, endHour, endMinute);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
+- (void)setYeardaySchedule:(uint8_t)scheduleId
+                    userId:(uint16_t)userId
+            localStartTime:(uint32_t)localStartTime
+              localEndTime:(uint32_t)localEndTime
+         completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3856,31 +5146,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.SetYeardaySchedule(
+        onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, localStartTime, localEndTime);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-@end
-
-@interface CHIPDoorLock ()
-@property (readonly) Controller::DoorLockCluster cppCluster;
-@end
-
-@implementation CHIPDoorLock
-
-- (Controller::ClusterBase *)getCluster
-{
-    return &_cppCluster;
-}
-
-- (void)clearAllPins:(ResponseHandler)completionHandler
+- (void)unlockDoor:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterClearAllPinsResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterClearAllPinsResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3893,17 +5170,19 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ClearAllPins(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)clearAllRfids:(ResponseHandler)completionHandler
+- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(NSString *)pin completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterClearAllRfidsResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge * onSuccess
+        = new CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3916,17 +5195,19 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ClearAllRfids(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds,
+        chip::ByteSpan((const uint8_t *) [pin dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [pin lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)clearHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeLockState:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterClearHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3939,17 +5220,19 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ClearHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeLockState(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)clearPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+
+- (void)configureAttributeLockState:(uint16_t)minInterval
+                        maxInterval:(uint16_t)maxInterval
+                  completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterClearPinResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterClearPinResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -3962,40 +5245,33 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ClearPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
+    CHIP_ERROR err
+        = self.cppCluster.ConfigureAttributeLockState(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)clearRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
-{
-    CHIPDoorLockClusterClearRfidResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterClearRfidResponseCallbackBridge(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);
+- (void)reportAttributeLockState:(ResponseHandler)reportHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    if (!onReport) {
+        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ClearRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
+    CHIP_ERROR err = self.cppCluster.ReportAttributeLockState(onReport->Cancel());
     if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
+        delete onReport;
+        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)clearWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeLockType:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterClearWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4008,17 +5284,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ClearWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeLockType(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)clearYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeActuatorEnabled:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterClearYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPBooleanAttributeCallbackBridge * onSuccess
+        = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4031,17 +5308,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ClearYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeActuatorEnabled(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getHolidaySchedule:(uint8_t)scheduleId completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4054,17 +5331,34 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetHolidaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getLogRecord:(uint16_t)logIndex completionHandler:(ResponseHandler)completionHandler
+
+@end
+
+@interface CHIPGeneralCommissioning ()
+@property (readonly) Controller::GeneralCommissioningCluster cppCluster;
+@end
+
+@implementation CHIPGeneralCommissioning
+
+- (Controller::ClusterBase *)getCluster
 {
-    CHIPDoorLockClusterGetLogRecordResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterGetLogRecordResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    return &_cppCluster;
+}
+
+- (void)armFailSafe:(uint16_t)expiryLengthSeconds
+           breadcrumb:(uint64_t)breadcrumb
+            timeoutMs:(uint32_t)timeoutMs
+    completionHandler:(ResponseHandler)completionHandler
+{
+    CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge * onSuccess
+        = new CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4077,17 +5371,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetLogRecord(onSuccess->Cancel(), onFailure->Cancel(), logIndex);
+    CHIP_ERROR err
+        = self.cppCluster.ArmFailSafe(onSuccess->Cancel(), onFailure->Cancel(), expiryLengthSeconds, breadcrumb, timeoutMs);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getPin:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+- (void)commissioningComplete:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterGetPinResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterGetPinResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge * onSuccess
+        = new CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4100,17 +5395,21 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetPin(onSuccess->Cancel(), onFailure->Cancel(), userId);
+    CHIP_ERROR err = self.cppCluster.CommissioningComplete(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getRfid:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+- (void)setFabric:(NSData *)fabricId
+         fabricSecret:(NSData *)fabricSecret
+           breadcrumb:(uint64_t)breadcrumb
+            timeoutMs:(uint32_t)timeoutMs
+    completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterGetRfidResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterGetRfidResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge * onSuccess
+        = new CHIPGeneralCommissioningClusterSetFabricResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4123,17 +5422,20 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId);
+    CHIP_ERROR err = self.cppCluster.SetFabric(onSuccess->Cancel(), onFailure->Cancel(),
+        chip::ByteSpan((const uint8_t *) fabricId.bytes, fabricId.length),
+        chip::ByteSpan((const uint8_t *) fabricSecret.bytes, fabricSecret.length), breadcrumb, timeoutMs);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getUserType:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeFabricId:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterGetUserTypeResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterGetUserTypeResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPStringAttributeCallbackBridge * onSuccess
+        = new CHIPStringAttributeCallbackBridge(completionHandler, [self callbackQueue], true);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4146,17 +5448,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeFabricId(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getWeekdaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeBreadcrumb:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterGetWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt64uAttributeCallbackBridge * onSuccess = new CHIPInt64uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4169,17 +5471,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetWeekdaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeBreadcrumb(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getYeardaySchedule:(uint8_t)scheduleId userId:(uint16_t)userId completionHandler:(ResponseHandler)completionHandler
+
+- (void)writeAttributeBreadcrumb:(uint64_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterGetYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4192,17 +5494,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetYeardaySchedule(onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId);
+    CHIP_ERROR err = self.cppCluster.WriteAttributeBreadcrumb(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)lockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterLockDoorResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterLockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4215,21 +5517,31 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.LockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)setHolidaySchedule:(uint8_t)scheduleId
-                localStartTime:(uint32_t)localStartTime
-                  localEndTime:(uint32_t)localEndTime
-    operatingModeDuringHoliday:(uint8_t)operatingModeDuringHoliday
-             completionHandler:(ResponseHandler)completionHandler
+
+@end
+
+@interface CHIPGroups ()
+@property (readonly) Controller::GroupsCluster cppCluster;
+@end
+
+@implementation CHIPGroups
+
+- (Controller::ClusterBase *)getCluster
 {
-    CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterSetHolidayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    return &_cppCluster;
+}
+
+- (void)addGroup:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
+{
+    CHIPGroupsClusterAddGroupResponseCallbackBridge * onSuccess
+        = new CHIPGroupsClusterAddGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4242,22 +5554,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetHolidaySchedule(
-        onSuccess->Cancel(), onFailure->Cancel(), scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday);
+    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)setPin:(uint16_t)userId
-           userStatus:(uint8_t)userStatus
-             userType:(uint8_t)userType
-                  pin:(char *)pin
-    completionHandler:(ResponseHandler)completionHandler
+- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(NSString *)groupName completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterSetPinResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterSetPinResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4270,21 +5578,19 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetPin(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, pin);
+    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId,
+        chip::ByteSpan((const uint8_t *) [groupName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [groupName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]));
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)setRfid:(uint16_t)userId
-           userStatus:(uint8_t)userStatus
-             userType:(uint8_t)userType
-                   id:(char *)id
-    completionHandler:(ResponseHandler)completionHandler
+- (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterSetRfidResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterSetRfidResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge * onSuccess
+        = new CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4297,17 +5603,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetRfid(onSuccess->Cancel(), onFailure->Cancel(), userId, userStatus, userType, id);
+    CHIP_ERROR err = self.cppCluster.GetGroupMembership(onSuccess->Cancel(), onFailure->Cancel(), groupCount, groupList);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)setUserType:(uint16_t)userId userType:(uint8_t)userType completionHandler:(ResponseHandler)completionHandler
+- (void)removeAllGroups:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterSetUserTypeResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterSetUserTypeResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4320,24 +5625,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetUserType(onSuccess->Cancel(), onFailure->Cancel(), userId, userType);
+    CHIP_ERROR err = self.cppCluster.RemoveAllGroups(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)setWeekdaySchedule:(uint8_t)scheduleId
-                    userId:(uint16_t)userId
-                  daysMask:(uint8_t)daysMask
-                 startHour:(uint8_t)startHour
-               startMinute:(uint8_t)startMinute
-                   endHour:(uint8_t)endHour
-                 endMinute:(uint8_t)endMinute
-         completionHandler:(ResponseHandler)completionHandler
+- (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterSetWeekdayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPGroupsClusterRemoveGroupResponseCallbackBridge * onSuccess
+        = new CHIPGroupsClusterRemoveGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4350,22 +5648,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetWeekdaySchedule(
-        onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, daysMask, startHour, startMinute, endHour, endMinute);
+    CHIP_ERROR err = self.cppCluster.RemoveGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)setYeardaySchedule:(uint8_t)scheduleId
-                    userId:(uint16_t)userId
-            localStartTime:(uint32_t)localStartTime
-              localEndTime:(uint32_t)localEndTime
-         completionHandler:(ResponseHandler)completionHandler
+- (void)viewGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterSetYeardayScheduleResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPGroupsClusterViewGroupResponseCallbackBridge * onSuccess
+        = new CHIPGroupsClusterViewGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4378,18 +5671,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.SetYeardaySchedule(
-        onSuccess->Cancel(), onFailure->Cancel(), scheduleId, userId, localStartTime, localEndTime);
+    CHIP_ERROR err = self.cppCluster.ViewGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockDoor:(char *)pin completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeNameSupport:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterUnlockDoorResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterUnlockDoorResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4402,17 +5694,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockDoor(onSuccess->Cancel(), onFailure->Cancel(), pin);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)unlockWithTimeout:(uint16_t)timeoutInSeconds pin:(char *)pin completionHandler:(ResponseHandler)completionHandler
+
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
-    CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge * onSuccess
-        = new CHIPDoorLockClusterUnlockWithTimeoutResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4425,7 +5717,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.UnlockWithTimeout(onSuccess->Cancel(), onFailure->Cancel(), timeoutInSeconds, pin);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4433,9 +5725,22 @@ private:
     }
 }
 
-- (void)readAttributeLockState:(ResponseHandler)completionHandler
+@end
+
+@interface CHIPIdentify ()
+@property (readonly) Controller::IdentifyCluster cppCluster;
+@end
+
+@implementation CHIPIdentify
+
+- (Controller::ClusterBase *)getCluster
+{
+    return &_cppCluster;
+}
+
+- (void)identify:(uint16_t)identifyTime completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4448,19 +5753,17 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeLockState(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.Identify(onSuccess->Cancel(), onFailure->Cancel(), identifyTime);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)configureAttributeLockState:(uint16_t)minInterval
-                        maxInterval:(uint16_t)maxInterval
-                  completionHandler:(ResponseHandler)completionHandler
+- (void)identifyQuery:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge * onSuccess
+        = new CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4473,8 +5776,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.ConfigureAttributeLockState(onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval);
+    CHIP_ERROR err = self.cppCluster.IdentifyQuery(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4482,24 +5784,9 @@ private:
     }
 }
 
-- (void)reportAttributeLockState:(ResponseHandler)reportHandler
-{
-    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
-    if (!onReport) {
-        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReportAttributeLockState(onReport->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onReport;
-        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeLockType:(ResponseHandler)completionHandler
+- (void)readAttributeIdentifyTime:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4512,7 +5799,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeLockType(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4520,10 +5807,9 @@ private:
     }
 }
 
-- (void)readAttributeActuatorEnabled:(ResponseHandler)completionHandler
+- (void)writeAttributeIdentifyTime:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPBooleanAttributeCallbackBridge * onSuccess
-        = new CHIPBooleanAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4536,7 +5822,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeActuatorEnabled(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.WriteAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel(), value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4569,21 +5855,24 @@ private:
 
 @end
 
-@interface CHIPGroups ()
-@property (readonly) Controller::GroupsCluster cppCluster;
+@interface CHIPLevelControl ()
+@property (readonly) Controller::LevelControlCluster cppCluster;
 @end
 
-@implementation CHIPGroups
+@implementation CHIPLevelControl
 
 - (Controller::ClusterBase *)getCluster
 {
     return &_cppCluster;
 }
 
-- (void)addGroup:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)move:(uint8_t)moveMode
+                 rate:(uint8_t)rate
+           optionMask:(uint8_t)optionMask
+       optionOverride:(uint8_t)optionOverride
+    completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPGroupsClusterAddGroupResponseCallbackBridge * onSuccess
-        = new CHIPGroupsClusterAddGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4596,14 +5885,18 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err = self.cppCluster.Move(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionMask, optionOverride);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)addGroupIfIdentifying:(uint16_t)groupId groupName:(char *)groupName completionHandler:(ResponseHandler)completionHandler
+- (void)moveToLevel:(uint8_t)level
+       transitionTime:(uint16_t)transitionTime
+           optionMask:(uint8_t)optionMask
+       optionOverride:(uint8_t)optionOverride
+    completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4618,17 +5911,19 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddGroupIfIdentifying(onSuccess->Cancel(), onFailure->Cancel(), groupId, groupName);
+    CHIP_ERROR err
+        = self.cppCluster.MoveToLevel(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime, optionMask, optionOverride);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)getGroupMembership:(uint8_t)groupCount groupList:(uint16_t)groupList completionHandler:(ResponseHandler)completionHandler
+- (void)moveToLevelWithOnOff:(uint8_t)level
+              transitionTime:(uint16_t)transitionTime
+           completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge * onSuccess
-        = new CHIPGroupsClusterGetGroupMembershipResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4641,14 +5936,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.GetGroupMembership(onSuccess->Cancel(), onFailure->Cancel(), groupCount, groupList);
+    CHIP_ERROR err = self.cppCluster.MoveToLevelWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)removeAllGroups:(ResponseHandler)completionHandler
+- (void)moveWithOnOff:(uint8_t)moveMode rate:(uint8_t)rate completionHandler:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4663,17 +5958,21 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.RemoveAllGroups(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.MoveWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)removeGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
+- (void)step:(uint8_t)stepMode
+             stepSize:(uint8_t)stepSize
+       transitionTime:(uint16_t)transitionTime
+           optionMask:(uint8_t)optionMask
+       optionOverride:(uint8_t)optionOverride
+    completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPGroupsClusterRemoveGroupResponseCallbackBridge * onSuccess
-        = new CHIPGroupsClusterRemoveGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4686,17 +5985,20 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.RemoveGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
+    CHIP_ERROR err = self.cppCluster.Step(
+        onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionMask, optionOverride);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)viewGroup:(uint16_t)groupId completionHandler:(ResponseHandler)completionHandler
+- (void)stepWithOnOff:(uint8_t)stepMode
+             stepSize:(uint8_t)stepSize
+       transitionTime:(uint16_t)transitionTime
+    completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPGroupsClusterViewGroupResponseCallbackBridge * onSuccess
-        = new CHIPGroupsClusterViewGroupResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4709,17 +6011,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ViewGroup(onSuccess->Cancel(), onFailure->Cancel(), groupId);
+    CHIP_ERROR err = self.cppCluster.StepWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeNameSupport:(ResponseHandler)completionHandler
+- (void)stop:(uint8_t)optionMask optionOverride:(uint8_t)optionOverride completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4732,17 +6033,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeNameSupport(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.Stop(onSuccess->Cancel(), onFailure->Cancel(), optionMask, optionOverride);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
+- (void)stopWithOnOff:(ResponseHandler)completionHandler
 {
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4755,7 +6055,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.StopWithOnOff(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4763,22 +6063,9 @@ private:
     }
 }
 
-@end
-
-@interface CHIPIdentify ()
-@property (readonly) Controller::IdentifyCluster cppCluster;
-@end
-
-@implementation CHIPIdentify
-
-- (Controller::ClusterBase *)getCluster
-{
-    return &_cppCluster;
-}
-
-- (void)identify:(uint16_t)identifyTime completionHandler:(ResponseHandler)completionHandler
+- (void)readAttributeCurrentLevel:(ResponseHandler)completionHandler
 {
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4791,17 +6078,20 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.Identify(onSuccess->Cancel(), onFailure->Cancel(), identifyTime);
+    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentLevel(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
         completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
-- (void)identifyQuery:(ResponseHandler)completionHandler
+
+- (void)configureAttributeCurrentLevel:(uint16_t)minInterval
+                           maxInterval:(uint16_t)maxInterval
+                                change:(uint8_t)change
+                     completionHandler:(ResponseHandler)completionHandler
 {
-    CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge * onSuccess
-        = new CHIPIdentifyClusterIdentifyQueryResponseCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -4814,7 +6104,8 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.IdentifyQuery(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentLevel(
+        onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4822,7 +6113,22 @@ private:
     }
 }
 
-- (void)readAttributeIdentifyTime:(ResponseHandler)completionHandler
+- (void)reportAttributeCurrentLevel:(ResponseHandler)reportHandler
+{
+    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
+    if (!onReport) {
+        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+        return;
+    }
+
+    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentLevel(onReport->Cancel());
+    if (err != CHIP_NO_ERROR) {
+        delete onReport;
+        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+    }
+}
+
+- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
 {
     CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4837,7 +6143,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel());
+    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4845,7 +6151,20 @@ private:
     }
 }
 
-- (void)writeAttributeIdentifyTime:(uint16_t)value completionHandler:(ResponseHandler)completionHandler
+@end
+
+@interface CHIPLowPower ()
+@property (readonly) Controller::LowPowerCluster cppCluster;
+@end
+
+@implementation CHIPLowPower
+
+- (Controller::ClusterBase *)getCluster
+{
+    return &_cppCluster;
+}
+
+- (void)sleep:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4860,7 +6179,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.WriteAttributeIdentifyTime(onSuccess->Cancel(), onFailure->Cancel(), value);
+    CHIP_ERROR err = self.cppCluster.Sleep(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -4893,22 +6212,18 @@ private:
 
 @end
 
-@interface CHIPLevelControl ()
-@property (readonly) Controller::LevelControlCluster cppCluster;
+@interface CHIPMediaPlayback ()
+@property (readonly) Controller::MediaPlaybackCluster cppCluster;
 @end
 
-@implementation CHIPLevelControl
+@implementation CHIPMediaPlayback
 
 - (Controller::ClusterBase *)getCluster
 {
     return &_cppCluster;
 }
 
-- (void)move:(uint8_t)moveMode
-                 rate:(uint8_t)rate
-           optionMask:(uint8_t)optionMask
-       optionOverride:(uint8_t)optionOverride
-    completionHandler:(ResponseHandler)completionHandler
+- (void)fastForwardRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4923,18 +6238,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.Move(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate, optionMask, optionOverride);
+    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)moveToLevel:(uint8_t)level
-       transitionTime:(uint16_t)transitionTime
-           optionMask:(uint8_t)optionMask
-       optionOverride:(uint8_t)optionOverride
-    completionHandler:(ResponseHandler)completionHandler
+- (void)nextRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4949,17 +6260,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err
-        = self.cppCluster.MoveToLevel(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime, optionMask, optionOverride);
+    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)moveToLevelWithOnOff:(uint8_t)level
-              transitionTime:(uint16_t)transitionTime
-           completionHandler:(ResponseHandler)completionHandler
+- (void)pauseRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4974,14 +6282,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveToLevelWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), level, transitionTime);
+    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)moveWithOnOff:(uint8_t)moveMode rate:(uint8_t)rate completionHandler:(ResponseHandler)completionHandler
+- (void)playRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -4996,19 +6304,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.MoveWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), moveMode, rate);
+    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)step:(uint8_t)stepMode
-             stepSize:(uint8_t)stepSize
-       transitionTime:(uint16_t)transitionTime
-           optionMask:(uint8_t)optionMask
-       optionOverride:(uint8_t)optionOverride
-    completionHandler:(ResponseHandler)completionHandler
+- (void)previousRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -5023,18 +6326,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.Step(
-        onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime, optionMask, optionOverride);
+    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)stepWithOnOff:(uint8_t)stepMode
-             stepSize:(uint8_t)stepSize
-       transitionTime:(uint16_t)transitionTime
-    completionHandler:(ResponseHandler)completionHandler
+- (void)rewindRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -5049,14 +6348,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.StepWithOnOff(onSuccess->Cancel(), onFailure->Cancel(), stepMode, stepSize, transitionTime);
+    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)stop:(uint8_t)optionMask optionOverride:(uint8_t)optionOverride completionHandler:(ResponseHandler)completionHandler
+- (void)skipBackwardRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -5071,14 +6370,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.Stop(onSuccess->Cancel(), onFailure->Cancel(), optionMask, optionOverride);
+    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)stopWithOnOff:(ResponseHandler)completionHandler
+- (void)skipForwardRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -5093,17 +6392,16 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.StopWithOnOff(onSuccess->Cancel(), onFailure->Cancel());
+    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)readAttributeCurrentLevel:(ResponseHandler)completionHandler
+- (void)startOverRequest:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
         completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
@@ -5116,18 +6414,14 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentLevel(onSuccess->Cancel(), onFailure->Cancel());
+    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)configureAttributeCurrentLevel:(uint16_t)minInterval
-                           maxInterval:(uint16_t)maxInterval
-                                change:(uint8_t)change
-                     completionHandler:(ResponseHandler)completionHandler
+- (void)stopRequest:(ResponseHandler)completionHandler
 {
     CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
     if (!onSuccess) {
@@ -5142,8 +6436,7 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ConfigureAttributeCurrentLevel(
-        onSuccess->Cancel(), onFailure->Cancel(), minInterval, maxInterval, change);
+    CHIP_ERROR err = self.cppCluster.StopRequest(onSuccess->Cancel(), onFailure->Cancel());
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
@@ -5151,18 +6444,26 @@ private:
     }
 }
 
-- (void)reportAttributeCurrentLevel:(ResponseHandler)reportHandler
+- (void)readAttributeCurrentState:(ResponseHandler)completionHandler
 {
-    CHIPInt8uAttributeCallbackBridge * onReport = new CHIPInt8uAttributeCallbackBridge(reportHandler, [self callbackQueue], true);
-    if (!onReport) {
-        reportHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
+    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
+    if (!onSuccess) {
+        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.ReportAttributeCurrentLevel(onReport->Cancel());
+    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 onReport;
-        reportHandler([CHIPError errorForCHIPErrorCode:err], nil);
+        delete onSuccess;
+        delete onFailure;
+        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
     }
 }
 
@@ -5373,7 +6674,7 @@ private:
 - (void)addScene:(uint16_t)groupId
               sceneId:(uint8_t)sceneId
        transitionTime:(uint16_t)transitionTime
-            sceneName:(char *)sceneName
+            sceneName:(NSString *)sceneName
             clusterId:(uint16_t)clusterId
                length:(uint8_t)length
                 value:(uint8_t)value
@@ -5393,8 +6694,10 @@ private:
         return;
     }
 
-    CHIP_ERROR err = self.cppCluster.AddScene(
-        onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime, sceneName, clusterId, length, value);
+    CHIP_ERROR err = self.cppCluster.AddScene(onSuccess->Cancel(), onFailure->Cancel(), groupId, sceneId, transitionTime,
+        chip::ByteSpan((const uint8_t *) [sceneName dataUsingEncoding:NSUTF8StringEncoding].bytes,
+            [sceneName lengthOfBytesUsingEncoding:NSUTF8StringEncoding]),
+        clusterId, length, value);
     if (err != CHIP_NO_ERROR) {
         delete onSuccess;
         delete onFailure;
index 047d74d..34ae580 100644 (file)
@@ -39,6 +39,77 @@ 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)
@@ -771,6 +842,115 @@ void DispatchClientCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace DoorLock
 
+namespace GeneralCommissioning {
+
+void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
+{
+    {
+        switch (commandId)
+        {
+        case ZCL_ARM_FAIL_SAFE_RESPONSE_COMMAND_ID: {
+            CHIP_ERROR TLVError = CHIP_NO_ERROR;
+            uint8_t errorCode;
+            const uint8_t * debugText;
+
+            while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
+            {
+                switch (TLV::TagNumFromTag(dataTlv.GetTag()))
+                {
+                case 0:
+                    TLVError = dataTlv.Get(errorCode);
+                    break;
+                case 1:
+                    TLVError = dataTlv.GetDataPtr(debugText);
+                    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.
+            emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(errorCode, const_cast<uint8_t *>(debugText));
+            break;
+        }
+        case ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID: {
+            CHIP_ERROR TLVError = CHIP_NO_ERROR;
+            uint8_t errorCode;
+            const uint8_t * debugText;
+
+            while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
+            {
+                switch (TLV::TagNumFromTag(dataTlv.GetTag()))
+                {
+                case 0:
+                    TLVError = dataTlv.Get(errorCode);
+                    break;
+                case 1:
+                    TLVError = dataTlv.GetDataPtr(debugText);
+                    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.
+            emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(errorCode, const_cast<uint8_t *>(debugText));
+            break;
+        }
+        case ZCL_SET_FABRIC_RESPONSE_COMMAND_ID: {
+            CHIP_ERROR TLVError = CHIP_NO_ERROR;
+            uint8_t errorCode;
+            const uint8_t * debugText;
+
+            while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
+            {
+                switch (TLV::TagNumFromTag(dataTlv.GetTag()))
+                {
+                case 0:
+                    TLVError = dataTlv.Get(errorCode);
+                    break;
+                case 1:
+                    TLVError = dataTlv.GetDataPtr(debugText);
+                    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.
+            emberAfGeneralCommissioningClusterSetFabricResponseCallback(errorCode, const_cast<uint8_t *>(debugText));
+            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_GENERAL_COMMISSIONING_CLUSTER_ID);
+            break;
+        }
+        }
+    }
+}
+
+} // namespace GeneralCommissioning
+
 namespace Groups {
 
 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -964,6 +1144,30 @@ 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 3ab0310..8c8757f 100644 (file)
 #define ZCL_REPORTING_STATUS_CLIENT_ATTRIBUTE_ID (0xFFFE)
 #define ZCL_REPORTING_STATUS_SERVER_ATTRIBUTE_ID (0xFFFE)
 
-// Attribute ids for cluster: Basic
-
-// Client attributes
-
-// Server attributes
-#define ZCL_VERSION_ATTRIBUTE_ID (0x0000)
-#define ZCL_APPLICATION_VERSION_ATTRIBUTE_ID (0x0001)
-#define ZCL_STACK_VERSION_ATTRIBUTE_ID (0x0002)
-#define ZCL_HW_VERSION_ATTRIBUTE_ID (0x0003)
-#define ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID (0x0004)
-#define ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID (0x0005)
-#define ZCL_DATE_CODE_ATTRIBUTE_ID (0x0006)
-#define ZCL_POWER_SOURCE_ATTRIBUTE_ID (0x0007)
-#define ZCL_GENERIC_DEVICE_CLASS_ATTRIBUTE_ID (0x0008)
-#define ZCL_GENERIC_DEVICE_TYPE_ATTRIBUTE_ID (0x0009)
-#define ZCL_PRODUCT_CODE_ATTRIBUTE_ID (0x000A)
-#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000B)
-#define ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID (0x0010)
-#define ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID (0x0011)
-#define ZCL_DEVICE_ENABLED_ATTRIBUTE_ID (0x0012)
-#define ZCL_ALARM_MASK_ATTRIBUTE_ID (0x0013)
-#define ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID (0x0014)
-#define ZCL_SW_BUILD_ID_ATTRIBUTE_ID (0x4000)
-
 // Attribute ids for cluster: Power Configuration
 
 // Client attributes
 #define ZCL_KEEPALIVE_BASE_ATTRIBUTE_ID (0x0000)
 #define ZCL_KEEPALIVE_JITTER_ATTRIBUTE_ID (0x0001)
 
+// Attribute ids for cluster: Basic
+
+// Client attributes
+
+// Server attributes
+#define ZCL_INTERACTION_MODEL_VERSION_ATTRIBUTE_ID (0x0000)
+#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0001)
+#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0002)
+#define ZCL_PRODUCT_NAME_ATTRIBUTE_ID (0x0003)
+#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0004)
+#define ZCL_USER_LABEL_ATTRIBUTE_ID (0x0005)
+#define ZCL_LOCATION_ATTRIBUTE_ID (0x0006)
+#define ZCL_HARDWARE_VERSION_ATTRIBUTE_ID (0x0007)
+#define ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID (0x0008)
+#define ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID (0x0009)
+#define ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID (0x000A)
+#define ZCL_MANUFACTURING_DATE_ATTRIBUTE_ID (0x000B)
+#define ZCL_PART_NUMBER_ATTRIBUTE_ID (0x000C)
+#define ZCL_PRODUCT_URL_ATTRIBUTE_ID (0x000D)
+#define ZCL_PRODUCT_LABEL_ATTRIBUTE_ID (0x000E)
+#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x000F)
+#define ZCL_LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID (0x0010)
+
 // Attribute ids for cluster: General Commissioning
 
 // Client attributes
 // Client attributes
 
 // Server attributes
-#define ZCL_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
-#define ZCL_VENDOR_ID_ATTRIBUTE_ID (0x0001)
+#define ZCL_APPLICATION_VENDOR_NAME_ATTRIBUTE_ID (0x0000)
+#define ZCL_APPLICATION_VENDOR_ID_ATTRIBUTE_ID (0x0001)
 #define ZCL_APPLICATION_NAME_ATTRIBUTE_ID (0x0002)
-#define ZCL_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
+#define ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID (0x0003)
 #define ZCL_APPLICATION_ID_ATTRIBUTE_ID (0x0005)
 #define ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID (0x0006)
 #define ZCL_APPLICATION_STATUS_ATTRIBUTE_ID (0x0007)
 #define ZCL_PRICE_TRAILING_DIGIT_ATTRIBUTE_ID (0x0021)
 #define ZCL_PRICE_ATTRIBUTE_ID (0x0022)
 #define ZCL_GOOD_ID_ATTRIBUTE_ID (0x0030)
-#define ZCL_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
+#define ZCL_PAYMENT_SERIAL_NUMBER_ATTRIBUTE_ID (0x0031)
 #define ZCL_PAYMENT_TIMESTAMP_ATTRIBUTE_ID (0x0032)
 #define ZCL_TRANS_ID_ATTRIBUTE_ID (0x0033)
 #define ZCL_TRANS_STATUS_ATTRIBUTE_ID (0x0034)
index ed3fae9..560795f 100644 (file)
 
 using namespace chip;
 
+EmberAfStatus emberAfApplicationBasicClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfBarrierControlClusterClientCommandParse(EmberAfClusterCommand * cmd);
 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);
@@ -69,6 +74,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
     {
         switch (cmd->apsFrame->clusterId)
         {
+        case ZCL_APPLICATION_BASIC_CLUSTER_ID:
+            // No commands are enabled for cluster Application Basic
+            result = status(false, true, cmd->mfgSpecific);
+            break;
         case ZCL_BARRIER_CONTROL_CLUSTER_ID:
             // No commands are enabled for cluster Barrier Control
             result = status(false, true, cmd->mfgSpecific);
@@ -85,9 +94,15 @@ 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;
+        case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
+            result = emberAfGeneralCommissioningClusterClientCommandParse(cmd);
+            break;
         case ZCL_GROUPS_CLUSTER_ID:
             result = emberAfGroupsClusterClientCommandParse(cmd);
             break;
@@ -98,6 +113,13 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
             // No commands are enabled for cluster Level Control
             result = status(false, true, cmd->mfgSpecific);
             break;
+        case ZCL_LOW_POWER_CLUSTER_ID:
+            // 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);
@@ -129,6 +151,48 @@ 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;
@@ -644,6 +708,82 @@ EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * c
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
+EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd)
+{
+    bool wasHandled = false;
+
+    if (!cmd->mfgSpecific)
+    {
+        switch (cmd->commandId)
+        {
+        case ZCL_ARM_FAIL_SAFE_RESPONSE_COMMAND_ID: {
+            uint16_t payloadOffset = cmd->payloadStartIndex;
+            uint8_t errorCode;
+            uint8_t * debugText;
+
+            if (cmd->bufLen < payloadOffset + 1)
+            {
+                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
+            }
+            errorCode     = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
+            payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
+            if (cmd->bufLen < payloadOffset + 1u)
+            {
+                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
+            }
+            debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen);
+
+            wasHandled = emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(errorCode, debugText);
+            break;
+        }
+        case ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID: {
+            uint16_t payloadOffset = cmd->payloadStartIndex;
+            uint8_t errorCode;
+            uint8_t * debugText;
+
+            if (cmd->bufLen < payloadOffset + 1)
+            {
+                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
+            }
+            errorCode     = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
+            payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
+            if (cmd->bufLen < payloadOffset + 1u)
+            {
+                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
+            }
+            debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen);
+
+            wasHandled = emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(errorCode, debugText);
+            break;
+        }
+        case ZCL_SET_FABRIC_RESPONSE_COMMAND_ID: {
+            uint16_t payloadOffset = cmd->payloadStartIndex;
+            uint8_t errorCode;
+            uint8_t * debugText;
+
+            if (cmd->bufLen < payloadOffset + 1)
+            {
+                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
+            }
+            errorCode     = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
+            payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
+            if (cmd->bufLen < payloadOffset + 1u)
+            {
+                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
+            }
+            debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen);
+
+            wasHandled = emberAfGeneralCommissioningClusterSetFabricResponseCallback(errorCode, debugText);
+            break;
+        }
+        default: {
+            // Unrecognized command ID, error status will apply.
+            break;
+        }
+        }
+    }
+    return status(wasHandled, true, cmd->mfgSpecific);
+}
 EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
@@ -779,6 +919,26 @@ 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 c5dde30..a3ba440 100644 (file)
@@ -27,6 +27,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
 {
     switch (clusterId)
     {
+    case ZCL_APPLICATION_BASIC_CLUSTER_ID:
+        emberAfApplicationBasicClusterInitCallback(endpoint);
+        break;
     case ZCL_BARRIER_CONTROL_CLUSTER_ID:
         emberAfBarrierControlClusterInitCallback(endpoint);
         break;
@@ -39,9 +42,15 @@ 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;
+    case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
+        emberAfGeneralCommissioningClusterInitCallback(endpoint);
+        break;
     case ZCL_GROUPS_CLUSTER_ID:
         emberAfGroupsClusterInitCallback(endpoint);
         break;
@@ -51,6 +60,12 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_LEVEL_CONTROL_CLUSTER_ID:
         emberAfLevelControlClusterInitCallback(endpoint);
         break;
+    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;
@@ -66,6 +81,11 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     }
 }
 
+void __attribute__((weak)) emberAfApplicationBasicClusterInitCallback(EndpointId endpoint)
+{
+    // To prevent warning
+    (void) endpoint;
+}
 void __attribute__((weak)) emberAfBarrierControlClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
@@ -86,11 +106,21 @@ 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
     (void) endpoint;
 }
+void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(EndpointId endpoint)
+{
+    // To prevent warning
+    (void) endpoint;
+}
 void __attribute__((weak)) emberAfGroupsClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
@@ -106,6 +136,16 @@ void __attribute__((weak)) emberAfLevelControlClusterInitCallback(EndpointId end
     // To prevent warning
     (void) endpoint;
 }
+void __attribute__((weak)) emberAfLowPowerClusterInitCallback(EndpointId endpoint)
+{
+    // 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 9dc9bcf..37b17a3 100644 (file)
@@ -37,6 +37,14 @@ void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clust
 
 // Cluster Init Functions
 
+/** @brief Application Basic Cluster Init
+ *
+ * Cluster Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfApplicationBasicClusterInitCallback(chip::EndpointId endpoint);
+
 /** @brief Barrier Control Cluster Init
  *
  * Cluster Init
@@ -69,6 +77,14 @@ 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
@@ -77,6 +93,14 @@ void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfDoorLockClusterInitCallback(chip::EndpointId endpoint);
 
+/** @brief General Commissioning Cluster Init
+ *
+ * Cluster Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfGeneralCommissioningClusterInitCallback(chip::EndpointId endpoint);
+
 /** @brief Groups Cluster Init
  *
  * Cluster Init
@@ -101,6 +125,22 @@ void emberAfIdentifyClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
 
+/** @brief Low Power Cluster Init
+ *
+ * Cluster Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+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
@@ -128,6 +168,77 @@ void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint)
 // Cluster Server/Client Init Functions
 
 //
+// Application Basic Cluster client
+//
+
+/** @brief Application Basic Cluster Client Init
+ *
+ * Client Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfApplicationBasicClusterClientInitCallback(chip::EndpointId endpoint);
+
+/** @brief Application Basic Cluster Client Attribute Changed
+ *
+ * Client Attribute Changed
+ *
+ * @param endpoint    Endpoint that is being initialized
+ * @param attributeId Attribute that changed
+ */
+void emberAfApplicationBasicClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
+
+/** @brief Application Basic 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 emberAfApplicationBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
+                                                                                      chip::AttributeId attributeId,
+                                                                                      uint16_t manufacturerCode);
+
+/** @brief Application Basic 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 emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
+                                                             EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
+                                                             EmberStatus status);
+
+/** @brief Application Basic 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 emberAfApplicationBasicClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint,
+                                                                              chip::AttributeId attributeId,
+                                                                              EmberAfAttributeType attributeType, uint8_t size,
+                                                                              uint8_t * value);
+
+/** @brief Application Basic Cluster Client Tick
+ *
+ * client Tick
+ *
+ * @param endpoint  Endpoint that is being served
+ */
+void emberAfApplicationBasicClusterClientTickCallback(chip::EndpointId endpoint);
+
+//
 // Barrier Control Cluster client
 //
 
@@ -407,6 +518,76 @@ 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
 //
 
@@ -477,6 +658,77 @@ EmberAfStatus emberAfDoorLockClusterClientPreAttributeChangedCallback(chip::Endp
 void emberAfDoorLockClusterClientTickCallback(chip::EndpointId endpoint);
 
 //
+// General Commissioning Cluster client
+//
+
+/** @brief General Commissioning Cluster Client Init
+ *
+ * Client Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfGeneralCommissioningClusterClientInitCallback(chip::EndpointId endpoint);
+
+/** @brief General Commissioning Cluster Client Attribute Changed
+ *
+ * Client Attribute Changed
+ *
+ * @param endpoint    Endpoint that is being initialized
+ * @param attributeId Attribute that changed
+ */
+void emberAfGeneralCommissioningClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
+
+/** @brief General Commissioning 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 emberAfGeneralCommissioningClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
+                                                                                          chip::AttributeId attributeId,
+                                                                                          uint16_t manufacturerCode);
+
+/** @brief General Commissioning 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 emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
+                                                                 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
+                                                                 EmberStatus status);
+
+/** @brief General Commissioning 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 emberAfGeneralCommissioningClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint,
+                                                                                  chip::AttributeId attributeId,
+                                                                                  EmberAfAttributeType attributeType, uint8_t size,
+                                                                                  uint8_t * value);
+
+/** @brief General Commissioning Cluster Client Tick
+ *
+ * client Tick
+ *
+ * @param endpoint  Endpoint that is being served
+ */
+void emberAfGeneralCommissioningClusterClientTickCallback(chip::EndpointId endpoint);
+
+//
 // Groups Cluster client
 //
 
@@ -687,6 +939,146 @@ EmberAfStatus emberAfLevelControlClusterClientPreAttributeChangedCallback(chip::
 void emberAfLevelControlClusterClientTickCallback(chip::EndpointId endpoint);
 
 //
+// Low Power Cluster client
+//
+
+/** @brief Low Power Cluster Client Init
+ *
+ * Client Init
+ *
+ * @param endpoint    Endpoint that is being initialized
+ */
+void emberAfLowPowerClusterClientInitCallback(chip::EndpointId endpoint);
+
+/** @brief Low Power Cluster Client Attribute Changed
+ *
+ * Client Attribute Changed
+ *
+ * @param endpoint    Endpoint that is being initialized
+ * @param attributeId Attribute that changed
+ */
+void emberAfLowPowerClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
+
+/** @brief Low Power 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 emberAfLowPowerClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
+                                                                              chip::AttributeId attributeId,
+                                                                              uint16_t manufacturerCode);
+
+/** @brief Low Power 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 emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
+                                                     EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
+                                                     EmberStatus status);
+
+/** @brief Low Power 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 emberAfLowPowerClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
+                                                                      EmberAfAttributeType attributeType, uint8_t size,
+                                                                      uint8_t * value);
+
+/** @brief Low Power Cluster Client Tick
+ *
+ * client Tick
+ *
+ * @param endpoint  Endpoint that is being served
+ */
+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
 //
 
@@ -898,6 +1290,20 @@ 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
  */
@@ -1092,6 +1498,30 @@ bool emberAfDoorLockClusterUnlockDoorResponseCallback(uint8_t status);
 bool emberAfDoorLockClusterUnlockWithTimeoutResponseCallback(uint8_t status);
 
 /**
+ * @brief General Commissioning Cluster ArmFailSafeResponse Command callback
+ * @param errorCode
+ * @param debugText
+ */
+
+bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(uint8_t errorCode, uint8_t * debugText);
+
+/**
+ * @brief General Commissioning Cluster CommissioningCompleteResponse Command callback
+ * @param errorCode
+ * @param debugText
+ */
+
+bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(uint8_t errorCode, uint8_t * debugText);
+
+/**
+ * @brief General Commissioning Cluster SetFabricResponse Command callback
+ * @param errorCode
+ * @param debugText
+ */
+
+bool emberAfGeneralCommissioningClusterSetFabricResponseCallback(uint8_t errorCode, uint8_t * debugText);
+
+/**
  * @brief Groups Cluster AddGroupResponse Command callback
  * @param status
  * @param groupId
@@ -1134,6 +1564,12 @@ 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 c4f2f0a..f72c96f 100644 (file)
     emberAfFillExternalBuffer(mask, clusterId, ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID, "ub", discoveryComplete,      \
                               extendedDiscoverAttributesInfoRecords, extendedDiscoverAttributesInfoRecordsLen);
 
-/** @brief Command description for ResetToFactoryDefaults
- *
- * Command: ResetToFactoryDefaults
- */
-#define emberAfFillCommandBasicClusterResetToFactoryDefaults()                                                                     \
-    emberAfFillExternalBuffer(mask,                                                                                                \
-                                                                                                                                   \
-                              ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID, "", );
-
 /** @brief Command description for Identify
  *
  * Command: Identify
                                   totalNumberOfNonEmptyProxyTableEntries, gpdSrcId, startIndex, gpdIeee, entriesCount, endpoint,   \
                                   proxyTableEntries, proxyTableEntriesLen, index);
 
+/** @brief Command description for StartUp
+ *
+ * Command: StartUp
+ */
+#define emberAfFillCommandBasicClusterStartUp()                                                                                    \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_START_UP_COMMAND_ID, "", );
+
+/** @brief Command description for ShutDown
+ *
+ * Command: ShutDown
+ */
+#define emberAfFillCommandBasicClusterShutDown()                                                                                   \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_SHUT_DOWN_COMMAND_ID, "", );
+
+/** @brief Command description for Leave
+ *
+ * Command: Leave
+ */
+#define emberAfFillCommandBasicClusterLeave()                                                                                      \
+    emberAfFillExternalBuffer(mask,                                                                                                \
+                                                                                                                                   \
+                              ZCL_LEAVE_COMMAND_ID, "", );
+
 /** @brief Command description for SetFabric
  *
  * Command: SetFabric
index 2069290..d77da91 100644 (file)
@@ -20,9 +20,6 @@
 // Prevent multiple inclusion
 #pragma once
 
-// Definitions for cluster: Basic
-#define ZCL_BASIC_CLUSTER_ID (0x0000)
-
 // Definitions for cluster: Power Configuration
 #define ZCL_POWER_CONFIG_CLUSTER_ID (0x0001)
 
@@ -83,6 +80,9 @@
 // Definitions for cluster: Keep-Alive
 #define ZCL_KEEPALIVE_CLUSTER_ID (0x0025)
 
+// Definitions for cluster: Basic
+#define ZCL_BASIC_CLUSTER_ID (0x0028)
+
 // Definitions for cluster: General Commissioning
 #define ZCL_GENERAL_COMMISSIONING_CLUSTER_ID (0x0030)
 
index 655425d..adc2b1c 100644 (file)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID (0x15)
 #define ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID (0x16)
 
-// Commands for cluster: Basic
-#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
-#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
-
 // Commands for cluster: Identify
 #define ZCL_IDENTIFY_COMMAND_ID (0x00)
 #define ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_GP_PROXY_TABLE_RESPONSE_COMMAND_ID (0x0B)
 #define ZCL_GP_PROXY_TABLE_REQUEST_COMMAND_ID (0x0B)
 
+// Commands for cluster: Basic
+#define ZCL_START_UP_COMMAND_ID (0x00)
+#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)
+#define ZCL_SHUT_DOWN_COMMAND_ID (0x01)
+#define ZCL_LEAVE_COMMAND_ID (0x02)
+
 // Commands for cluster: General Commissioning
 #define ZCL_SET_FABRIC_COMMAND_ID (0x00)
 #define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
index 9046160..482e761 100644 (file)
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 11
+#define GENERATED_ATTRIBUTE_COUNT 16
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
-        { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 } }, /* Basic (client): cluster revision */     \
-            {                                                                                                                      \
-                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 2 }                                         \
-            }, /* Identify (client): cluster revision */                                                                           \
+        { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 2 } }, /* Identify (client): cluster revision */  \
             {                                                                                                                      \
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 }                                         \
             }, /* Groups (client): cluster revision */                                                                             \
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 }                                         \
             }, /* Level Control (client): cluster revision */                                                                      \
             {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT) | ZAP_ATTRIBUTE_MASK(SINGLETON), { (uint8_t *) 3 }         \
+            }, /* Basic (client): cluster revision */                                                                              \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 0x0001 }                                    \
+            }, /* General Commissioning (client): cluster revision */                                                              \
+            {                                                                                                                      \
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 3 }                                         \
             }, /* Door Lock (client): cluster revision */                                                                          \
             {                                                                                                                      \
             }, /* Temperature Measurement (client): cluster revision */                                                            \
             {                                                                                                                      \
                 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 0x0001 }                                    \
+            }, /* Low Power (client): cluster revision */                                                                          \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 0x0001 }                                    \
+            }, /* Application Basic (client): cluster revision */                                                                  \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 0x0001 }                                    \
             }, /* Binding (client): cluster revision */                                                                            \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 0x0001 }                                    \
+            }, /* Media Playback (client): cluster revision */                                                                     \
+            {                                                                                                                      \
+                0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), { (uint8_t *) 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 11
+#define GENERATED_CLUSTER_COUNT 16
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */       \
-            {                                                                                                                      \
-                0x0003, ZAP_ATTRIBUTE_INDEX(1), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
-            }, /* Endpoint: 1, Cluster: Identify (client) */                                                                       \
-            { 0x0004, ZAP_ATTRIBUTE_INDEX(2), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Groups (client) */  \
-            { 0x0005, ZAP_ATTRIBUTE_INDEX(3), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Scenes (client) */  \
-            { 0x0006, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: On/off (client) */  \
+        { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */    \
+            { 0x0004, ZAP_ATTRIBUTE_INDEX(1), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Groups (client) */  \
+            { 0x0005, ZAP_ATTRIBUTE_INDEX(2), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Scenes (client) */  \
+            { 0x0006, ZAP_ATTRIBUTE_INDEX(3), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: On/off (client) */  \
             {                                                                                                                      \
-                0x0008, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
+                0x0008, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
             }, /* Endpoint: 1, Cluster: Level Control (client) */                                                                  \
+            { 0x0028, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */   \
             {                                                                                                                      \
-                0x0101, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
+                0x0030, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
+            }, /* Endpoint: 1, Cluster: General Commissioning (client) */                                                          \
+            {                                                                                                                      \
+                0x0101, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
             }, /* Endpoint: 1, Cluster: Door Lock (client) */                                                                      \
             {                                                                                                                      \
-                0x0103, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
+                0x0103, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
             }, /* Endpoint: 1, Cluster: Barrier Control (client) */                                                                \
             {                                                                                                                      \
-                0x0300, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
+                0x0300, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
             }, /* Endpoint: 1, Cluster: Color Control (client) */                                                                  \
             {                                                                                                                      \
-                0x0402, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                               \
+                0x0402, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
             }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */                                                        \
             {                                                                                                                      \
-                0xF000, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
+                0x0508, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
+            }, /* Endpoint: 1, Cluster: Low Power (client) */                                                                      \
+            {                                                                                                                      \
+                0x050D, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
+            }, /* Endpoint: 1, Cluster: Application Basic (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), 11, 22 },                                                                                          \
+        { ZAP_CLUSTER_INDEX(0), 16, 32 },                                                                                          \
     }
 
 // Largest attribute size is needed for various buffers
 #define ATTRIBUTE_LARGEST (2)
 
 // Total size of singleton attributes
-#define ATTRIBUTE_SINGLETONS_SIZE (0)
+#define ATTRIBUTE_SINGLETONS_SIZE (2)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (22)
+#define ATTRIBUTE_MAX_SIZE (32)
 
 // 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 (105)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (129)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
-        { 0x0000, 0x00, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Basic (client): MfgSpecificPing */                                 \
-            {                                                                                                                      \
-                0x0000, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT)                                \
-            },                                                   /* Basic (client): ResetToFactoryDefaults */                      \
-            { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): Identify */                                 \
+        { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (client): Identify */                                 \
             { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Identify (client): IdentifyQueryResponse */                    \
             { 0x0003, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): IdentifyQuery */                            \
             { 0x0004, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Groups (client): AddGroup */                                   \
             { 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (client): MoveWithOnOff */                       \
             { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (client): StepWithOnOff */                       \
             { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (client): StopWithOnOff */                       \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Basic (client): MfgSpecificPing */                             \
+            { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (client): StartUp */                                     \
+            { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (client): ShutDown */                                    \
+            { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (client): Leave */                                       \
+            { 0x0030, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (client): SetFabric */                   \
+            { 0x0030, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* General Commissioning (client): SetFabricResponse */           \
+            { 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (client): ArmFailSafe */                 \
+            { 0x0030, 0x03, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* General Commissioning (client): ArmFailSafeResponse */         \
+            { 0x0030, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (client): CommissioningComplete */       \
+            { 0x0030, 0x07,                                                                                                        \
+              ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* General Commissioning (client): CommissioningCompleteResponse */             \
             { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (client): LockDoor */                                \
             { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Door Lock (client): LockDoorResponse */                        \
             { 0x0101, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (client): UnlockDoor */                              \
             {                                                                                                                      \
                 0x0300, 0x4C, ZAP_COMMAND_MASK(INCOMING_CLIENT) | ZAP_COMMAND_MASK(OUTGOING_CLIENT)                                \
             },                                                   /* Color Control (client): StepColorTemperature */                \
+            { 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.
 #define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT (1)
 #define GENERATED_COMMAND_MANUFACTURER_CODES                                                                                       \
     {                                                                                                                              \
-        { 0, 4098 },                                                                                                               \
+        { 37, 4098 },                                                                                                              \
     }
 
 // This is an array of EmberAfManufacturerCodeEntry structures for clusters.
 #define ZRD(x) EMBER_ZCL_REPORTING_DIRECTION_##x
 #define ZAP_REPORT_DIRECTION(x) ZRD(x)
 
-// 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 (1)
-#define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS
-
-#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (1)
+#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (0)
 #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS                                                                               \
     {                                                                                                                              \
-        {                                                                                                                          \
-            ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0000, 0xFFFD, ZAP_CLUSTER_MASK(CLIENT), 0x0000, { { 0, 65344, 0 } }          \
-        }, /* Reporting for cluster: "Basic", attribute: "cluster revision". side: client */                                       \
     }
index 7c77a36..ce12b68 100644 (file)
 #define EMBER_APS_UNICAST_MESSAGE_COUNT 10
 
 /**** Cluster endpoint counts ****/
+#define EMBER_AF_APPLICATION_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_BARRIER_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #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)
 
 /**** Cluster Plugins ****/
 
+// Use this macro to check if the client side of the Application Basic cluster is included
+#define ZCL_USING_APPLICATION_BASIC_CLUSTER_CLIENT
+#define EMBER_AF_PLUGIN_APPLICATION_BASIC_CLIENT
+
 // Use this macro to check if the client side of the Barrier Control cluster is included
 #define ZCL_USING_BARRIER_CONTROL_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_BARRIER_CONTROL_CLIENT
 #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
 
+// Use this macro to check if the client side of the General Commissioning cluster is included
+#define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT
+#define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_CLIENT
+
 // Use this macro to check if the client side of the Groups cluster is included
 #define ZCL_USING_GROUPS_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_GROUPS_CLIENT
 #define ZCL_USING_LEVEL_CONTROL_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_LEVEL_CONTROL_CLIENT
 
+// Use this macro to check if the client side of the Low Power cluster is included
+#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 1ea3151..bd08d38 100644 (file)
 // to the "EmberAfClusterName" defined in the ZCL header.
 // The names of clusters that are not present, are removed.
 
-#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 0, "Basic" },
-#else
-#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
-#endif
-
 #if defined(ZCL_USING_POWER_CONFIG_CLUSTER_SERVER) || defined(ZCL_USING_POWER_CONFIG_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER { ZCL_POWER_CONFIG_CLUSTER_ID, 1, "Power Configuration" },
 #else
 #define CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER
 #endif
 
+#if defined(ZCL_USING_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_BASIC_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER { ZCL_BASIC_CLUSTER_ID, 40, "Basic" },
+#else
+#define CHIP_PRINTCLUSTER_BASIC_CLUSTER
+#endif
+
 #if defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER) || defined(ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER { ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, 48, "General Commissioning" },
 #else
 #endif
 
 #define CLUSTER_IDS_TO_NAMES                                                                                                       \
-    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_POWER_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DEVICE_TEMP_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_IDENTIFY_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_POLL_CONTROL_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_GREEN_POWER_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_KEEPALIVE_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_BASIC_CLUSTER                                                                                                \
     CHIP_PRINTCLUSTER_GENERAL_COMMISSIONING_CLUSTER                                                                                \
     CHIP_PRINTCLUSTER_SHADE_CONFIG_CLUSTER                                                                                         \
     CHIP_PRINTCLUSTER_DOOR_LOCK_CLUSTER                                                                                            \
index 71fc2f7..45b1651 100644 (file)
 #pragma once
 
 namespace chip {
+
+namespace Mdns {
+struct TextEntry;
+}
+
 namespace DeviceLayer {
 
 class PlatformManagerImpl;
@@ -74,6 +79,7 @@ public:
     CHIP_ERROR GetAndLogThreadTopologyMinimal();
     CHIP_ERROR GetAndLogThreadTopologyFull();
     CHIP_ERROR GetPrimary802154MACAddress(uint8_t * buf);
+    CHIP_ERROR GetFactoryAssignedEUI64(uint8_t (&buf)[8]);
     CHIP_ERROR GetExternalIPv6Address(chip::Inet::IPAddress & addr);
 
     CHIP_ERROR JoinerStart();
@@ -82,8 +88,8 @@ public:
     CHIP_ERROR SetThreadEnabled(bool val);
 
 #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
-    CHIP_ERROR AddSrpService(const char * aInstanceName, const char * aName, uint16_t aPort, uint32_t aLeaseInterval,
-                             uint32_t aKeyLeaseInterval);
+    CHIP_ERROR AddSrpService(const char * aInstanceName, const char * aName, uint16_t aPort, chip::Mdns::TextEntry * aTxtEntries,
+                             size_t aTxtEntiresSize, uint32_t aLeaseInterval, uint32_t aKeyLeaseInterval);
     CHIP_ERROR RemoveSrpService(const char * aInstanceName, const char * aName);
     CHIP_ERROR SetupSrpHost(const char * aHostName);
 #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
@@ -227,9 +233,11 @@ inline CHIP_ERROR ThreadStackManager::SetThreadEnabled(bool val)
 
 #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
 inline CHIP_ERROR ThreadStackManager::AddSrpService(const char * aInstanceName, const char * aName, uint16_t aPort,
+                                                    chip::Mdns::TextEntry * aTxtEntries, size_t aTxtEntiresSize,
                                                     uint32_t aLeaseInterval = 0, uint32_t aKeyLeaseInterval = 0)
 {
-    return static_cast<ImplClass *>(this)->_AddSrpService(aInstanceName, aName, aPort, aLeaseInterval, aKeyLeaseInterval);
+    return static_cast<ImplClass *>(this)->_AddSrpService(aInstanceName, aName, aPort, aTxtEntries, aTxtEntiresSize, aLeaseInterval,
+                                                          aKeyLeaseInterval);
 }
 
 inline CHIP_ERROR ThreadStackManager::RemoveSrpService(const char * aInstanceName, const char * aName)
@@ -333,6 +341,11 @@ inline CHIP_ERROR ThreadStackManager::GetPrimary802154MACAddress(uint8_t * buf)
     return static_cast<ImplClass *>(this)->_GetPrimary802154MACAddress(buf);
 }
 
+inline CHIP_ERROR ThreadStackManager::GetFactoryAssignedEUI64(uint8_t (&buf)[8])
+{
+    return static_cast<ImplClass *>(this)->_GetFactoryAssignedEUI64(buf);
+}
+
 inline CHIP_ERROR ThreadStackManager::GetExternalIPv6Address(chip::Inet::IPAddress & addr)
 {
     return static_cast<ImplClass *>(this)->_GetExternalIPv6Address(addr);
index 024d663..9cde2a4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2019-2020 Google LLC.
  *    Copyright (c) 2018 Nest Labs, Inc.
  *
@@ -50,15 +50,14 @@ namespace Internal {
 template <class ImplClass>
 CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_Init()
 {
-    mFlags = 0;
-
     // Cache flags indicating whether the device is currently service provisioned, is a member of a fabric,
     // is paired to an account, and/or provisioned with operational credentials.
-    SetFlag(mFlags, kFlag_IsServiceProvisioned, Impl()->ConfigValueExists(ImplClass::kConfigKey_ServiceConfig));
-    SetFlag(mFlags, kFlag_IsMemberOfFabric, Impl()->ConfigValueExists(ImplClass::kConfigKey_FabricId));
-    SetFlag(mFlags, kFlag_IsPairedToAccount, Impl()->ConfigValueExists(ImplClass::kConfigKey_PairedAccountId));
-    SetFlag(mFlags, kFlag_OperationalDeviceCredentialsProvisioned,
-            Impl()->ConfigValueExists(ImplClass::kConfigKey_OperationalDeviceCert));
+    mFlags.ClearAll()
+        .Set(Flags::kIsServiceProvisioned, Impl()->ConfigValueExists(ImplClass::kConfigKey_ServiceConfig))
+        .Set(Flags::kIsMemberOfFabric, Impl()->ConfigValueExists(ImplClass::kConfigKey_FabricId))
+        .Set(Flags::kIsPairedToAccount, Impl()->ConfigValueExists(ImplClass::kConfigKey_PairedAccountId))
+        .Set(Flags::kOperationalDeviceCredentialsProvisioned,
+             Impl()->ConfigValueExists(ImplClass::kConfigKey_OperationalDeviceCert));
 
 #if CHIP_ENABLE_ROTATING_DEVICE_ID
     mLifetimePersistedCounter.Init(CHIP_CONFIG_LIFETIIME_PERSISTED_COUNTER_KEY);
@@ -524,7 +523,7 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_ClearOperationalDeviceCr
     Impl()->ClearConfigValue(ImplClass::kConfigKey_OperationalDeviceICACerts);
     Impl()->ClearConfigValue(ImplClass::kConfigKey_OperationalDevicePrivateKey);
 
-    ClearFlag(mFlags, kFlag_OperationalDeviceCredentialsProvisioned);
+    mFlags.Clear(Flags::kOperationalDeviceCredentialsProvisioned);
 
     return CHIP_NO_ERROR;
 }
@@ -532,19 +531,19 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_ClearOperationalDeviceCr
 template <class ImplClass>
 bool GenericConfigurationManagerImpl<ImplClass>::_OperationalDeviceCredentialsProvisioned()
 {
-    return ::chip::GetFlag(mFlags, kFlag_OperationalDeviceCredentialsProvisioned);
+    return mFlags.Has(Flags::kOperationalDeviceCredentialsProvisioned);
 }
 
 template <class ImplClass>
 bool GenericConfigurationManagerImpl<ImplClass>::UseManufacturerCredentialsAsOperational()
 {
-    return ::chip::GetFlag(mFlags, kFlag_UseManufacturerCredentialsAsOperational);
+    return mFlags.Has(Flags::kUseManufacturerCredentialsAsOperational);
 }
 
 template <class ImplClass>
 void GenericConfigurationManagerImpl<ImplClass>::_UseManufacturerCredentialsAsOperational(bool val)
 {
-    SetFlag(mFlags, kFlag_UseManufacturerCredentialsAsOperational, val);
+    mFlags.Set(Flags::kUseManufacturerCredentialsAsOperational, val);
 }
 
 #endif // CHIP_DEVICE_CONFIG_ENABLE_JUST_IN_TIME_PROVISIONING
@@ -627,11 +626,11 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_StoreFabricId(uint64_t f
     {
         err = Impl()->WriteConfigValue(ImplClass::kConfigKey_FabricId, fabricId);
         SuccessOrExit(err);
-        SetFlag(mFlags, kFlag_IsMemberOfFabric);
+        mFlags.Set(Flags::kIsMemberOfFabric);
     }
     else
     {
-        ClearFlag(mFlags, kFlag_IsMemberOfFabric);
+        mFlags.Clear(Flags::kIsMemberOfFabric);
         err = Impl()->ClearConfigValue(ImplClass::kConfigKey_FabricId);
         SuccessOrExit(err);
     }
@@ -689,7 +688,7 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_StorePairedAccountId(con
     err = Impl()->WriteConfigValueStr(ImplClass::kConfigKey_PairedAccountId, accountId, accountIdLen);
     SuccessOrExit(err);
 
-    SetFlag(mFlags, kFlag_IsPairedToAccount, (accountId != nullptr && accountIdLen != 0));
+    mFlags.Set(Flags::kIsPairedToAccount, (accountId != nullptr && accountIdLen != 0));
 
 exit:
     return err;
@@ -712,8 +711,8 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_StoreServiceProvisioning
     err = _StorePairedAccountId(accountId, accountIdLen);
     SuccessOrExit(err);
 
-    SetFlag(mFlags, kFlag_IsServiceProvisioned);
-    SetFlag(mFlags, kFlag_IsPairedToAccount, (accountId != nullptr && accountIdLen != 0));
+    mFlags.Set(Flags::kIsServiceProvisioned);
+    mFlags.Set(Flags::kIsPairedToAccount, (accountId != nullptr && accountIdLen != 0));
 
 exit:
     if (err != CHIP_NO_ERROR)
@@ -721,8 +720,8 @@ exit:
         Impl()->ClearConfigValue(ImplClass::kConfigKey_ServiceId);
         Impl()->ClearConfigValue(ImplClass::kConfigKey_ServiceConfig);
         Impl()->ClearConfigValue(ImplClass::kConfigKey_PairedAccountId);
-        ClearFlag(mFlags, kFlag_IsServiceProvisioned);
-        ClearFlag(mFlags, kFlag_IsPairedToAccount);
+        mFlags.Clear(Flags::kIsServiceProvisioned);
+        mFlags.Clear(Flags::kIsPairedToAccount);
     }
     return err;
 }
@@ -757,8 +756,8 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_ClearServiceProvisioning
         PlatformMgr().PostEvent(&event);
     }
 
-    ClearFlag(mFlags, kFlag_IsServiceProvisioned);
-    ClearFlag(mFlags, kFlag_IsPairedToAccount);
+    mFlags.Clear(Flags::kIsServiceProvisioned);
+    mFlags.Clear(Flags::kIsPairedToAccount);
 
     return CHIP_NO_ERROR;
 }
@@ -851,19 +850,19 @@ exit:
 template <class ImplClass>
 bool GenericConfigurationManagerImpl<ImplClass>::_IsServiceProvisioned()
 {
-    return ::chip::GetFlag(mFlags, kFlag_IsServiceProvisioned);
+    return mFlags.Has(Flags::kIsServiceProvisioned);
 }
 
 template <class ImplClass>
 bool GenericConfigurationManagerImpl<ImplClass>::_IsMemberOfFabric()
 {
-    return ::chip::GetFlag(mFlags, kFlag_IsMemberOfFabric);
+    return mFlags.Has(Flags::kIsMemberOfFabric);
 }
 
 template <class ImplClass>
 bool GenericConfigurationManagerImpl<ImplClass>::_IsPairedToAccount()
 {
-    return ::chip::GetFlag(mFlags, kFlag_IsPairedToAccount);
+    return mFlags.Has(Flags::kIsPairedToAccount);
 }
 
 template <class ImplClass>
index 5632a93..44e410b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2019-2020 Google LLC.
  *    Copyright (c) 2018 Nest Labs, Inc.
  *
@@ -25,6 +25,8 @@
 
 #pragma once
 
+#include <support/BitFlags.h>
+
 #if CHIP_ENABLE_ROTATING_DEVICE_ID
 #include <support/LifetimePersistedCounter.h>
 #endif
@@ -64,6 +66,7 @@ public:
     CHIP_ERROR _GetPrimaryWiFiMACAddress(uint8_t * buf);
     CHIP_ERROR _StorePrimaryWiFiMACAddress(const uint8_t * buf);
     CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf);
+    CHIP_ERROR _GetFactoryAssignedEUI64(uint8_t (&buf)[8]);
     CHIP_ERROR _StorePrimary802154MACAddress(const uint8_t * buf);
     CHIP_ERROR _GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & dayOfMonth);
     CHIP_ERROR _StoreManufacturingDate(const char * mfgDate, size_t mfgDateLen);
@@ -125,16 +128,16 @@ public:
     void _LogDeviceConfig();
 
 protected:
-    enum
+    enum class Flags : uint8_t
     {
-        kFlag_IsServiceProvisioned                    = 0x01,
-        kFlag_IsMemberOfFabric                        = 0x02,
-        kFlag_IsPairedToAccount                       = 0x04,
-        kFlag_OperationalDeviceCredentialsProvisioned = 0x08,
-        kFlag_UseManufacturerCredentialsAsOperational = 0x10,
+        kIsServiceProvisioned                    = 0x01,
+        kIsMemberOfFabric                        = 0x02,
+        kIsPairedToAccount                       = 0x04,
+        kOperationalDeviceCredentialsProvisioned = 0x08,
+        kUseManufacturerCredentialsAsOperational = 0x10,
     };
 
-    uint8_t mFlags;
+    BitFlags<Flags> mFlags;
 #if CHIP_ENABLE_ROTATING_DEVICE_ID
     chip::LifetimePersistedCounter mLifetimePersistedCounter;
 #endif
index 62c8351..da76c0c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2019 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -55,7 +55,7 @@ void GenericConnectivityManagerImpl_Thread<ImplClass>::_OnPlatformEvent(const Ch
 template <class ImplClass>
 ConnectivityManager::ThreadMode GenericConnectivityManagerImpl_Thread<ImplClass>::_GetThreadMode()
 {
-    if (GetFlag(mFlags, kFlag_IsApplicationControlled))
+    if (mFlags.Has(Flags::kIsApplicationControlled))
     {
         return ConnectivityManager::kThreadMode_ApplicationControlled;
     }
@@ -75,11 +75,11 @@ CHIP_ERROR GenericConnectivityManagerImpl_Thread<ImplClass>::_SetThreadMode(Conn
 
     if (val == ConnectivityManager::kThreadMode_ApplicationControlled)
     {
-        SetFlag(mFlags, kFlag_IsApplicationControlled);
+        mFlags.Set(Flags::kIsApplicationControlled);
     }
     else
     {
-        ClearFlag(mFlags, kFlag_IsApplicationControlled);
+        mFlags.Clear(Flags::kIsApplicationControlled);
 
         err = ThreadStackMgrImpl().SetThreadEnabled(val == ConnectivityManager::kThreadMode_Enabled);
         SuccessOrExit(err);
@@ -92,15 +92,15 @@ exit:
 template <class ImplClass>
 void GenericConnectivityManagerImpl_Thread<ImplClass>::UpdateServiceConnectivity()
 {
-    bool haveServiceConnectivity = false;
+    constexpr bool haveServiceConnectivity = false;
 
     // If service connectivity via Thread has changed, post an event signaling the change.
-    if (GetFlag(mFlags, kFlag_HaveServiceConnectivity) != haveServiceConnectivity)
+    if (mFlags.Has(Flags::kHaveServiceConnectivity) != haveServiceConnectivity)
     {
         ChipLogProgress(DeviceLayer, "ConnectivityManager: Service connectivity via Thread %s",
                         (haveServiceConnectivity) ? "ESTABLISHED" : "LOST");
 
-        SetFlag(mFlags, kFlag_HaveServiceConnectivity, haveServiceConnectivity);
+        mFlags.Set(Flags::kHaveServiceConnectivity, haveServiceConnectivity);
 
         {
             ChipDeviceEvent event;
index 5cb683a..cdf1271 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2019 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,6 +25,9 @@
 #pragma once
 
 #include <platform/ThreadStackManager.h>
+#include <support/BitFlags.h>
+
+#include <cstdint>
 
 namespace chip {
 namespace DeviceLayer {
@@ -73,13 +76,13 @@ protected:
 private:
     // ===== Private members reserved for use by this class only.
 
-    enum Flags
+    enum class Flags : uint8_t
     {
-        kFlag_HaveServiceConnectivity = 0x01,
-        kFlag_IsApplicationControlled = 0x02
+        kHaveServiceConnectivity = 0x01,
+        kIsApplicationControlled = 0x02
     };
 
-    uint8_t mFlags;
+    BitFlags<Flags> mFlags;
 
     ImplClass * Impl() { return static_cast<ImplClass *>(this); }
 };
@@ -87,7 +90,7 @@ private:
 template <class ImplClass>
 inline void GenericConnectivityManagerImpl_Thread<ImplClass>::_Init()
 {
-    mFlags = 0;
+    mFlags.ClearAll();
 }
 
 template <class ImplClass>
@@ -99,7 +102,7 @@ inline bool GenericConnectivityManagerImpl_Thread<ImplClass>::_IsThreadEnabled()
 template <class ImplClass>
 inline bool GenericConnectivityManagerImpl_Thread<ImplClass>::_IsThreadApplicationControlled()
 {
-    return GetFlag(mFlags, kFlag_IsApplicationControlled);
+    return mFlags.Has(Flags::kIsApplicationControlled);
 }
 
 template <class ImplClass>
@@ -150,7 +153,7 @@ inline CHIP_ERROR GenericConnectivityManagerImpl_Thread<ImplClass>::_SetThreadPo
 template <class ImplClass>
 inline bool GenericConnectivityManagerImpl_Thread<ImplClass>::_HaveServiceConnectivityViaThread()
 {
-    return GetFlag(mFlags, kFlag_HaveServiceConnectivity);
+    return mFlags.Has(Flags::kHaveServiceConnectivity);
 }
 
 } // namespace Internal
index fb10bbb..a363a4a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -82,11 +82,11 @@ public:
     static const char * _WiFiAPStateToStr(ConnectivityManager::WiFiAPState state);
 
 protected:
-    enum Flags
+    enum class ConnectivityFlags : uint16_t
     {
-        kFlag_HaveIPv4InternetConnectivity = 0x0001,
-        kFlag_HaveIPv6InternetConnectivity = 0x0002,
-        kFlag_AwaitingConnectivity         = 0x0010,
+        kHaveIPv4InternetConnectivity = 0x0001,
+        kHaveIPv6InternetConnectivity = 0x0002,
+        kAwaitingConnectivity         = 0x0010,
     };
 
 private:
diff --git a/src/inet/tests/TapAddrAutoconf.cpp b/src/inet/tests/TapAddrAutoconf.cpp
deleted file mode 100644 (file)
index 9498594..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2019 Google LLC.
- *    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 "TapAddrAutoconf.h"
-
-#include <ifaddrs.h>
-#include <inttypes.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-
-int CollectTapAddresses(std::vector<char *> & addresses, const char * ifName)
-{
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && CHIP_SYSTEM_CONFIG_USE_BSD_IFADDRS
-    struct ifaddrs *addrsList, *curAddr;
-    const int err = getifaddrs(&addrsList);
-
-    if (err == 0)
-    {
-        curAddr = addrsList;
-
-        while (curAddr)
-        {
-            if (strcmp(ifName, curAddr->ifa_name) == 0)
-            {
-                char buf[INET6_ADDRSTRLEN];
-                const char * rv;
-                char * tmp;
-                rv = inet_ntop(curAddr->ifa_addr->sa_family,
-                               curAddr->ifa_addr->sa_family == AF_INET6
-                                   ? (const void *) &(((sockaddr_in6 *) curAddr->ifa_addr)->sin6_addr)
-                                   : (const void *) &(((sockaddr_in *) curAddr->ifa_addr)->sin_addr),
-                               buf, sizeof(buf));
-                if (rv != NULL)
-                {
-                    tmp = (char *) malloc(strlen(buf));
-                    strcpy(tmp, buf);
-                    addresses.push_back(tmp);
-                }
-            }
-            curAddr = curAddr->ifa_next;
-        }
-        freeifaddrs(addrsList);
-    }
-    else
-    {
-        return -1;
-    }
-
-    return 0;
-#else
-#error "Unsupported configuration: requires CHIP_SYSTEM_CONFIG_USE_BSD_IFADDRS"
-#endif
-}
diff --git a/src/inet/tests/TestInetCommon.cpp b/src/inet/tests/TestInetCommon.cpp
deleted file mode 100644 (file)
index 14cd979..0000000
+++ /dev/null
@@ -1,802 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2018 Nest Labs, Inc.
- *
- *    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.
- */
-
-/**
- *    @file
- *      This file implements constants, globals and interfaces common to
- *      and used by all CHP Inet layer library test applications and
- *      tools.
- *
- *      NOTE: These do not comprise a public part of the CHIP API and
- *            are subject to change without notice.
- *
- */
-
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS
-#endif
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif
-
-#include "TestInetCommon.h"
-
-#include <vector>
-
-#include <inttypes.h>
-#include <signal.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <inet/InetFaultInjection.h>
-#include <support/CHIPFaultInjection.h>
-#include <support/CHIPMem.h>
-#include <support/ScopedBuffer.h>
-#include <system/SystemFaultInjection.h>
-#include <system/SystemTimer.h>
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-#include <lwip/dns.h>
-#include <lwip/init.h>
-#include <lwip/netif.h>
-#include <lwip/sys.h>
-#include <lwip/tcpip.h>
-#include <netif/etharp.h>
-
-#if CHIP_TARGET_STYLE_UNIX
-
-// TapAddrAutoconf and TapInterface are only needed for LwIP on
-// sockets simulation in which a host tap/tun interface is used to
-// proxy the LwIP stack onto a host native network interface.
-
-#include "TapAddrAutoconf.h"
-#include "TapInterface.h"
-#endif // CHIP_TARGET_STYLE_UNIX
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-#include <arpa/inet.h>
-#include <sys/select.h>
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-using namespace chip;
-using namespace chip::Inet;
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-static sys_mbox_t * sLwIPEventQueue   = NULL;
-static unsigned int sLwIPAcquireCount = 0;
-
-static void AcquireLwIP(void)
-{
-    if (sLwIPAcquireCount++ == 0)
-    {
-        sys_mbox_new(sLwIPEventQueue, 100);
-    }
-}
-
-static void ReleaseLwIP(void)
-{
-#if !(LWIP_VERSION_MAJOR >= 2 && LWIP_VERSION_MINOR >= 1)
-    if (sLwIPAcquireCount > 0 && --sLwIPAcquireCount == 0)
-    {
-        tcpip_finish(NULL, NULL);
-    }
-#endif
-}
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-struct RestartCallbackContext
-{
-    int mArgc;
-    char ** mArgv;
-};
-
-static void RebootCallbackFn();
-static void PostInjectionCallbackFn(nl::FaultInjection::Manager * aManager, nl::FaultInjection::Identifier aId,
-                                    nl::FaultInjection::Record * aFaultRecord);
-
-static struct RestartCallbackContext sRestartCallbackCtx;
-static nl::FaultInjection::Callback sFuzzECHeaderCb;
-static nl::FaultInjection::Callback sAsyncEventCb;
-
-// clang-format off
-static nl::FaultInjection::GlobalContext sFaultInjectionGlobalContext = {
-    {
-        RebootCallbackFn,
-        PostInjectionCallbackFn
-    }
-};
-// clang-format on
-
-System::Layer gSystemLayer;
-
-Inet::InetLayer gInet;
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP && !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-#if CHIP_TARGET_STYLE_UNIX
-// TapAddrAutoconf and TapInterface are only needed for LwIP on
-// sockets simulation in which a host tap/tun interface is used to
-// proxy the LwIP stack onto a host native network interface.
-// CollectTapAddresses() is only available on such targets.
-
-static std::vector<TapInterface> sTapIFs;
-#endif                                    // CHIP_TARGET_STYLE_UNIX
-static std::vector<struct netif> sNetIFs; // interface to filter
-#endif                                    // CHIP_SYSTEM_CONFIG_USE_LWIP && !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-
-static bool NetworkIsReady();
-static void OnLwIPInitComplete(void * arg);
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-char gDefaultTapDeviceName[32];
-bool gDone            = false;
-bool gSigusr1Received = false;
-
-static void UseStdoutLineBuffering()
-{
-    // Set stdout to be line buffered with a buffer of 512 (will flush on new line
-    // or when the buffer of 512 is exceeded).
-#if CHIP_CONFIG_MEMORY_MGMT_MALLOC
-    constexpr char * buf = nullptr;
-#else
-    static char buf[512];
-#endif // CHIP_CONFIG_MEMORY_MGMT_MALLOC
-    setvbuf(stdout, buf, _IOLBF, 512);
-}
-
-void InitTestInetCommon()
-{
-    chip::Platform::MemoryInit();
-    UseStdoutLineBuffering();
-}
-
-static void ExitOnSIGUSR1Handler(int signum)
-{
-    // exit() allows us a slightly better clean up (gcov data) than SIGINT's exit
-    exit(0);
-}
-
-// We set a hook to exit when we receive SIGUSR1, SIGTERM or SIGHUP
-void SetSIGUSR1Handler()
-{
-    SetSignalHandler(ExitOnSIGUSR1Handler);
-}
-
-void SetSignalHandler(SignalHandler handler)
-{
-    struct sigaction sa;
-    int signals[] = { SIGUSR1 };
-    size_t i;
-
-    memset(&sa, 0, sizeof(sa));
-    sa.sa_handler = handler;
-
-    for (i = 0; i < sizeof(signals) / sizeof(signals[0]); i++)
-    {
-        if (sigaction(signals[i], &sa, nullptr) == -1)
-        {
-            perror("Can't catch signal");
-            exit(1);
-        }
-    }
-}
-
-void InitSystemLayer()
-{
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-    AcquireLwIP();
-
-    gSystemLayer.Init(sLwIPEventQueue);
-#else  // !CHIP_SYSTEM_CONFIG_USE_LWIP
-    gSystemLayer.Init(nullptr);
-#endif // !CHIP_SYSTEM_CONFIG_USE_LWIP
-}
-
-void ShutdownSystemLayer()
-{
-    gSystemLayer.Shutdown();
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-    ReleaseLwIP();
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-}
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-static void PrintNetworkState()
-{
-    char intfName[10];
-
-    for (size_t j = 0; j < gNetworkOptions.TapDeviceName.size(); j++)
-    {
-        struct netif * netIF = &(sNetIFs[j]);
-#if CHIP_TARGET_STYLE_UNIX
-        // TapAddrAutoconf and TapInterface are only needed for LwIP on
-        // sockets simulation in which a host tap/tun interface is used to
-        // proxy the LwIP stack onto a host native network interface.
-        // CollectTapAddresses() is only available on such targets.
-
-        TapInterface * tapIF = &(sTapIFs[j]);
-#endif // CHIP_TARGET_STYLE_UNIX
-        GetInterfaceName(netIF, intfName, sizeof(intfName));
-
-        printf("LwIP interface ready\n");
-        printf("  Interface Name: %s\n", intfName);
-        printf("  Tap Device: %s\n", gNetworkOptions.TapDeviceName[j]);
-#if CHIP_TARGET_STYLE_UNIX
-        // TapAddrAutoconf and TapInterface are only needed for LwIP on
-        // sockets simulation in which a host tap/tun interface is used to
-        // proxy the LwIP stack onto a host native network interface.
-        // CollectTapAddresses() is only available on such targets.
-
-        printf("  MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n", tapIF->macAddr[0], tapIF->macAddr[1], tapIF->macAddr[2],
-               tapIF->macAddr[3], tapIF->macAddr[4], tapIF->macAddr[5]);
-#endif // CHIP_TARGET_STYLE_UNIX
-
-#if INET_CONFIG_ENABLE_IPV4
-        printf("  IPv4 Address: %s\n", ipaddr_ntoa(&(netIF->ip_addr)));
-        printf("  IPv4 Mask: %s\n", ipaddr_ntoa(&(netIF->netmask)));
-        printf("  IPv4 Gateway: %s\n", ipaddr_ntoa(&(netIF->gw)));
-#endif // INET_CONFIG_ENABLE_IPV4
-        for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++)
-        {
-            if (!ip6_addr_isany(netif_ip6_addr(netIF, i)))
-            {
-                printf("  IPv6 address: %s, 0x%02x\n", ip6addr_ntoa(netif_ip6_addr(netIF, i)), netif_ip6_addr_state(netIF, i));
-            }
-        }
-    }
-#if INET_CONFIG_ENABLE_DNS_RESOLVER
-    char dnsServerAddrStr[DNS_MAX_NAME_LENGTH];
-    printf("  DNS Server: %s\n", gNetworkOptions.DNSServerAddr.ToString(dnsServerAddrStr, sizeof(dnsServerAddrStr)));
-#endif // INET_CONFIG_ENABLE_DNS_RESOLVER
-}
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-void InitNetwork()
-{
-    void * lContext = nullptr;
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-    tcpip_init(NULL, NULL);
-
-#else // !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-    // If an tap device name hasn't been specified, derive one from the IPv6 interface id.
-
-    if (gNetworkOptions.TapDeviceName.empty())
-    {
-        for (size_t j = 0; j < gNetworkOptions.LocalIPv6Addr.size(); j++)
-        {
-            uint64_t iid    = gNetworkOptions.LocalIPv6Addr[j].InterfaceId();
-            char * tap_name = (char *) chip::Platform::MemoryAlloc(sizeof(gDefaultTapDeviceName));
-            assert(tap_name);
-            snprintf(tap_name, sizeof(gDefaultTapDeviceName), "chip-dev-%" PRIx64, iid & 0xFFFF);
-            gNetworkOptions.TapDeviceName.push_back(tap_name);
-        }
-    }
-
-#if CHIP_TARGET_STYLE_UNIX
-    // TapAddrAutoconf and TapInterface are only needed for LwIP on
-    // sockets simulation in which a host tap/tun interface is used to
-    // proxy the LwIP stack onto a host native network interface.
-    // CollectTapAddresses() is only available on such targets.
-
-    sTapIFs.clear();
-#endif // CHIP_TARGET_STYLE_UNIX
-    sNetIFs.clear();
-
-    for (size_t j = 0; j < gNetworkOptions.TapDeviceName.size(); j++)
-    {
-#if CHIP_TARGET_STYLE_UNIX
-        // TapAddrAutoconf and TapInterface are only needed for LwIP on
-        // sockets simulation in which a host tap/tun interface is used to
-        // proxy the LwIP stack onto a host native network interface.
-        // CollectTapAddresses() is only available on such targets.
-
-        TapInterface tapIF;
-        sTapIFs.push_back(tapIF);
-#endif // CHIP_TARGET_STYLE_UNIX
-        struct netif netIF;
-        sNetIFs.push_back(netIF);
-    }
-
-#if CHIP_TARGET_STYLE_UNIX
-
-    // TapAddrAutoconf and TapInterface are only needed for LwIP on
-    // sockets simulation in which a host tap/tun interface is used to
-    // proxy the LwIP stack onto a host native network interface.
-    // CollectTapAddresses() is only available on such targets.
-
-    err_t lwipErr;
-
-    for (size_t j = 0; j < gNetworkOptions.TapDeviceName.size(); j++)
-    {
-        lwipErr = TapInterface_Init(&(sTapIFs[j]), gNetworkOptions.TapDeviceName[j], NULL);
-        if (lwipErr != ERR_OK)
-        {
-            printf("Failed to initialize tap device %s: %s\n", gNetworkOptions.TapDeviceName[j],
-                   ErrorStr(System::MapErrorLwIP(lwipErr)));
-            exit(EXIT_FAILURE);
-        }
-    }
-#endif // CHIP_TARGET_STYLE_UNIX
-    tcpip_init(OnLwIPInitComplete, NULL);
-
-    // Lock LwIP stack
-    LOCK_TCPIP_CORE();
-
-    for (size_t j = 0; j < gNetworkOptions.TapDeviceName.size(); j++)
-    {
-        std::vector<char *> addrsVec;
-
-        addrsVec.clear();
-
-#if CHIP_TARGET_STYLE_UNIX
-
-        // TapAddrAutoconf and TapInterface are only needed for LwIP on
-        // sockets simulation in which a host tap/tun interface is used to
-        // proxy the LwIP stack onto a host native network interface.
-        // CollectTapAddresses() is only available on such targets.
-        if (gNetworkOptions.TapUseSystemConfig)
-        {
-            CollectTapAddresses(addrsVec, gNetworkOptions.TapDeviceName[j]);
-        }
-#endif // CHIP_TARGET_STYLE_UNIX
-#if INET_CONFIG_ENABLE_IPV4
-
-        IPAddress ip4Addr = (j < gNetworkOptions.LocalIPv4Addr.size()) ? gNetworkOptions.LocalIPv4Addr[j] : IPAddress::Any;
-        for (size_t n = 0; n < addrsVec.size(); n++)
-        {
-            IPAddress auto_addr;
-            if (IPAddress::FromString(addrsVec[n], auto_addr) && auto_addr.IsIPv4())
-            {
-                ip4Addr = auto_addr;
-            }
-        }
-
-#if CHIP_TARGET_STYLE_UNIX
-        // TapAddrAutoconf and TapInterface are only needed for LwIP on
-        // sockets simulation in which a host tap/tun interface is used to
-        // proxy the LwIP stack onto a host native network interface.
-        // CollectTapAddresses() is only available on such targets.
-
-        IPAddress ip4Gateway = (j < gNetworkOptions.IPv4GatewayAddr.size()) ? gNetworkOptions.IPv4GatewayAddr[j] : IPAddress::Any;
-
-        {
-#if LWIP_VERSION_MAJOR > 1
-            ip4_addr_t ip4AddrLwIP, ip4NetmaskLwIP, ip4GatewayLwIP;
-#else  // LWIP_VERSION_MAJOR <= 1
-            ip_addr_t ip4AddrLwIP, ip4NetmaskLwIP, ip4GatewayLwIP;
-#endif // LWIP_VERSION_MAJOR <= 1
-
-            ip4AddrLwIP = ip4Addr.ToIPv4();
-            IP4_ADDR(&ip4NetmaskLwIP, 255, 255, 255, 0);
-            ip4GatewayLwIP = ip4Gateway.ToIPv4();
-            netif_add(&(sNetIFs[j]), &ip4AddrLwIP, &ip4NetmaskLwIP, &ip4GatewayLwIP, &(sTapIFs[j]), TapInterface_SetupNetif,
-                      tcpip_input);
-        }
-#endif // CHIP_TARGET_STYLE_UNIX
-
-#endif // INET_CONFIG_ENABLE_IPV4
-
-        netif_create_ip6_linklocal_address(&(sNetIFs[j]), 1);
-
-#if !(LWIP_VERSION_MAJOR >= 2 && LWIP_VERSION_MINOR >= 1)
-        if (j < gNetworkOptions.LocalIPv6Addr.size())
-        {
-            ip6_addr_t ip6addr = gNetworkOptions.LocalIPv6Addr[j].ToIPv6();
-            s8_t index;
-            netif_add_ip6_address_with_route(&(sNetIFs[j]), &ip6addr, 64, &index);
-            // add ipv6 route for ipv6 address
-            if (j < gNetworkOptions.IPv6GatewayAddr.size())
-            {
-                static ip6_addr_t br_ip6_addr = gNetworkOptions.IPv6GatewayAddr[j].ToIPv6();
-                struct ip6_prefix ip6_prefix;
-                ip6_prefix.addr       = Inet::IPAddress::Any.ToIPv6();
-                ip6_prefix.prefix_len = 0;
-                ip6_add_route_entry(&ip6_prefix, &sNetIFs[j], &br_ip6_addr, NULL);
-            }
-            if (index >= 0)
-            {
-                netif_ip6_addr_set_state(&(sNetIFs[j]), index, IP6_ADDR_PREFERRED);
-            }
-        }
-        for (size_t n = 0; n < addrsVec.size(); n++)
-        {
-            IPAddress auto_addr;
-            if (IPAddress::FromString(addrsVec[n], auto_addr) && !auto_addr.IsIPv4())
-            {
-                ip6_addr_t ip6addr = auto_addr.ToIPv6();
-                s8_t index;
-                if (auto_addr.IsIPv6LinkLocal())
-                    continue; // skip over the LLA addresses, LwIP is aready adding those
-                if (auto_addr.IsIPv6Multicast())
-                    continue; // skip over the multicast addresses from host for now.
-                netif_add_ip6_address_with_route(&(sNetIFs[j]), &ip6addr, 64, &index);
-                if (index >= 0)
-                {
-                    netif_ip6_addr_set_state(&(sNetIFs[j]), index, IP6_ADDR_PREFERRED);
-                }
-            }
-        }
-#endif
-
-        netif_set_up(&(sNetIFs[j]));
-        netif_set_link_up(&(sNetIFs[j]));
-    }
-
-    netif_set_default(&(sNetIFs[0]));
-    // UnLock LwIP stack
-
-    UNLOCK_TCPIP_CORE();
-
-    while (!NetworkIsReady())
-    {
-        struct timeval lSleepTime;
-        lSleepTime.tv_sec  = 0;
-        lSleepTime.tv_usec = 100000;
-        ServiceEvents(lSleepTime);
-    }
-
-    // FIXME: this is kinda nasty :(
-    // Force new IP address to be ready, bypassing duplicate detection.
-
-    for (size_t j = 0; j < gNetworkOptions.TapDeviceName.size(); j++)
-    {
-        if (j < gNetworkOptions.LocalIPv6Addr.size())
-        {
-            netif_ip6_addr_set_state(&(sNetIFs[j]), 2, 0x30);
-        }
-        else
-        {
-            netif_ip6_addr_set_state(&(sNetIFs[j]), 1, 0x30);
-        }
-    }
-
-#if INET_CONFIG_ENABLE_DNS_RESOLVER
-    if (gNetworkOptions.DNSServerAddr != IPAddress::Any)
-    {
-#if LWIP_VERSION_MAJOR > 1 || LWIP_VERSION_MINOR >= 5
-        ip_addr_t dnsServerAddr = gNetworkOptions.DNSServerAddr.ToLwIPAddr();
-#else // LWIP_VERSION_MAJOR <= 1
-#if INET_CONFIG_ENABLE_IPV4
-        ip_addr_t dnsServerAddr = gNetworkOptions.DNSServerAddr.ToIPv4();
-#else // !INET_CONFIG_ENABLE_IPV4
-#error "No support for DNS Resolver without IPv4!"
-#endif // !INET_CONFIG_ENABLE_IPV4
-#endif // LWIP_VERSION_MAJOR > 1 || LWIP_VERSION_MINOR >= 5
-
-        dns_setserver(0, &dnsServerAddr);
-    }
-#endif // INET_CONFIG_ENABLE_DNS_RESOLVER
-
-    PrintNetworkState();
-
-#endif // !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-    AcquireLwIP();
-    lContext = sLwIPEventQueue;
-
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-    gInet.Init(gSystemLayer, lContext);
-}
-
-void ServiceEvents(struct ::timeval & aSleepTime)
-{
-    static bool printed = false;
-
-    if (!printed)
-    {
-#if CHIP_SYSTEM_CONFIG_USE_LWIP && !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-        if (NetworkIsReady())
-#endif
-        {
-            printf("CHIP node ready to service events; PID: %d; PPID: %d\n", getpid(), getppid());
-            fflush(stdout);
-            printed = true;
-        }
-    }
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-    fd_set readFDs, writeFDs, exceptFDs;
-    int numFDs = 0;
-
-    FD_ZERO(&readFDs);
-    FD_ZERO(&writeFDs);
-    FD_ZERO(&exceptFDs);
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-    if (gSystemLayer.State() == System::kLayerState_Initialized)
-        gSystemLayer.PrepareSelect(numFDs, &readFDs, &writeFDs, &exceptFDs, aSleepTime);
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-    if (gInet.State == InetLayer::kState_Initialized)
-        gInet.PrepareSelect(numFDs, &readFDs, &writeFDs, &exceptFDs, aSleepTime);
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-    int selectRes = select(numFDs, &readFDs, &writeFDs, &exceptFDs, &aSleepTime);
-    if (selectRes < 0)
-    {
-        printf("select failed: %s\n", ErrorStr(System::MapErrorPOSIX(errno)));
-        return;
-    }
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-    if (gSystemLayer.State() == System::kLayerState_Initialized)
-    {
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-        static uint32_t sRemainingSystemLayerEventDelay = 0;
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-        gSystemLayer.HandleSelectResult(selectRes, &readFDs, &writeFDs, &exceptFDs);
-
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-        if (gSystemLayer.State() == System::kLayerState_Initialized)
-        {
-            if (sRemainingSystemLayerEventDelay == 0)
-            {
-                gSystemLayer.DispatchEvents();
-                sRemainingSystemLayerEventDelay = gNetworkOptions.EventDelay;
-            }
-            else
-                sRemainingSystemLayerEventDelay--;
-
-            // TODO: Currently timers are delayed by aSleepTime above. A improved solution would have a mechanism to reduce
-            // aSleepTime according to the next timer.
-
-            gSystemLayer.HandlePlatformTimer();
-        }
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-    }
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP && !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-#if CHIP_TARGET_STYLE_UNIX
-    // TapAddrAutoconf and TapInterface are only needed for LwIP on
-    // sockets simulation in which a host tap/tun interface is used to
-    // proxy the LwIP stack onto a host native network interface.
-    // CollectTapAddresses() is only available on such targets.
-
-    TapInterface_Select(&(sTapIFs[0]), &(sNetIFs[0]), aSleepTime, gNetworkOptions.TapDeviceName.size());
-#endif // CHIP_TARGET_STYLE_UNIX
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP && !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-    if (gInet.State == InetLayer::kState_Initialized)
-    {
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-        gInet.HandleSelectResult(selectRes, &readFDs, &writeFDs, &exceptFDs);
-
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-    }
-}
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP && !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-static bool NetworkIsReady()
-{
-    bool ready = true;
-
-    for (size_t j = 0; j < gNetworkOptions.TapDeviceName.size(); j++)
-    {
-        for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++)
-        {
-            if (!ip6_addr_isany(netif_ip6_addr(&(sNetIFs[j]), i)) && ip6_addr_istentative(netif_ip6_addr_state(&(sNetIFs[j]), i)))
-            {
-                ready = false;
-                break;
-            }
-        }
-    }
-    return ready;
-}
-
-static void OnLwIPInitComplete(void * arg)
-{
-    printf("Waiting for addresses assignment...\n");
-}
-
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP && !CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-void ShutdownNetwork()
-{
-    gInet.Shutdown();
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-    ReleaseLwIP();
-#endif
-}
-
-void DumpMemory(const uint8_t * mem, uint32_t len, const char * prefix, uint32_t rowWidth)
-{
-    int indexWidth = snprintf(nullptr, 0, "%X", len);
-
-    if (indexWidth < 4)
-        indexWidth = 4;
-
-    for (uint32_t i = 0; i < len; i += rowWidth)
-    {
-        printf("%s%0*X: ", prefix, indexWidth, i);
-
-        uint32_t rowEnd = i + rowWidth;
-
-        uint32_t j = i;
-        for (; j < rowEnd && j < len; j++)
-            printf("%02X ", mem[j]);
-
-        for (; j < rowEnd; j++)
-            printf("   ");
-
-        for (j = i; j < rowEnd && j < len; j++)
-            if (isprint(static_cast<char>(mem[j])))
-                printf("%c", mem[j]);
-            else
-                printf(".");
-
-        printf("\n");
-    }
-}
-
-void DumpMemory(const uint8_t * mem, uint32_t len, const char * prefix)
-{
-    const uint32_t kRowWidth = 16;
-
-    DumpMemory(mem, len, prefix, kRowWidth);
-}
-
-static void RebootCallbackFn()
-{
-    size_t i;
-    size_t j = 0;
-    chip::Platform::ScopedMemoryBuffer<char *> lArgv;
-    if (!lArgv.Alloc(static_cast<size_t>(sRestartCallbackCtx.mArgc + 2)))
-    {
-        printf("** failed to allocate memory **\n");
-        ExitNow();
-    }
-
-    if (gSigusr1Received)
-    {
-        printf("** skipping restart case after SIGUSR1 **\n");
-        ExitNow();
-    }
-
-    for (i = 0; sRestartCallbackCtx.mArgv[i] != nullptr; i++)
-    {
-        if (strcmp(sRestartCallbackCtx.mArgv[i], "--faults") == 0)
-        {
-            // Skip the --faults argument for now
-            i++;
-            continue;
-        }
-        lArgv[j++] = sRestartCallbackCtx.mArgv[i];
-    }
-
-    lArgv[j] = nullptr;
-
-    for (size_t idx = 0; lArgv[idx] != nullptr; idx++)
-    {
-        printf("argv[%d]: %s\n", static_cast<int>(idx), lArgv[idx]);
-    }
-
-    // Need to close any open file descriptor above stdin/out/err.
-    // There is no portable way to get the max fd number.
-    // Given that CHIP's test apps don't open a large number of files,
-    // FD_SETSIZE should be a reasonable upper bound (see the documentation
-    // of select).
-    for (int fd = 3; fd < FD_SETSIZE; fd++)
-    {
-        close(fd);
-    }
-
-    printf("********** Restarting *********\n");
-    fflush(stdout);
-    execvp(lArgv[0], lArgv.Get());
-
-exit:
-    return;
-}
-
-static void PostInjectionCallbackFn(nl::FaultInjection::Manager * aManager, nl::FaultInjection::Identifier aId,
-                                    nl::FaultInjection::Record * aFaultRecord)
-{
-    uint16_t numargs = aFaultRecord->mNumArguments;
-    uint16_t i;
-
-    printf("***** Injecting fault %s_%s, instance number: %u; reboot: %s", aManager->GetName(), aManager->GetFaultNames()[aId],
-           aFaultRecord->mNumTimesChecked, aFaultRecord->mReboot ? "yes" : "no");
-    if (numargs)
-    {
-        printf(" with %u args:", numargs);
-
-        for (i = 0; i < numargs; i++)
-        {
-            printf(" %d", aFaultRecord->mArguments[i]);
-        }
-    }
-
-    printf("\n");
-}
-
-static bool PrintFaultInjectionMaxArgCbFn(nl::FaultInjection::Manager & mgr, nl::FaultInjection::Identifier aId,
-                                          nl::FaultInjection::Record * aFaultRecord, void * aContext)
-{
-    const char * faultName = mgr.GetFaultNames()[aId];
-
-    if (gFaultInjectionOptions.PrintFaultCounters && aFaultRecord->mNumArguments)
-    {
-        printf("FI_instance_params: %s_%s_s%u maxArg: %u;\n", mgr.GetName(), faultName, aFaultRecord->mNumTimesChecked,
-               aFaultRecord->mArguments[0]);
-    }
-
-    return false;
-}
-
-static bool PrintCHIPFaultInjectionMaxArgCbFn(nl::FaultInjection::Identifier aId, nl::FaultInjection::Record * aFaultRecord,
-                                              void * aContext)
-{
-    nl::FaultInjection::Manager & mgr = chip::FaultInjection::GetManager();
-
-    return PrintFaultInjectionMaxArgCbFn(mgr, aId, aFaultRecord, aContext);
-}
-
-static bool PrintSystemFaultInjectionMaxArgCbFn(nl::FaultInjection::Identifier aId, nl::FaultInjection::Record * aFaultRecord,
-                                                void * aContext)
-{
-    nl::FaultInjection::Manager & mgr = chip::System::FaultInjection::GetManager();
-
-    return PrintFaultInjectionMaxArgCbFn(mgr, aId, aFaultRecord, aContext);
-}
-
-void SetupFaultInjectionContext(int argc, char * argv[])
-{
-    SetupFaultInjectionContext(argc, argv, nullptr, nullptr);
-}
-
-void SetupFaultInjectionContext(int argc, char * argv[], int32_t (*aNumEventsAvailable)(),
-                                void (*aInjectAsyncEvents)(int32_t index))
-{
-    nl::FaultInjection::Manager & weavemgr  = chip::FaultInjection::GetManager();
-    nl::FaultInjection::Manager & systemmgr = chip::System::FaultInjection::GetManager();
-
-    sRestartCallbackCtx.mArgc = argc;
-    sRestartCallbackCtx.mArgv = argv;
-
-    nl::FaultInjection::SetGlobalContext(&sFaultInjectionGlobalContext);
-
-    memset(&sFuzzECHeaderCb, 0, sizeof(sFuzzECHeaderCb));
-    sFuzzECHeaderCb.mCallBackFn = PrintCHIPFaultInjectionMaxArgCbFn;
-    weavemgr.InsertCallbackAtFault(chip::FaultInjection::kFault_FuzzExchangeHeaderTx, &sFuzzECHeaderCb);
-
-    if (aNumEventsAvailable && aInjectAsyncEvents)
-    {
-        memset(&sAsyncEventCb, 0, sizeof(sAsyncEventCb));
-        sAsyncEventCb.mCallBackFn = PrintSystemFaultInjectionMaxArgCbFn;
-        systemmgr.InsertCallbackAtFault(chip::System::FaultInjection::kFault_AsyncEvent, &sAsyncEventCb);
-
-        chip::System::FaultInjection::SetAsyncEventCallbacks(aNumEventsAvailable, aInjectAsyncEvents);
-    }
-}
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index da0e39b..327828e 100644 (file)
 import("//build_overrides/chip.gni")
 import("${chip_root}/src/platform/device.gni")
 
-declare_args() {
-  # Set up what advertiser to use for mDNS advertisement
-  chip_mdns_advertiser = "minimal"
-}
-
 source_set("platform_header") {
   sources = [ "platform/Mdns.h" ]
 }
@@ -33,24 +28,18 @@ static_library("mdns") {
 
   sources = [ "Advertiser.h" ]
 
-  if (chip_enable_mdns) {
-    _chip_mdns_advertiser = chip_mdns_advertiser
-  } else {
-    _chip_mdns_advertiser = "none"
-  }
-
-  if (_chip_mdns_advertiser == "none") {
+  if (chip_mdns == "none") {
     sources += [
       "Advertiser_ImplNone.cpp",
       "Resolver_ImplNone.cpp",
     ]
-  } else if (_chip_mdns_advertiser == "minimal") {
+  } else if (chip_mdns == "minimal") {
     sources += [
       "Advertiser_ImplMinimalMdns.cpp",
       "Resolver_ImplNone.cpp",
     ]
     public_deps += [ "${chip_root}/src/lib/mdns/minimal" ]
-  } else if (_chip_mdns_advertiser == "platform") {
+  } else if (chip_mdns == "platform") {
     sources += [
       "Discovery_ImplPlatform.cpp",
       "Discovery_ImplPlatform.h",
diff --git a/src/lib/mdns/DiscoveryManager.cpp b/src/lib/mdns/DiscoveryManager.cpp
deleted file mode 100644 (file)
index 40c6cf2..0000000
+++ /dev/null
@@ -1,334 +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.
- */
-
-#include "DiscoveryManager.h"
-
-#include <inttypes.h>
-
-#include "lib/mdns/platform/Mdns.h"
-#include "lib/support/logging/CHIPLogging.h"
-#include "platform/CHIPDeviceConfig.h"
-#include "platform/CHIPDeviceLayer.h"
-#include "support/CodeUtils.h"
-#include "support/ErrorStr.h"
-#include "support/RandUtils.h"
-
-#if CHIP_ENABLE_MDNS
-
-namespace {
-
-uint8_t HexToInt(char c)
-{
-    if ('0' <= c && c <= '9')
-    {
-        return static_cast<uint8_t>(c - '0');
-    }
-    else if ('a' <= c && c <= 'f')
-    {
-        return static_cast<uint8_t>(0x0a + c - 'a');
-    }
-    else if ('A' <= c && c <= 'F')
-    {
-        return static_cast<uint8_t>(0x0a + c - 'A');
-    }
-
-    return UINT8_MAX;
-}
-
-constexpr uint64_t kUndefinedNodeId = 0;
-
-} // namespace
-#endif
-
-namespace chip {
-namespace Mdns {
-
-DiscoveryManager DiscoveryManager::sManager;
-
-CHIP_ERROR DiscoveryManager::Init()
-{
-#if CHIP_ENABLE_MDNS
-    CHIP_ERROR error;
-
-    mUnprovisionedInstanceName = GetRandU64();
-    SuccessOrExit(error = ChipMdnsInit(HandleMdnsInit, HandleMdnsError, this));
-exit:
-    return error;
-#else
-    return CHIP_NO_ERROR;
-#endif // CHIP_ENABLE_MDNS
-}
-
-void DiscoveryManager::HandleMdnsInit(void * context, CHIP_ERROR initError)
-{
-#if CHIP_ENABLE_MDNS
-    DiscoveryManager * publisher = static_cast<DiscoveryManager *>(context);
-
-    if (initError == CHIP_NO_ERROR)
-    {
-        publisher->mMdnsInitialized = true;
-    }
-    else
-    {
-        ChipLogError(Discovery, "mDNS initialization failed with %s", chip::ErrorStr(initError));
-    }
-#endif // CHIP_ENABLE_MDNS
-}
-
-void DiscoveryManager::HandleMdnsError(void * context, CHIP_ERROR error)
-{
-#if CHIP_ENABLE_MDNS
-    DiscoveryManager * publisher = static_cast<DiscoveryManager *>(context);
-    if (error == CHIP_ERROR_FORCED_RESET && publisher->mIsPublishing)
-    {
-        publisher->StartPublishDevice();
-    }
-    else
-    {
-        ChipLogError(Discovery, "mDNS error: %s", chip::ErrorStr(error));
-    }
-#endif // CHIP_ENABLE_MDNS
-}
-
-CHIP_ERROR DiscoveryManager::StartPublishDevice(chip::Inet::IPAddressType addressType, chip::Inet::InterfaceId interface)
-{
-#if CHIP_ENABLE_MDNS
-    CHIP_ERROR error;
-
-    // TODO: after multi-admin is decided we may need to publish both _chipc._udp and _chip._tcp service
-    if (!mIsPublishing)
-    {
-        SuccessOrExit(error = SetupHostname());
-    }
-    else if (chip::DeviceLayer::ConfigurationMgr().IsFullyProvisioned() != mIsPublishingProvisionedDevice)
-    {
-        SuccessOrExit(error = StopPublishDevice());
-        // Set hostname again in case the mac address changes when shifting from soft-AP to station
-        SuccessOrExit(error = SetupHostname());
-    }
-    mIsPublishingProvisionedDevice = chip::DeviceLayer::ConfigurationMgr().IsFullyProvisioned();
-
-    if (mIsPublishingProvisionedDevice)
-    {
-        error = PublishProvisionedDevice(addressType, interface);
-    }
-    else
-    {
-        error = PublishUnprovisionedDevice(addressType, interface);
-    }
-    mIsPublishing = true;
-exit:
-    return error;
-#else
-    return CHIP_ERROR_NOT_IMPLEMENTED;
-#endif // CHIP_ENABLE_MDNS
-}
-
-CHIP_ERROR DiscoveryManager::SetupHostname()
-{
-#if CHIP_ENABLE_MDNS
-    uint8_t mac[6];    // 6 byte wifi mac
-    char hostname[13]; // Hostname will be the hex representation of mac.
-    CHIP_ERROR error;
-
-    SuccessOrExit(error = chip::DeviceLayer::ConfigurationMgr().GetPrimaryWiFiMACAddress(mac));
-    for (size_t i = 0; i < sizeof(mac); i++)
-    {
-        snprintf(&hostname[i * 2], sizeof(hostname) - i * 2, "%02X", mac[i]);
-    }
-    SuccessOrExit(error = ChipMdnsSetHostname(hostname));
-
-exit:
-    return error;
-#else
-    return CHIP_ERROR_NOT_IMPLEMENTED;
-#endif // CHIP_ENABLE_MDNS
-}
-
-CHIP_ERROR DiscoveryManager::PublishUnprovisionedDevice(chip::Inet::IPAddressType addressType, chip::Inet::InterfaceId interface)
-{
-#if CHIP_ENABLE_MDNS
-    CHIP_ERROR error = CHIP_NO_ERROR;
-    MdnsService service;
-    uint16_t discriminator;
-    uint16_t vendorID;
-    uint16_t productID;
-    char discriminatorBuf[5];  // hex representation of 16-bit discriminator
-    char vendorProductBuf[10]; // "FFFF+FFFF"
-    // TODO: The text entry will be updated in the spec, update accordingly.
-    TextEntry entries[2] = {
-        { "D", nullptr, 0 },
-        { "VP", nullptr, 0 },
-    };
-
-    VerifyOrExit(mMdnsInitialized, error = CHIP_ERROR_INCORRECT_STATE);
-    ChipLogProgress(Discovery, "setup mdns service");
-    SuccessOrExit(error = chip::DeviceLayer::ConfigurationMgr().GetSetupDiscriminator(discriminator));
-    snprintf(service.mName, sizeof(service.mName), "%016" PRIX64, mUnprovisionedInstanceName);
-    strncpy(service.mType, "_chipc", sizeof(service.mType));
-    service.mProtocol = MdnsServiceProtocol::kMdnsProtocolUdp;
-    SuccessOrExit(error = chip::DeviceLayer::ConfigurationMgr().GetVendorId(vendorID));
-    SuccessOrExit(error = chip::DeviceLayer::ConfigurationMgr().GetProductId(productID));
-    snprintf(discriminatorBuf, sizeof(discriminatorBuf), "%04X", discriminator);
-    snprintf(vendorProductBuf, sizeof(vendorProductBuf), "%04X+%04X", vendorID, productID);
-    entries[0].mData       = reinterpret_cast<const uint8_t *>(discriminatorBuf);
-    entries[0].mDataSize   = strnlen(discriminatorBuf, sizeof(discriminatorBuf));
-    entries[1].mData       = reinterpret_cast<const uint8_t *>(vendorProductBuf);
-    entries[1].mDataSize   = strnlen(discriminatorBuf, sizeof(vendorProductBuf));
-    service.mTextEntryies  = entries;
-    service.mTextEntrySize = sizeof(entries) / sizeof(TextEntry);
-    service.mPort          = CHIP_PORT;
-    service.mInterface     = interface;
-    service.mAddressType   = addressType;
-    error                  = ChipMdnsPublishService(&service);
-
-exit:
-    return error;
-#else
-    return CHIP_ERROR_NOT_IMPLEMENTED;
-#endif // CHIP_ENABLE_MDNS
-}
-
-CHIP_ERROR DiscoveryManager::PublishProvisionedDevice(chip::Inet::IPAddressType addressType, chip::Inet::InterfaceId interface)
-{
-#if CHIP_ENABLE_MDNS
-    uint64_t deviceId;
-    uint64_t fabricId;
-    MdnsService service;
-    CHIP_ERROR error = CHIP_NO_ERROR;
-
-    // TODO: There may be multilple device/fabrid ids after multi-admin.
-    SuccessOrExit(error = chip::DeviceLayer::ConfigurationMgr().GetFabricId(fabricId));
-    SuccessOrExit(error = chip::DeviceLayer::ConfigurationMgr().GetDeviceId(deviceId));
-    snprintf(service.mName, sizeof(service.mName), "%" PRIX64 "-%" PRIX64, deviceId, fabricId);
-    strncpy(service.mType, "_chip", sizeof(service.mType));
-    service.mProtocol      = MdnsServiceProtocol::kMdnsProtocolTcp;
-    service.mPort          = CHIP_PORT;
-    service.mTextEntryies  = nullptr;
-    service.mTextEntrySize = 0;
-    service.mInterface     = interface;
-    service.mAddressType   = addressType;
-    error                  = ChipMdnsPublishService(&service);
-
-exit:
-    return error;
-#else
-    return CHIP_ERROR_NOT_IMPLEMENTED;
-#endif // CHIP_ENABLE_MDNS
-}
-
-CHIP_ERROR DiscoveryManager::StopPublishDevice()
-{
-#if CHIP_ENABLE_MDNS
-    mIsPublishing = false;
-    return ChipMdnsStopPublish();
-#else
-    return CHIP_ERROR_NOT_IMPLEMENTED;
-#endif // CHIP_ENABLE_MDNS
-}
-
-CHIP_ERROR DiscoveryManager::RegisterResolveDelegate(ResolveDelegate * delegate)
-{
-    if (mResolveDelegate != nullptr)
-    {
-        return CHIP_ERROR_INCORRECT_STATE;
-    }
-    else
-    {
-        mResolveDelegate = delegate;
-        return CHIP_NO_ERROR;
-    }
-}
-
-CHIP_ERROR DiscoveryManager::ResolveNodeId(uint64_t nodeId, uint64_t fabricId, Inet::IPAddressType type)
-{
-#if CHIP_ENABLE_MDNS
-    MdnsService service;
-
-    snprintf(service.mName, sizeof(service.mName), "%" PRIX64 "-%" PRIX64, nodeId, fabricId);
-    strncpy(service.mType, "_chip", sizeof(service.mType));
-    service.mProtocol    = MdnsServiceProtocol::kMdnsProtocolTcp;
-    service.mAddressType = type;
-    return ChipMdnsResolve(&service, INET_NULL_INTERFACEID, HandleNodeIdResolve, this);
-#else
-    return CHIP_ERROR_NOT_IMPLEMENTED;
-#endif // CHIP_ENABLE_MDNS
-}
-
-void DiscoveryManager::HandleNodeIdResolve(void * context, MdnsService * result, CHIP_ERROR error)
-{
-#if CHIP_ENABLE_MDNS
-    DiscoveryManager * mgr = static_cast<DiscoveryManager *>(context);
-
-    if (mgr->mResolveDelegate == nullptr)
-    {
-        return;
-    }
-    if (error != CHIP_NO_ERROR)
-    {
-        ChipLogError(Discovery, "Node ID resolved failed with %s", chip::ErrorStr(error));
-        mgr->mResolveDelegate->HandleNodeIdResolve(error, kUndefinedNodeId, MdnsService{});
-    }
-    else if (result == nullptr)
-    {
-        ChipLogError(Discovery, "Node ID resolve not found");
-        mgr->mResolveDelegate->HandleNodeIdResolve(CHIP_ERROR_UNKNOWN_RESOURCE_ID, kUndefinedNodeId, MdnsService{});
-    }
-    else
-    {
-        // Parse '%x-%x' from the name
-        uint64_t nodeId       = 0;
-        bool deliminatorFound = false;
-
-        for (size_t i = 0; i < sizeof(result->mName) && result->mName[i] != 0; i++)
-        {
-            if (result->mName[i] == '-')
-            {
-                deliminatorFound = true;
-                break;
-            }
-            else
-            {
-                uint8_t val = HexToInt(result->mName[i]);
-
-                if (val == UINT8_MAX)
-                {
-                    break;
-                }
-                else
-                {
-                    nodeId = nodeId * 16 + val;
-                }
-            }
-        }
-
-        if (deliminatorFound)
-        {
-            ChipLogProgress(Discovery, "Node ID resolved for %" PRIX64, nodeId);
-            mgr->mResolveDelegate->HandleNodeIdResolve(error, nodeId, *result);
-        }
-        else
-        {
-            ChipLogProgress(Discovery, "Invalid service entry from node %" PRIX64, nodeId);
-            mgr->mResolveDelegate->HandleNodeIdResolve(error, kUndefinedNodeId, *result);
-        }
-    }
-#endif // CHIP_ENABLE_MDNS
-}
-
-} // namespace Mdns
-} // namespace chip
diff --git a/src/lib/mdns/DiscoveryManager.h b/src/lib/mdns/DiscoveryManager.h
deleted file mode 100644 (file)
index 2b83e14..0000000
+++ /dev/null
@@ -1,104 +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"
-#include "inet/InetInterface.h"
-#include "lib/mdns/platform/Mdns.h"
-#include "platform/CHIPDeviceConfig.h"
-
-namespace chip {
-namespace Mdns {
-
-class ResolveDelegate
-{
-public:
-    virtual void HandleNodeIdResolve(CHIP_ERROR error, uint64_t nodeId, const MdnsService & address) = 0;
-    virtual ~ResolveDelegate() {}
-};
-
-class DiscoveryManager
-{
-public:
-    /**
-     * This method initializes the publisher.
-     *
-     */
-    CHIP_ERROR Init();
-
-    /**
-     * This method publishes the device on mDNS.
-     *
-     * This function will fetch device name and other information and publish them
-     * via mDNS. If device meta data has changed, you can call this function again
-     * to update the information.
-     *
-     * @param[in] addressType The protocol version of the IP address.
-     * @param[in] interface   The interface to send mDNS multicast.
-     *
-     */
-    CHIP_ERROR StartPublishDevice(chip::Inet::IPAddressType addressType = chip::Inet::kIPAddressType_Any,
-                                  chip::Inet::InterfaceId interface     = INET_NULL_INTERFACEID);
-
-    /**
-     * This function stops publishing the device on mDNS.
-     *
-     */
-    CHIP_ERROR StopPublishDevice();
-
-    /**
-     * This function registers the delegate to handle node id resolve results.
-     *
-     */
-    CHIP_ERROR RegisterResolveDelegate(ResolveDelegate * delegate);
-
-    /**
-     * This function resolves a node id to its address.
-     *
-     */
-    CHIP_ERROR ResolveNodeId(uint64_t nodeId, uint64_t fabricId, chip::Inet::IPAddressType type = chip::Inet::kIPAddressType_Any);
-
-    static DiscoveryManager & GetInstance() { return sManager; }
-
-private:
-    DiscoveryManager() = default;
-
-    DiscoveryManager(const DiscoveryManager &) = delete;
-    DiscoveryManager & operator=(const DiscoveryManager &) = delete;
-
-    CHIP_ERROR PublishUnprovisionedDevice(chip::Inet::IPAddressType addressType, chip::Inet::InterfaceId interface);
-    CHIP_ERROR PublishProvisionedDevice(chip::Inet::IPAddressType addressType, chip::Inet::InterfaceId interface);
-    CHIP_ERROR SetupHostname();
-
-    static void HandleNodeIdResolve(void * context, MdnsService * result, CHIP_ERROR error);
-    static void HandleMdnsInit(void * context, CHIP_ERROR initError);
-    static void HandleMdnsError(void * context, CHIP_ERROR initError);
-
-#if CHIP_ENABLE_MDNS
-    uint64_t mUnprovisionedInstanceName;
-    bool mMdnsInitialized               = false;
-    bool mIsPublishingProvisionedDevice = false;
-    bool mIsPublishing                  = false;
-#endif // CHIP_ENABLE_MDNS
-    ResolveDelegate * mResolveDelegate = nullptr;
-
-    static DiscoveryManager sManager;
-};
-
-} // namespace Mdns
-} // namespace chip
index eb71243..ab35b58 100644 (file)
@@ -57,28 +57,39 @@ constexpr uint64_t kUndefinedNodeId = 0;
 namespace chip {
 namespace Mdns {
 
-DiscoveryImplPlatform::DiscoveryImplPlatform()
-{
-    mCommissionInstanceName = GetRandU64();
-}
+DiscoveryImplPlatform DiscoveryImplPlatform::sManager;
 
-CHIP_ERROR DiscoveryImplPlatform::Start(Inet::InetLayer * inetLayer, uint16_t port)
+DiscoveryImplPlatform::DiscoveryImplPlatform() = default;
+
+CHIP_ERROR DiscoveryImplPlatform::Init()
 {
-    CHIP_ERROR error = CHIP_NO_ERROR;
     if (!mMdnsInitialized)
     {
         ReturnErrorOnFailure(ChipMdnsInit(HandleMdnsInit, HandleMdnsError, this));
-        mMdnsInitialized = true;
+        mCommissionInstanceName = GetRandU64();
+        mMdnsInitialized        = true;
     }
-    else
+
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR DiscoveryImplPlatform::Start(Inet::InetLayer * inetLayer, uint16_t port)
+{
+    ReturnErrorOnFailure(Init());
+
+    CHIP_ERROR error = ChipMdnsStopPublish();
+
+    if (error != CHIP_NO_ERROR)
     {
-        error = ChipMdnsStopPublish();
+        ChipLogError(Discovery, "Failed to initialize platform mdns: %s", ErrorStr(error));
     }
 
+    error = SetupHostname();
     if (error != CHIP_NO_ERROR)
     {
-        ChipLogError(Discovery, "Failed to initialize platform mdns: %s", ErrorStr(error));
+        ChipLogError(Discovery, "Failed to setup mdns hostname: %s", ErrorStr(error));
     }
+
     return error;
 }
 
@@ -137,6 +148,13 @@ exit:
 
 CHIP_ERROR DiscoveryImplPlatform::SetupHostname()
 {
+#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
+    static char hostname[17]; // Hostname is 64-bit EUI-64 expressed as a 16-character hexadecimal string.
+    uint8_t eui64[8];
+    chip::DeviceLayer::ThreadStackMgr().GetFactoryAssignedEUI64(eui64);
+    snprintf(hostname, sizeof(hostname), "%02X%02X%02X%02X%02X%02X%02X%02X", eui64[0], eui64[1], eui64[2], eui64[3], eui64[4],
+             eui64[5], eui64[6], eui64[7]);
+#else
     uint8_t mac[6];    // 6 byte wifi mac
     char hostname[13]; // Hostname will be the hex representation of mac.
 
@@ -145,6 +163,8 @@ CHIP_ERROR DiscoveryImplPlatform::SetupHostname()
     {
         snprintf(&hostname[i * 2], sizeof(hostname) - i * 2, "%02X", mac[i]);
     }
+#endif
+
     ReturnErrorOnFailure(ChipMdnsSetHostname(hostname));
 
     return CHIP_NO_ERROR;
@@ -251,7 +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), "%" PRIX64 "-%" PRIX64, params.GetNodeId(), params.GetFabricId());
+    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()));
     strncpy(service.mType, "_chip", sizeof(service.mType));
     service.mProtocol      = MdnsServiceProtocol::kMdnsProtocolTcp;
     service.mPort          = CHIP_PORT;
@@ -280,6 +301,8 @@ CHIP_ERROR DiscoveryImplPlatform::SetResolverDelegate(ResolverDelegate * delegat
 
 CHIP_ERROR DiscoveryImplPlatform::ResolveNodeId(uint64_t nodeId, uint64_t fabricId, Inet::IPAddressType type)
 {
+    ReturnErrorOnFailure(Init());
+
     MdnsService service;
 
     snprintf(service.mName, sizeof(service.mName), "%" PRIX64 "-%" PRIX64, nodeId, fabricId);
@@ -357,12 +380,6 @@ void DiscoveryImplPlatform::HandleNodeIdResolve(void * context, MdnsService * re
 
 DiscoveryImplPlatform & DiscoveryImplPlatform::GetInstance()
 {
-    // TODO: Clean Mdns initialization order
-    // Previously sManager was a global object, but DiscoveryImplPlatform constructor calls
-    // platform-specific ChipMdnsInit() which for Linux initializes MdnsAvahi global object
-    // and that may lead to improper initialization, since the order in which global objects'
-    // constructors are called is undefined.
-    static DiscoveryImplPlatform sManager;
     return sManager;
 }
 
index 1bc367f..c05e227 100644 (file)
@@ -30,6 +30,8 @@ namespace Mdns {
 class DiscoveryImplPlatform : public ServiceAdvertiser, public Resolver
 {
 public:
+    CHIP_ERROR Init();
+
     CHIP_ERROR Start(Inet::InetLayer * inetLayer, uint16_t port) override;
 
     /// Advertises the CHIP node as an operational node
diff --git a/src/lib/mdns/minimal/BytesRange.h b/src/lib/mdns/minimal/BytesRange.h
deleted file mode 100644 (file)
index 73e4170..0000000
+++ /dev/null
@@ -1,54 +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 <cstddef>
-#include <cstdint>
-
-namespace mdns {
-namespace Minimal {
-
-/// Simple range of bytes with a start and an end
-class BytesRange
-{
-public:
-    BytesRange() {}
-    BytesRange(const uint8_t * start, const uint8_t * end) : mStart(start), mEnd(end)
-    {
-        // negative ranges are not allowed
-        if (mStart > mEnd)
-        {
-            mEnd = mStart;
-        }
-    }
-
-    const uint8_t * Start() const { return mStart; }
-    const uint8_t * End() const { return mEnd; }
-
-    bool Contains(const uint8_t * p) const { return ((p >= mStart) && (p < mEnd)); }
-
-    size_t Size() const { return static_cast<size_t>(mEnd - mStart); }
-
-private:
-    const uint8_t * mStart = nullptr;
-    const uint8_t * mEnd   = nullptr;
-};
-
-} // namespace Minimal
-
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/Constants.h b/src/lib/mdns/minimal/Constants.h
deleted file mode 100644 (file)
index d709c40..0000000
+++ /dev/null
@@ -1,65 +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 <cstdint>
-
-namespace mdns {
-namespace Minimal {
-
-// Assigned by IANA: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
-enum class QType : uint16_t
-{
-    A         = 1,
-    NS        = 2,
-    CNAME     = 5,
-    SOA       = 6,
-    NULLVALUE = 10,
-    WKS       = 11,
-    PTR       = 12,
-    HINFO     = 13,
-    MINFO     = 14,
-    MX        = 15,
-    TXT       = 16,
-    ISDN      = 20,
-    AAAA      = 28,
-    SRV       = 33,
-    DNAM      = 39,
-    ANY       = 255,
-};
-
-/// Flag encoded in QCLASS requesting unicast answers
-constexpr uint16_t kQClassUnicastAnswerFlag = 0x8000;
-
-enum class QClass : uint16_t
-{
-    IN  = 1,
-    ANY = 255,
-
-    // Unicast version for the class
-    IN_UNICAST = IN | kQClassUnicastAnswerFlag,
-};
-
-enum class ResourceType
-{
-    kAnswer,
-    kAuthority,
-    kAdditional,
-};
-
-} // namespace Minimal
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/DnsHeader.h b/src/lib/mdns/minimal/DnsHeader.h
deleted file mode 100644 (file)
index 84cfb71..0000000
+++ /dev/null
@@ -1,162 +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/CHIPEncoding.h>
-
-namespace mdns {
-namespace Minimal {
-
-/**
- * Wrapper around a MDNS bit-packed flags in a DNS header as defined in
- * RFC 1035 and RFC 6762
- *
- * | 0| 1 2 3 4| 5| 6| 7| 8| 9| 0| 1| 2 3 4 5 |
- * |QR| OPCODE |AA|TC|RD|RA| Z|AD|CD| RCODE   |
- *
- * RFC 6762 states:
- *   - OPCODE must be 0 on transmission and queries received that are not 0 MUST be ignored
- *   - RCODE must be 0 on transmission and messages received with non-zero must be silently ignored
- *
- *   - AA (Authoritative Answer) MUST be 0 on transmission, ignored on reception
- *   - RD (Recursion desired) MUST be 0 on transmission, ignored on reception
- *   - RA (Recursion available) MUST be 0 on transmission, ignored on reception
- *   - AD (Authentic data) MUST be 0 on transmission, ignored on reception
- *   - CD (Checking Disabled) MUST be 0 on transmission, ignored on reception
- *
- * Accessors are only provided on useful values
- */
-class BitPackedFlags
-{
-public:
-    explicit BitPackedFlags(uint16_t value) : mValue(value) {}
-
-    uint16_t RawValue() const { return mValue & kMdnsNonIgnoredMask; }
-
-    bool IsQuery() const { return (mValue & kIsResponseMask) == 0; }
-    BitPackedFlags & SetQuery() { return ClearMask(kIsResponseMask); }
-
-    bool IsResponse() const { return (mValue & kIsResponseMask) == kIsResponseMask; }
-    BitPackedFlags & SetResponse() { return SetMask(kIsResponseMask); }
-
-    bool IsTruncated() const { return (mValue & kTruncationMask) != 0; }
-    BitPackedFlags & SetTruncated(bool value) { return value ? SetMask(kTruncationMask) : ClearMask(kTruncationMask); }
-
-    /// Validates that the message does not need to be ignored according to
-    /// RFC 6762
-    bool IsValidMdns() const { return (mValue & (kOpcodeMask | kReturnCodeMask)) == 0; }
-
-private:
-    uint16_t mValue = 0;
-
-    inline BitPackedFlags & ClearMask(uint16_t mask)
-    {
-        mValue &= static_cast<uint16_t>(~mask);
-        return *this;
-    }
-
-    inline BitPackedFlags & SetMask(uint16_t mask)
-    {
-        mValue |= mask;
-        return *this;
-    }
-
-    // Mask to limit values to what RFC 6762 consideres useful
-    // 1111 1010 0000 0000 = FA0F
-    static constexpr uint16_t kMdnsNonIgnoredMask = 0x8A08;
-
-    static constexpr uint16_t kIsResponseMask = 0x8000;
-    static constexpr uint16_t kOpcodeMask     = 0x7000;
-    static constexpr uint16_t kTruncationMask = 0x0400;
-    static constexpr uint16_t kReturnCodeMask = 0x000F;
-};
-
-/**
- * Allows operations on a DNS header. A DNS Header is defined in RFC 1035
- * and looks like this:
- *
- * | 0| 1 2 3 4| 5| 6| 7| 8| 9| 0| 1| 2 3 4 5 |
- * |               Message ID                 |
- * |QR| OPCODE |AA|TC|RD|RA| Z|AD|CD| RCODE   |
- * |       Items in QUESTION Section          |
- * |       Items in ANSWER Section            |
- * |       Items in AUTHORITY Section         |
- * |       Items in ADDITIONAL Section        |
- */
-class ConstHeaderRef
-{
-public:
-    static constexpr size_t kSizeBytes = 12; /// size of a DNS header structure
-    ConstHeaderRef(const uint8_t * buffer) : mBuffer(buffer) {}
-
-    uint16_t GetMessageId() const { return Get16At(kMessageIdOffset); }
-
-    BitPackedFlags GetFlags() const { return BitPackedFlags(Get16At(kFlagsOffset)); }
-
-    uint16_t GetQueryCount() const { return Get16At(kQueryCountOffset); }
-    uint16_t GetAnswerCount() const { return Get16At(kAnswerCountOffset); }
-    uint16_t GetAuthorityCount() const { return Get16At(kAuthorityCountOffset); }
-    uint16_t GetAdditionalCount() const { return Get16At(kAdditionalCountOffset); }
-
-protected:
-    const uint8_t * mBuffer;
-
-    inline uint16_t Get16At(size_t offset) const { return chip::Encoding::BigEndian::Get16(mBuffer + offset); }
-    uint16_t GetRawFlags() const { return Get16At(kFlagsOffset); }
-
-    static constexpr size_t kMessageIdOffset       = 0;
-    static constexpr size_t kFlagsOffset           = 2;
-    static constexpr size_t kQueryCountOffset      = 4;
-    static constexpr size_t kAnswerCountOffset     = 6;
-    static constexpr size_t kAuthorityCountOffset  = 8;
-    static constexpr size_t kAdditionalCountOffset = 10;
-};
-
-class HeaderRef : public ConstHeaderRef
-{
-public:
-    HeaderRef(uint8_t * buffer) : ConstHeaderRef(buffer) {}
-
-    HeaderRef & Clear()
-    {
-        memset(GetWritable(), 0, kSizeBytes);
-        return *this;
-    }
-
-    HeaderRef & SetMessageId(uint16_t value) { return Set16At(kMessageIdOffset, value); }
-    HeaderRef & SetFlags(BitPackedFlags flags) { return Set16At(kFlagsOffset, flags.RawValue()); }
-    HeaderRef & SetQueryCount(uint16_t value) { return Set16At(kQueryCountOffset, value); }
-    HeaderRef & SetAnswerCount(uint16_t value) { return Set16At(kAnswerCountOffset, value); }
-    HeaderRef & SetAuthorityCount(uint16_t value) { return Set16At(kAuthorityCountOffset, value); }
-    HeaderRef & SetAdditionalCount(uint16_t value) { return Set16At(kAdditionalCountOffset, value); }
-
-private:
-    /// Returns the internal buffer as writable. Const-cast is correct because
-    /// the construct took a non-const buffer as well.
-    uint8_t * GetWritable() { return const_cast<uint8_t *>(mBuffer); }
-
-    inline HeaderRef & Set16At(size_t offset, uint16_t value)
-    {
-        chip::Encoding::BigEndian::Put16(GetWritable() + offset, value);
-        return *this;
-    }
-
-    HeaderRef & SetRawFlags(uint16_t value) { return Set16At(kFlagsOffset, value); }
-};
-
-} // namespace Minimal
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/IPResourceRecord.cpp b/src/lib/mdns/minimal/IPResourceRecord.cpp
deleted file mode 100644 (file)
index 08fa6fd..0000000
+++ /dev/null
@@ -1,41 +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.
- */
-
-#include "IPResourceRecord.h"
-
-namespace mdns {
-namespace Minimal {
-
-bool IPResourceRecord::WriteData(chip::BufBound & out) const
-{
-    // IP address is already stored in network byte order. We cannot use
-    // PutBE/PutLE
-
-    if (mIPAddress.IsIPv6())
-    {
-        out.Put(mIPAddress.Addr, 16);
-    }
-    else
-    {
-        out.Put(mIPAddress.Addr + 3, 4);
-    }
-
-    return out.Fit();
-}
-
-} // namespace Minimal
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/IPResourceRecord.h b/src/lib/mdns/minimal/IPResourceRecord.h
deleted file mode 100644 (file)
index 1a77fc8..0000000
+++ /dev/null
@@ -1,43 +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 <inet/IPAddress.h>
-
-#include "ResourceRecord.h"
-
-namespace mdns {
-namespace Minimal {
-
-class IPResourceRecord : public ResourceRecord
-{
-public:
-    IPResourceRecord(const QNamePart * names, uint16_t namesCount, const chip::Inet::IPAddress & ip) :
-        ResourceRecord(ip.IsIPv6() ? QType::AAAA : QType::A, names, namesCount), mIPAddress(ip)
-    {}
-
-protected:
-    bool WriteData(chip::BufBound & out) const override;
-
-private:
-    const chip::Inet::IPAddress mIPAddress;
-};
-
-} // namespace Minimal
-
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/QName.cpp b/src/lib/mdns/minimal/QName.cpp
deleted file mode 100644 (file)
index f09a429..0000000
+++ /dev/null
@@ -1,138 +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.
- */
-#include <assert.h>
-
-#include "QName.h"
-
-namespace mdns {
-namespace Minimal {
-
-bool SerializedQNameIterator::Next()
-{
-    return mIsValid && Next(true);
-}
-
-bool SerializedQNameIterator::Next(bool followIndirectPointers)
-{
-    if (!mIsValid)
-    {
-        return false;
-    }
-
-    while (true)
-    {
-        assert(mValidData.Contains(mCurrentPosition));
-
-        const uint8_t length = *mCurrentPosition;
-        if (*mCurrentPosition == 0)
-        {
-            // Done with all items
-            return false;
-        }
-
-        if ((length & kPtrMask) == kPtrMask)
-        {
-            if (!followIndirectPointers)
-            {
-                // Stop at first indirect pointer
-                return false;
-            }
-
-            // PTR contains 2 bytes
-            if (!mValidData.Contains(mCurrentPosition + 1))
-            {
-                mIsValid = false;
-                return false;
-            }
-
-            size_t offset = ((*mCurrentPosition & 0x3F) << 8) | *(mCurrentPosition + 1);
-            if (offset > mLookBehindMax)
-            {
-                // Potential infinite recursion.
-                mIsValid = false;
-                return false;
-            }
-            if (offset > mValidData.Size())
-            {
-                // offset too large
-                mIsValid = false;
-                return false;
-            }
-
-            mLookBehindMax   = offset;
-            mCurrentPosition = mValidData.Start() + offset;
-        }
-        else
-        {
-            // This branch handles non-pointer data. This will be string of size [length].
-            if (length > kMaxValueSize)
-            {
-                // value is too large (larger than RFC limit)
-                mIsValid = false;
-                return false;
-            }
-
-            if (!mValidData.Contains(mCurrentPosition + 1 + length))
-            {
-                // string outside valid data
-                mIsValid = false;
-                return false;
-            }
-
-            memcpy(mValue, mCurrentPosition + 1, length);
-            mValue[length]   = '\0';
-            mCurrentPosition = mCurrentPosition + length + 1;
-            return true;
-        }
-    }
-}
-
-const uint8_t * SerializedQNameIterator::FindDataEnd()
-{
-    while (Next(false))
-    {
-        // nothing to do, just advance
-    }
-
-    if (!IsValid())
-    {
-        return nullptr;
-    }
-
-    // normal end
-    if (*mCurrentPosition == 0)
-    {
-        // mCurrentPosition MUST already be valid
-        return mCurrentPosition + 1;
-    }
-
-    // ends with a dataptr
-    if ((*mCurrentPosition & kPtrMask) == kPtrMask)
-    {
-        if (!mValidData.Contains(mCurrentPosition + 1))
-        {
-            return nullptr;
-        }
-        return mCurrentPosition + 2;
-    }
-
-    // invalid data
-    return nullptr;
-}
-
-} // namespace Minimal
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/QName.h b/src/lib/mdns/minimal/QName.h
deleted file mode 100644 (file)
index 7b8339d..0000000
+++ /dev/null
@@ -1,91 +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 <string.h>
-
-#include <cstddef>
-#include <cstdint>
-#include <utility>
-
-#include <core/CHIPEncoding.h>
-
-#include "BytesRange.h"
-#include "DnsHeader.h"
-
-namespace mdns {
-namespace Minimal {
-
-/// A QName part is a null-terminated string
-using QNamePart = const char *;
-
-/// A serialized QNAME is comprised of
-///  - length-prefixed parts
-///  - Ends in a 0-length item
-///  - May contain pointers to previous data (for efficient transmission)
-///
-/// This class allows iterating over such parts while validating
-/// that the parts are within a valid range
-class SerializedQNameIterator
-{
-public:
-    SerializedQNameIterator() : mLookBehindMax(0), mCurrentPosition(nullptr), mIsValid(false) {}
-    SerializedQNameIterator(const SerializedQNameIterator &) = default;
-    SerializedQNameIterator & operator=(const SerializedQNameIterator &) = default;
-
-    SerializedQNameIterator(const BytesRange validData, const uint8_t * position) :
-        mValidData(validData), mLookBehindMax(static_cast<size_t>(position - validData.Start())), mCurrentPosition(position)
-    {}
-
-    /// Advances to the next element in the sequence
-    /// Returns true if new data was available
-    bool Next();
-
-    /// Find out if the data parsing is ok.
-    /// If invalid data is encountered during a [Next] call, this will
-    /// return false. Check this after Next returns false.
-    bool IsValid() const { return mIsValid; }
-
-    /// Valid IFF Next() returned true.
-    /// Next has to be called after construction
-    QNamePart Value() const { return mValue; }
-
-    /// Get the end of the sequence *without* following any
-    /// backwards pointers. Changes iterator state.
-    ///
-    /// returs nullptr on error (invalid data)
-    const uint8_t * FindDataEnd();
-
-private:
-    static constexpr size_t kMaxValueSize = 63;
-    static constexpr uint8_t kPtrMask     = 0xC0;
-
-    BytesRange mValidData;
-    size_t mLookBehindMax; // avoid loops by limiting lookbehind
-    const uint8_t * mCurrentPosition;
-    bool mIsValid = true;
-
-    char mValue[kMaxValueSize + 1] = { 0 };
-
-    // Advances to the next element in the sequence
-    bool Next(bool followIndirectPointers);
-};
-
-} // namespace Minimal
-
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/ResourceRecord.cpp b/src/lib/mdns/minimal/ResourceRecord.cpp
deleted file mode 100644 (file)
index e7ee749..0000000
+++ /dev/null
@@ -1,81 +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.
- */
-
-#include "ResourceRecord.h"
-
-namespace mdns {
-namespace Minimal {
-
-bool ResourceRecord::Append(HeaderRef & hdr, ResourceType asType, chip::BufBound & out) const
-{
-    // order is important based on resource type. First come answers, then authorityAnswers
-    // and then additional:
-    if ((asType == ResourceType::kAuthority) && (hdr.GetAdditionalCount() != 0))
-    {
-        return false;
-    }
-    if ((asType == ResourceType::kAnswer) && ((hdr.GetAdditionalCount() != 0) || (hdr.GetAuthorityCount() != 0)))
-    {
-        return false;
-    }
-
-    // Write all QName parts
-    for (uint16_t i = 0; i < mQNameCount; i++)
-    {
-
-        out.Put8(strlen(mQName[i]));
-        out.Put(mQName[i]);
-    }
-    out.Put8(0); // end of qnames
-
-    out                                             //
-        .PutBE16(static_cast<uint16_t>(GetClass())) //
-        .PutBE16(static_cast<uint16_t>(GetType()))  //
-        .PutBE32(static_cast<uint32_t>(GetTtl()))   //
-        ;
-
-    chip::BufBound sizeOutput(out);        // copy to re-output size
-    out.PutBE16(static_cast<uint32_t>(0)); // dummy, will be replaced later
-
-    if (!WriteData(out))
-    {
-        return false;
-    }
-    sizeOutput.PutBE16(static_cast<uint16_t>(out.Needed() - sizeOutput.Needed() - 2));
-
-    // This MUST be final and separated out: record count is only updated on success.
-    if (out.Fit())
-    {
-        switch (asType)
-        {
-        case ResourceType::kAdditional:
-            hdr.SetAdditionalCount(hdr.GetAdditionalCount() + 1);
-            break;
-        case ResourceType::kAuthority:
-            hdr.SetAuthorityCount(hdr.GetAuthorityCount() + 1);
-            break;
-        case ResourceType::kAnswer:
-            hdr.SetAnswerCount(hdr.GetAnswerCount() + 1);
-            break;
-        }
-    }
-
-    return out.Fit();
-}
-
-} // namespace Minimal
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/ResourceRecord.h b/src/lib/mdns/minimal/ResourceRecord.h
deleted file mode 100644 (file)
index a14e068..0000000
+++ /dev/null
@@ -1,66 +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 <cstddef>
-
-#include "Constants.h"
-#include "QName.h"
-
-#include <support/BufBound.h>
-
-namespace mdns {
-namespace Minimal {
-
-/// A generic Reply record that supports data serialization
-class ResourceRecord
-{
-public:
-    virtual ~ResourceRecord() {}
-
-    QClass GetClass() const { return QClass::IN; }
-    QType GetType() const { return mType; }
-
-    uint64_t GetTtl() const { return mTtl; }
-    ResourceRecord & SetTtl(uint64_t ttl)
-    {
-        mTtl = ttl;
-        return *this;
-    }
-
-    /// Append the given record to the underlying output.
-    /// Updates header item count on success, does NOT update header on failure.
-    bool Append(HeaderRef & hdr, ResourceType asType, chip::BufBound & out) const;
-
-protected:
-    /// Output the data portion of the resource record.
-    virtual bool WriteData(chip::BufBound & out) const = 0;
-
-    ResourceRecord(QType type, const QNamePart * names, uint16_t namesCount) : mType(type), mQNameCount(namesCount), mQName(names)
-    {}
-
-private:
-    const QType mType;
-    uint64_t mTtl = 0;
-
-    const uint16_t mQNameCount;
-    const QNamePart * mQName;
-};
-
-} // namespace Minimal
-} // namespace mdns
diff --git a/src/lib/mdns/minimal/format_test.py b/src/lib/mdns/minimal/format_test.py
deleted file mode 100755 (executable)
index ec5ae38..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-import asyncio
-import coloredlogs
-import logging
-from dataclasses import dataclass
-
-from construct import *
-
-LOCAL_ADDR = ("0.0.0.0", 5388)
-# LOCAL_ADDR = ("::%178", 5388)
-
-DEST_ADDR = ("224.0.0.251", 5353)
-# DEST_ADDR = ("ff02::fb", 5353)
-
-
-QUERY_QNAME = "_googlecast._tcp.local"
-
-def EndsWithEmpty(x, lst, ctx):
-  return not x
-
-
-class QNameValidator(Validator):
-
-  def _validate(self, obj, context, path):
-    return obj[-1] == ""
-
-
-class QNameArrayAdapter(Adapter):
-
-  def _decode(self, obj, context, path):
-    return ".".join(map(str, obj[:-1]))
-
-  def _encode(self, obj, context, path):
-    return list(map(str, obj.split("."))) + [""]
-
-
-@dataclass
-class AnswerPtr:
-  offset: int
-
-
-class AnswerPart(Subconstruct):
-
-  def __init__(self):
-    self.name = "AnswerPart"
-    self.subcon = PascalString
-    self.flagbuildnone = False
-    self.parsed = None
-
-  def _parse(self, stream, context, path):
-    # read from the stream
-    # return object
-    len = stream.read(1)[0]
-
-    if (len & 0xC0) == 0xC0:
-      l2 = stream.read(1)[0]
-      return AnswerPtr(((len & 0x3F) << 8) | l2)
-    else:
-      return stream.read(len)
-
-  def _build(self, obj, stream, context, path):
-    # write obj to the stream
-    # return same value (obj) or a modified value
-    # that will replace the context dictionary entry
-    raise Error("Answer part build not yet implemented")
-
-  def _sizeof(self, context, path):
-    # return computed size (when fixed size or depends on context)
-    # or raise SizeofError (when variable size or unknown)
-    raise SizeofError("Answer part has avariable size")
-
-
-def EndsWithEmptyOrPointer(x, lst, ctx):
-  return (not x) or isinstance(x, AnswerPtr)
-
-
-class IpAddressAdapter(Adapter):
-
-  def _decode(self, obj, context, path):
-    return ".".join(map(str, obj))
-
-  def _encode(self, obj, context, path):
-    return list(map(int, obj.split(".")))
-
-
-IpAddress = IpAddressAdapter(Byte[4])
-
-HEX = HexDump(GreedyBytes)
-
-QNAME = QNameArrayAdapter(
-    QNameValidator(RepeatUntil(EndsWithEmpty, PascalString(Byte, "utf8"))))
-
-DNSAnswer = Struct(
-    "NAME" / RepeatUntil(EndsWithEmptyOrPointer, AnswerPart()),
-    "TYPE" / Enum(
-        Int16ub,
-        A=1,
-        NS=2,
-        CNAME=5,
-        SOA=6,
-        WKS=11,
-        PTR=12,
-        MX=15,
-        TXT=16,
-        AAA=28,
-        SRV=33,
-    ),
-    "CLASS" / BitStruct(
-        "FlushCache" / Flag,
-        "CLASS" / Enum(BitsInteger(15), IN=1),
-    ),
-    "TTL" / Int32ub,
-    "RDATA" / Prefixed(
-        Int16ub,
-        Switch(
-            this.TYPE, {
-                "TXT": GreedyRange(PascalString(Byte, "utf8")),
-                "A": IpAddress,
-                "AAAA": Array(16, Byte),
-                "PTR": RepeatUntil(EndsWithEmptyOrPointer, AnswerPart()),
-            },
-            default=GreedyBytes)),
-)
-
-DNSQuery = Struct(
-    "ID" / Int16ub,
-    "Control" / BitStruct(
-        "QR" / Default(Flag, False),
-        "OpCode" /
-        Default(Enum(BitsInteger(4), QUERY=0, IQUERY=1, STATUS=2), "QUERY"),
-        "AA" / Default(Flag, False),
-        "TC" / Default(Flag, False),
-        "RD" / Default(Flag, False),
-        "RA" / Default(Flag, False),
-        "Z" / Padding(1),
-        "AD" / Default(Flag, False),
-        "CD" / Default(Flag, False),
-        "Rcode" / Default(
-            Enum(
-                BitsInteger(4),
-                OK=0,
-                FORMAT_ERROR=1,
-                SERVER_FAILURE=2,
-                NAME_ERROR=3,
-                NOT_IMPLEMENTED=4,
-                REFUSED=5,
-            ),
-            "OK",
-        ),
-    ),
-    "QuestionCount" / Rebuild(Int16ub, len_(this.Questions)),
-    "AnswerCount" / Rebuild(Int16ub, len_(this.Answers)),
-    "AuthorityCount" / Rebuild(Int16ub, len_(this.Authorities)),
-    "AdditionalCount" / Rebuild(Int16ub, len_(this.Additionals)),
-    "Questions" / Array(
-        this.QuestionCount,
-        Struct(
-            "QNAME" / QNAME,
-            "QTYPE" / Default(
-                Enum(
-                    Int16ub,
-                    A=1,
-                    NS=2,
-                    CNAME=5,
-                    SOA=6,
-                    WKS=11,
-                    PTR=12,
-                    MX=15,
-                    SRV=33,
-                    AAAA=28,
-                    ANY=255,
-                ), "ANY"),
-            "QCLASS" / BitStruct(
-                "Unicast" / Default(Flag, False),
-                "Class" / Default(Enum(BitsInteger(15), IN=1, ANY=255), "IN"),
-            ),
-        ),
-    ),
-    "Answers" / Default(Array(this.AnswerCount, DNSAnswer), []),
-    "Authorities" / Default(Array(this.AuthorityCount, DNSAnswer), []),
-    "Additionals" / Default(Array(this.AdditionalCount, DNSAnswer), []),
-)
-
-
-class EchoClientProtocol:
-
-  def __init__(self, on_con_lost):
-    self.on_con_lost = on_con_lost
-    self.transport = None
-
-  def connection_made(self, transport):
-    self.transport = transport
-
-    query = DNSQuery.build({
-        "ID": 0x1234,
-        "Questions": [
-            {
-                "QNAME": QUERY_QNAME,
-                "QCLASS": {
-                    "Unicast": True
-                }
-            },
-        ],
-        "Answers": [],
-        "Authorities": [],
-        "Additionals": [],
-    })
-
-    logging.info("Connection made")
-    logging.info("Sending:\n%s", DNSQuery.parse(query))
-    logging.info("BINARY:\n%s", HEX.parse(query))
-
-    self.transport.sendto(query, DEST_ADDR)
-
-    logging.info("Query sent")
-
-  def datagram_received(self, data, addr):
-    logging.info("Received reply from: %r", addr)
-    logging.debug(HEX.parse(data))
-    logging.info(DNSQuery.parse(data))
-
-  def error_received(self, exc):
-    logging.error("Error")
-
-  def connection_lost(self, exc):
-    logging.error("Lost connection")
-    self.on_con_lost.set_result(True)
-
-
-async def main():
-  loop = asyncio.get_running_loop()
-
-  client_done = loop.create_future()
-
-  transport, protocol = await loop.create_datagram_endpoint(
-      lambda: EchoClientProtocol(client_done),
-      local_addr=LOCAL_ADDR
-  )
-
-  try:
-    await client_done
-  finally:
-    transport.close()
-
-
-if __name__ == "__main__":
-  parser = argparse.ArgumentParser(description="mDNS test app")
-  parser.add_argument(
-      "--log-level",
-      default=logging.INFO,
-      type=lambda x: getattr(logging, x),
-      help="Configure the logging level.",
-  )
-  args = parser.parse_args()
-
-  logging.basicConfig(
-      level=args.log_level,
-      format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
-  )
-  coloredlogs.install(level=args.log_level)
-
-  asyncio.run(main())
diff --git a/src/lib/mdns/minimal/tests/TestIPResourceRecord.cpp b/src/lib/mdns/minimal/tests/TestIPResourceRecord.cpp
deleted file mode 100644 (file)
index a327224..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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 <mdns/minimal/IPResourceRecord.h>
-#include <support/UnitTestRegistration.h>
-
-#include <nlunit-test.h>
-
-namespace {
-
-using namespace mdns::Minimal;
-using namespace chip;
-using namespace chip::Inet;
-
-constexpr uint16_t kTestQnameCount        = 3;
-const char * kTestQnames[kTestQnameCount] = { "some", "test", "local" };
-
-void WriteIPv4(nlTestSuite * inSuite, void * inContext)
-{
-    IPAddress ipAddress;
-
-    NL_TEST_ASSERT(inSuite, IPAddress::FromString("10.20.30.40", ipAddress));
-
-    uint8_t headerBuffer[HeaderRef::kSizeBytes];
-    uint8_t dataBuffer[128];
-
-    HeaderRef header(headerBuffer);
-
-    {
-        BufBound output(dataBuffer, sizeof(dataBuffer));
-        IPResourceRecord ipResourceRecord(kTestQnames, kTestQnameCount, ipAddress);
-
-        ipResourceRecord.SetTtl(123);
-
-        header.Clear();
-
-        const uint8_t expectedOutput[] = {
-            4,  's', 'o', 'm', 'e',      // QNAME part: some
-            4,  't', 'e', 's', 't',      // QNAME part: test
-            5,  'l', 'o', 'c', 'a', 'l', // QNAME part: local
-            0,                           // QNAME ends
-            0,  1,                       // QClass IN
-            0,  1,                       // QType A
-            0,  0,   0,   123,           // TTL
-            0,  4,                       // data size - size for IPv4
-            10, 20,  30,  40             // IP Address
-        };
-
-        NL_TEST_ASSERT(inSuite, ipResourceRecord.Append(header, ResourceType::kAnswer, output));
-        NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 1);
-        NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 0);
-        NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-        NL_TEST_ASSERT(inSuite, output.Needed() == sizeof(expectedOutput));
-        NL_TEST_ASSERT(inSuite, memcmp(dataBuffer, expectedOutput, sizeof(expectedOutput)) == 0);
-    }
-
-    {
-        BufBound output(dataBuffer, sizeof(dataBuffer));
-
-        IPResourceRecord ipResourceRecord(kTestQnames, kTestQnameCount, ipAddress);
-
-        ipResourceRecord.SetTtl(234);
-
-        header.Clear();
-
-        const uint8_t expectedOutput[] = {
-            4,  's', 'o', 'm', 'e',      // QNAME part: some
-            4,  't', 'e', 's', 't',      // QNAME part: test
-            5,  'l', 'o', 'c', 'a', 'l', // QNAME part: local
-            0,                           // QNAME ends
-            0,  1,                       // QClass IN
-            0,  1,                       // QType A
-            0,  0,   0,   234,           // TTL
-            0,  4,                       // data size - size for IPv4
-            10, 20,  30,  40             // IP Address
-        };
-
-        NL_TEST_ASSERT(inSuite, ipResourceRecord.Append(header, ResourceType::kAuthority, output));
-        NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 0);
-        NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 1);
-        NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-        NL_TEST_ASSERT(inSuite, output.Needed() == sizeof(expectedOutput));
-        NL_TEST_ASSERT(inSuite, memcmp(dataBuffer, expectedOutput, sizeof(expectedOutput)) == 0);
-    }
-
-    {
-        BufBound output(dataBuffer, sizeof(dataBuffer));
-
-        IPResourceRecord ipResourceRecord(kTestQnames, kTestQnameCount, ipAddress);
-
-        ipResourceRecord.SetTtl(0x1234);
-
-        header.Clear();
-
-        const uint8_t expectedOutput[] = {
-            4,  's', 'o',  'm',  'e',      // QNAME part: some
-            4,  't', 'e',  's',  't',      // QNAME part: test
-            5,  'l', 'o',  'c',  'a', 'l', // QNAME part: local
-            0,                             // QNAME ends
-            0,  1,                         // QClass IN
-            0,  1,                         // QType A
-            0,  0,   0x12, 0x34,           // TTL
-            0,  4,                         // data size - size for IPv4
-            10, 20,  30,   40              // IP Address
-        };
-
-        NL_TEST_ASSERT(inSuite, ipResourceRecord.Append(header, ResourceType::kAdditional, output));
-        NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 0);
-        NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 0);
-        NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 1);
-        NL_TEST_ASSERT(inSuite, output.Needed() == sizeof(expectedOutput));
-        NL_TEST_ASSERT(inSuite, memcmp(dataBuffer, expectedOutput, sizeof(expectedOutput)) == 0);
-    }
-}
-
-void WriteIPv6(nlTestSuite * inSuite, void * inContext)
-{
-    IPAddress ipAddress;
-
-    NL_TEST_ASSERT(inSuite, IPAddress::FromString("fe80::224:32ff:fe19:359b", ipAddress));
-
-    uint8_t headerBuffer[HeaderRef::kSizeBytes];
-    uint8_t dataBuffer[128];
-
-    HeaderRef header(headerBuffer);
-
-    BufBound output(dataBuffer, sizeof(dataBuffer));
-    IPResourceRecord ipResourceRecord(kTestQnames, kTestQnameCount, ipAddress);
-
-    ipResourceRecord.SetTtl(0x12345678);
-
-    header.Clear();
-
-    const uint8_t expectedOutput[] = {                                   //
-                                       4,    's',  'o',  'm',  'e',      // QNAME part: some
-                                       4,    't',  'e',  's',  't',      // QNAME part: test
-                                       5,    'l',  'o',  'c',  'a', 'l', // QNAME part: local
-                                       0,                                // QNAME ends
-                                       0,    1,                          // QClass IN
-                                       0,    28,                         // QType AAAA
-                                       0x12, 0x34, 0x56, 0x78,           // TTL
-                                       0,    16,                         // data size - size for IPv4
-                                       0xfe, 0x80, 0x00, 0x00,           // IPv6
-                                       0x00, 0x00, 0x00, 0x00,           //
-                                       0x02, 0x24, 0x32, 0xff,           //
-                                       0xfe, 0x19, 0x35, 0x9b
-    };
-
-    NL_TEST_ASSERT(inSuite, ipResourceRecord.Append(header, ResourceType::kAnswer, output));
-    NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 1);
-    NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 0);
-    NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-    NL_TEST_ASSERT(inSuite, output.Needed() == sizeof(expectedOutput));
-    NL_TEST_ASSERT(inSuite, memcmp(dataBuffer, expectedOutput, sizeof(expectedOutput)) == 0);
-}
-
-const nlTest sTests[] = {
-    NL_TEST_DEF("IPV4", WriteIPv4), //
-    NL_TEST_DEF("IPV6", WriteIPv6), //
-    NL_TEST_SENTINEL()              //
-};
-
-} // namespace
-
-int TestIPResourceRecord(void)
-{
-
-    nlTestSuite theSuite = { "IPResourceRecord", sTests, nullptr, nullptr };
-    nlTestRunner(&theSuite, nullptr);
-
-    return (nlTestRunnerStats(&theSuite));
-}
-
-CHIP_REGISTER_TEST_SUITE(TestIPResourceRecord)
diff --git a/src/lib/mdns/minimal/tests/TestQName.cpp b/src/lib/mdns/minimal/tests/TestQName.cpp
deleted file mode 100644 (file)
index ab9e1b4..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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 <mdns/minimal/QName.h>
-#include <support/UnitTestRegistration.h>
-
-#include <nlunit-test.h>
-
-namespace {
-
-using namespace mdns::Minimal;
-
-void IteratorTest(nlTestSuite * inSuite, void * inContext)
-{
-    {
-        static const uint8_t kOneItem[] = "\04test\00";
-        SerializedQNameIterator it(BytesRange(kOneItem, kOneItem + sizeof(kOneItem)), kOneItem);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "test") == 0);
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, it.IsValid());
-    }
-
-    {
-        static const uint8_t kManyItems[] = "\04this\02is\01a\04test\00";
-        SerializedQNameIterator it(BytesRange(kManyItems, kManyItems + sizeof(kManyItems)), kManyItems);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "this") == 0);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "is") == 0);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "a") == 0);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "test") == 0);
-
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, it.IsValid());
-    }
-    {
-        static const uint8_t kPtrItems[] = "abc\02is\01a\04test\00\04this\xc0\03";
-        SerializedQNameIterator it(BytesRange(kPtrItems, kPtrItems + sizeof(kPtrItems)), kPtrItems + 14);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "this") == 0);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "is") == 0);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "a") == 0);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, strcmp(it.Value(), "test") == 0);
-
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, it.IsValid());
-    }
-}
-
-void ErrorTest(nlTestSuite * inSuite, void * inContext)
-{
-    {
-        // Truncated before the end
-        static const uint8_t kData[] = "\04test";
-        SerializedQNameIterator it(BytesRange(kData, kData + 5), kData);
-
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, !it.IsValid());
-    }
-
-    {
-        // Truncated before the end
-        static const uint8_t kData[] = "\02";
-        SerializedQNameIterator it(BytesRange(kData, kData + 1), kData);
-
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, !it.IsValid());
-    }
-
-    {
-        // Truncated before the end
-        static const uint8_t kData[] = "\xc0";
-        SerializedQNameIterator it(BytesRange(kData, kData + 1), kData);
-
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, !it.IsValid());
-    }
-
-    {
-        // Truncated before the end (but seemingly valid in case of error)
-        static const uint8_t kData[] = "\00\xc0\x00";
-        SerializedQNameIterator it(BytesRange(kData, kData + 2), kData + 1);
-
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, !it.IsValid());
-    }
-    {
-        // Infinite recursion
-        static const uint8_t kData[] = "\03test\xc0\x00";
-        SerializedQNameIterator it(BytesRange(kData, kData + 7), kData);
-
-        NL_TEST_ASSERT(inSuite, it.Next());
-        NL_TEST_ASSERT(inSuite, !it.Next());
-        NL_TEST_ASSERT(inSuite, !it.IsValid());
-    }
-}
-
-} // namespace
-
-// clang-format off
-static const nlTest sTests[] =
-{
-    NL_TEST_DEF("IteratorTest", IteratorTest),
-    NL_TEST_DEF("ErrorTest", ErrorTest),
-
-    NL_TEST_SENTINEL()
-};
-// clang-format on
-
-int TestQName(void)
-{
-    // clang-format off
-    nlTestSuite theSuite =
-       {
-        "QName",
-        &sTests[0],
-        nullptr,
-        nullptr
-    };
-    // clang-format on
-
-    nlTestRunner(&theSuite, nullptr);
-
-    return (nlTestRunnerStats(&theSuite));
-}
-
-CHIP_REGISTER_TEST_SUITE(TestQName)
diff --git a/src/lib/mdns/minimal/tests/TestResourceRecord.cpp b/src/lib/mdns/minimal/tests/TestResourceRecord.cpp
deleted file mode 100644 (file)
index 8c1b51f..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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 <mdns/minimal/ResourceRecord.h>
-#include <support/UnitTestRegistration.h>
-
-#include <nlunit-test.h>
-
-namespace {
-
-using namespace chip;
-using namespace mdns::Minimal;
-
-constexpr uint16_t kTestQnameCount        = 2;
-const char * kTestQnames[kTestQnameCount] = { "foo", "bar" };
-
-class FakeResourceRecord : public ResourceRecord
-{
-public:
-    FakeResourceRecord(const char * data) : ResourceRecord(QType::ANY, kTestQnames, kTestQnameCount), mData(data) {}
-
-protected:
-    bool WriteData(chip::BufBound & out) const override
-    {
-        out.Put(mData);
-        return out.Fit();
-    }
-
-private:
-    const char * mData;
-};
-
-void CanWriteSimpleRecord(nlTestSuite * inSuite, void * inContext)
-{
-    uint8_t headerBuffer[HeaderRef::kSizeBytes];
-    uint8_t dataBuffer[128];
-
-    HeaderRef header(headerBuffer);
-    header.Clear();
-
-    BufBound output(dataBuffer, sizeof(dataBuffer));
-    FakeResourceRecord record("somedata");
-
-    record.SetTtl(0x11223344);
-
-    const uint8_t expectedOutput[] = {
-        //
-        3,    'f',  'o',  'o',  // QNAME part: foo
-        3,    'b',  'a',  'r',  // QNAME part: bar
-        0,                      // QNAME ends
-        0,    1,                // QClass IN
-        0,    255,              // QType ANY (totally fake)
-        0x11, 0x22, 0x33, 0x44, // TTL
-        0,    8,                // data size
-        's',  'o',  'm',  'e',  'd', 'a', 't', 'a',
-    };
-
-    NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAnswer, output));
-    NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 1);
-    NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 0);
-    NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-    NL_TEST_ASSERT(inSuite, output.Needed() == sizeof(expectedOutput));
-    NL_TEST_ASSERT(inSuite, memcmp(dataBuffer, expectedOutput, sizeof(expectedOutput)) == 0);
-}
-
-void CanWriteMultipleRecords(nlTestSuite * inSuite, void * inContext)
-{
-    uint8_t headerBuffer[HeaderRef::kSizeBytes];
-    uint8_t dataBuffer[128];
-
-    HeaderRef header(headerBuffer);
-    header.Clear();
-
-    BufBound output(dataBuffer, sizeof(dataBuffer));
-    FakeResourceRecord record1("somedata");
-    FakeResourceRecord record2("moredata");
-    FakeResourceRecord record3("xyz");
-
-    record1.SetTtl(0x11223344);
-    record2.SetTtl(0);
-    record3.SetTtl(0xFF);
-
-    const uint8_t expectedOutput[] = {
-        3,    'f',  'o',  'o',                      // QNAME part: foo
-        3,    'b',  'a',  'r',                      // QNAME part: bar
-        0,                                          // QNAME ends
-        0,    1,                                    // QClass IN
-        0,    255,                                  // QType ANY (totally fake)
-        0x11, 0x22, 0x33, 0x44,                     // TTL
-        0,    8,                                    // data size
-        's',  'o',  'm',  'e',  'd', 'a', 't', 'a', //
-        3,    'f',  'o',  'o',                      // QNAME part: foo
-        3,    'b',  'a',  'r',                      // QNAME part: bar
-        0,                                          // QNAME ends
-        0,    1,                                    // QClass IN
-        0,    255,                                  // QType ANY (totally fake)
-        0,    0,    0,    0,                        // TTL
-        0,    8,                                    // data size
-        'm',  'o',  'r',  'e',  'd', 'a', 't', 'a', //
-        3,    'f',  'o',  'o',                      // QNAME part: foo
-        3,    'b',  'a',  'r',                      // QNAME part: bar
-        0,                                          // QNAME ends
-        0,    1,                                    // QClass IN
-        0,    255,                                  // QType ANY (totally fake)
-        0,    0,    0,    0xFF,                     // TTL
-        0,    3,                                    // data size
-        'x',  'y',  'z',
-    };
-
-    NL_TEST_ASSERT(inSuite, record1.Append(header, ResourceType::kAnswer, output));
-    NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 1);
-    NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 0);
-    NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-
-    NL_TEST_ASSERT(inSuite, record2.Append(header, ResourceType::kAuthority, output));
-    NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 1);
-    NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 1);
-    NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-
-    NL_TEST_ASSERT(inSuite, record3.Append(header, ResourceType::kAdditional, output));
-    NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == 1);
-    NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 1);
-    NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 1);
-
-    NL_TEST_ASSERT(inSuite, output.Needed() == sizeof(expectedOutput));
-    NL_TEST_ASSERT(inSuite, memcmp(dataBuffer, expectedOutput, sizeof(expectedOutput)) == 0);
-}
-
-void RecordOrderIsEnforced(nlTestSuite * inSuite, void * inContext)
-{
-    uint8_t headerBuffer[HeaderRef::kSizeBytes];
-    uint8_t dataBuffer[128];
-
-    HeaderRef header(headerBuffer);
-
-    BufBound output(dataBuffer, sizeof(dataBuffer));
-    FakeResourceRecord record("somedata");
-
-    header.Clear();
-    header.SetAuthorityCount(1);
-    NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAnswer, output) == false);
-
-    header.Clear();
-    header.SetAdditionalCount(1);
-    NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAnswer, output) == false);
-    NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAuthority, output) == false);
-}
-
-void ErrorsOutOnSmallBuffers(nlTestSuite * inSuite, void * inContext)
-{
-    uint8_t headerBuffer[HeaderRef::kSizeBytes];
-    uint8_t dataBuffer[123];
-
-    HeaderRef header(headerBuffer);
-
-    FakeResourceRecord record("somedata");
-
-    const uint8_t expectedOutput[] = {
-        //
-        3,   'f', 'o', 'o', // QNAME part: foo
-        3,   'b', 'a', 'r', // QNAME part: bar
-        0,                  // QNAME ends
-        0,   1,             // QClass IN
-        0,   255,           // QType ANY (totally fake)
-        0,   0,   0,   0,   // TTL
-        0,   8,             // data size
-        's', 'o', 'm', 'e', 'd', 'a', 't', 'a',
-    };
-
-    header.Clear();
-    uint8_t clearHeader[HeaderRef::kSizeBytes];
-
-    memcpy(clearHeader, headerBuffer, HeaderRef::kSizeBytes);
-
-    for (size_t i = 0; i < sizeof(expectedOutput); i++)
-    {
-        memset(dataBuffer, 0, sizeof(dataBuffer));
-        BufBound output(dataBuffer, i);
-
-        NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAnswer, output) == false);
-
-        // header untouched
-        NL_TEST_ASSERT(inSuite, memcmp(headerBuffer, clearHeader, HeaderRef::kSizeBytes) == 0);
-    }
-
-    memset(dataBuffer, 0, sizeof(dataBuffer));
-    BufBound output(dataBuffer, sizeof(expectedOutput));
-
-    NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAnswer, output));
-    NL_TEST_ASSERT(inSuite, output.Needed() == sizeof(expectedOutput));
-    NL_TEST_ASSERT(inSuite, memcmp(dataBuffer, expectedOutput, sizeof(expectedOutput)) == 0);
-    NL_TEST_ASSERT(inSuite, memcmp(headerBuffer, clearHeader, HeaderRef::kSizeBytes) != 0);
-}
-
-void RecordCount(nlTestSuite * inSuite, void * inContext)
-{
-    constexpr int kAppendCount = 10;
-    uint8_t headerBuffer[HeaderRef::kSizeBytes];
-    uint8_t dataBuffer[123];
-
-    HeaderRef header(headerBuffer);
-    header.Clear();
-
-    FakeResourceRecord record("somedata");
-
-    for (int i = 0; i < kAppendCount; i++)
-    {
-        BufBound output(dataBuffer, sizeof(dataBuffer));
-        NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAnswer, output));
-        NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == i + 1);
-        NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == 0);
-        NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-    }
-
-    for (int i = 0; i < kAppendCount; i++)
-    {
-        BufBound output(dataBuffer, sizeof(dataBuffer));
-        NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAuthority, output));
-        NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == kAppendCount);
-        NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == i + 1);
-        NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == 0);
-    }
-
-    for (int i = 0; i < kAppendCount; i++)
-    {
-        BufBound output(dataBuffer, sizeof(dataBuffer));
-        NL_TEST_ASSERT(inSuite, record.Append(header, ResourceType::kAdditional, output));
-        NL_TEST_ASSERT(inSuite, header.GetAnswerCount() == kAppendCount);
-        NL_TEST_ASSERT(inSuite, header.GetAuthorityCount() == kAppendCount);
-        NL_TEST_ASSERT(inSuite, header.GetAdditionalCount() == i + 1);
-    }
-}
-
-const nlTest sTests[] = {
-    NL_TEST_DEF("CanWriteSimpleRecord", CanWriteSimpleRecord),       //
-    NL_TEST_DEF("CanWriteMultipleRecords", CanWriteMultipleRecords), //
-    NL_TEST_DEF("RecordOrderIsEnforced", RecordOrderIsEnforced),     //
-    NL_TEST_DEF("ErrorsOutOnSmallBuffers", ErrorsOutOnSmallBuffers), //
-    NL_TEST_DEF("RecordCount", RecordCount),                         //
-    NL_TEST_SENTINEL()                                               //
-};
-
-} // namespace
-
-int TestResourceRecord(void)
-{
-    nlTestSuite theSuite = { "ResourceRecord", sTests, nullptr, nullptr };
-    nlTestRunner(&theSuite, nullptr);
-    return nlTestRunnerStats(&theSuite);
-}
-
-CHIP_REGISTER_TEST_SUITE(TestResourceRecord)
index b93e21c..a6ecf46 100644 (file)
 namespace chip {
 namespace Mdns {
 
-static constexpr uint8_t kMdnsNameMaxSize  = 33;
-static constexpr uint8_t kMdnsTypeMaxSize  = 32;
-static constexpr uint16_t kMdnsTextMaxSize = 64;
+static constexpr uint8_t kMdnsNameMaxSize         = 33;
+static constexpr uint8_t kMdnsProtocolTextMaxSize = 8;
+static constexpr uint8_t kMdnsTypeMaxSize         = 32;
+static constexpr uint16_t kMdnsTextMaxSize        = 64;
 
 enum class MdnsServiceProtocol : uint8_t
 {
diff --git a/src/lib/protocols/CHIPProtocols.h b/src/lib/protocols/CHIPProtocols.h
deleted file mode 100644 (file)
index a21cb79..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2017 Nest Labs, Inc.
- *
- *    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.
- */
-
-/**
- *    @file
- *      This file defines constant enumerations for all public (or
- *      common) protocols.
- *
- */
-
-#ifndef CHIP_PROTOCOLS_H_
-#define CHIP_PROTOCOLS_H_
-
-#include <core/CHIPVendorIdentifiers.hpp>
-
-/**
- *   @namespace chip::Protocols
- *
- *   @brief
- *     This namespace includes all interfaces within CHIP for CHIP protocols.
- */
-
-namespace chip {
-namespace Protocols {
-
-//
-// CHIP Protocol Ids (32-bits max)
-//
-
-enum CHIPProtocolId
-{
-    // Common Protocols
-    //
-    // NOTE: Do not attempt to allocate these values yourself.
-
-    kChipProtocol_Common              = (kChipVendor_Common << 16) | 0x0000, // Common Protocol
-    kChipProtocol_Echo                = (kChipVendor_Common << 16) | 0x0001, // Echo Protocol
-    kChipProtocol_SecurePairing       = (kChipVendor_Common << 16) | 0x0002, // SPAKE2+ handshake Protocol
-    kChipProtocol_NetworkProvisioning = (kChipVendor_Common << 16) | 0x0003, // Network Provisioning Protocol
-    kChipProtocol_Security            = (kChipVendor_Common << 16) | 0x0004, // Network Security Protocol
-    kChipProtocol_FabricProvisioning  = (kChipVendor_Common << 16) | 0x0005, // Fabric Provisioning Protocol
-    kChipProtocol_ServiceProvisioning = (kChipVendor_Common << 16) | 0x000F, // Service Provisioning Protocol
-
-    // Protocols reserved for internal protocol use
-
-    kChipProtocol_NotSpecified = (kChipVendor_NotSpecified << 16) | 0xFFFF, // The profile ID is either not specified or a wildcard
-};
-
-} // namespace Protocols
-} // namespace chip
-
-#endif /* CHIP_PROTOCOLS_H_ */
diff --git a/src/lib/protocols/common/CHIPMessage.h b/src/lib/protocols/common/CHIPMessage.h
deleted file mode 100644 (file)
index 128a9a0..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2017 Nest Labs, 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.
- */
-
-/**
- *    @file
- *      This file defines macros and objects commonly used for the
- *      processing of CHIP messages.
- *
- */
-
-#ifndef _CHIP_MESSAGE_H
-#define _CHIP_MESSAGE_H
-
-#include <core/CHIPEncoding.h>
-#include <core/CHIPError.h>
-#include <core/CHIPTLV.h>
-#include <support/DLLUtil.h>
-
-#include <system/SystemPacketBuffer.h>
-
-/*
- * these macros are the guts of the packing and parsing stuff and they're used
- * everywhere.
- *
- * here are the writers
- * parameters:
- * - PTR, a pointer into a buffer of type uint8_t
- * - VAL, a value to write
- */
-#define WRITEBYTE(PTR, VAL)                                                                                                        \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        *(PTR)++ = (uint8_t)(VAL);                                                                                                 \
-    } while (0)
-
-#define WRITE16(PTR, VAL)                                                                                                          \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        WRITEBYTE((PTR), ((VAL) >> 0));                                                                                            \
-        WRITEBYTE((PTR), ((VAL) >> 8));                                                                                            \
-    } while (0)
-
-#define WRITE32(PTR, VAL)                                                                                                          \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        WRITEBYTE((PTR), ((VAL) >> 0));                                                                                            \
-        WRITEBYTE((PTR), ((VAL) >> 8));                                                                                            \
-        WRITEBYTE((PTR), ((VAL) >> 16));                                                                                           \
-        WRITEBYTE((PTR), ((VAL) >> 24));                                                                                           \
-    } while (0)
-
-/*
- * and the readers
- * parameter: PTR, a pointer into a buffer of type uint8_t
- * value: the value read form the buffer
- */
-#define READBYTE(PTR) (*(uint8_t *) (PTR)++)
-/*
- * parameters:
- * - PTR, a pointer into a buffer of type uint8_t
- * - DEST, where to put what's read from *p
- */
-#define READ16(PTR, DEST)                                                                                                          \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        uint16_t __byte0 = (uint16_t) READBYTE(PTR);                                                                               \
-        uint16_t __byte1 = (uint16_t) READBYTE(PTR);                                                                               \
-        DEST             = __byte0 + (__byte1 << 8);                                                                               \
-    } while (0)
-
-#define READ32(PTR, DEST)                                                                                                          \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        uint16_t __byte0 = (uint16_t) READBYTE(PTR);                                                                               \
-        uint16_t __byte1 = (uint16_t) READBYTE(PTR);                                                                               \
-        uint16_t __byte2 = (uint16_t) READBYTE(PTR);                                                                               \
-        uint16_t __byte3 = (uint16_t) READBYTE(PTR);                                                                               \
-        DEST             = __byte0 + (__byte1 << 8) + (__byte2 << 16) + (__byte3 << 24);                                           \
-    } while (0)
-
-/*
- * the message iterator class allows packet handling to operate in
- * a regular manner, do a bit of work, check the result, get out if
- * it's not good and so on. this results in a bunch of boilerplate
- * code, which is captured here.
- */
-#define TRY(OPERATION)                                                                                                             \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        CHIP_ERROR e = (OPERATION);                                                                                                \
-        if (e != CHIP_NO_ERROR)                                                                                                    \
-            return e;                                                                                                              \
-    } while (0)
-
-#define RESCUE(ERR, OPERATION, OUT)                                                                                                \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        ERR = (OPERATION);                                                                                                         \
-        if (ERR != CHIP_NO_ERROR)                                                                                                  \
-            goto OUT;                                                                                                              \
-    } while (0)
-
-namespace chip {
-
-namespace Protocols {
-
-/**
- *  @class RetainedPacketBuffer
- *
- *  @brief
- *    This is a base class that serves as a convenience object for
- *    automatically reference counting a System::PacketBuffer.
- *
- */
-class DLL_EXPORT RetainedPacketBuffer
-{
-public:
-    // Con/destructors
-    RetainedPacketBuffer();
-    RetainedPacketBuffer(const RetainedPacketBuffer & aRetainedPacketBuffer);
-    ~RetainedPacketBuffer();
-
-    RetainedPacketBuffer & operator=(const RetainedPacketBuffer & aRetainedPacketBuffer);
-
-    virtual bool IsRetaining() const;
-
-    void Retain(System::PacketBuffer * aBuffer);
-    virtual void Release();
-
-    inline System::PacketBuffer * GetBuffer() { return (mBuffer); }
-
-protected:
-    System::PacketBuffer * mBuffer; ///< A pointer to the retained packet buffer.
-};
-
-/**
- * In order to use message buffers sensibly, we define this iterator,
- * which can be used to keep track of boundaries and so on.
- */
-class DLL_EXPORT MessageIterator : public RetainedPacketBuffer
-{
-public:
-    // constructor
-    MessageIterator(System::PacketBuffer *);
-    // reading and writing
-    CHIP_ERROR readByte(uint8_t *);
-    CHIP_ERROR read16(uint16_t *);
-    CHIP_ERROR read32(uint32_t *);
-    CHIP_ERROR read64(uint64_t *);
-    CHIP_ERROR readString(uint16_t, char *);
-    CHIP_ERROR readBytes(uint16_t, uint8_t *);
-    CHIP_ERROR writeByte(uint8_t);
-    CHIP_ERROR write16(uint16_t);
-    CHIP_ERROR write32(uint32_t);
-    CHIP_ERROR write64(uint64_t);
-    CHIP_ERROR writeString(uint16_t, char *);
-    CHIP_ERROR writeBytes(uint16_t, uint8_t *);
-    // standard iterator operations
-    MessageIterator & operator++();
-    MessageIterator & operator+(uint16_t);
-    MessageIterator & operator-(uint16_t);
-    bool operator==(const MessageIterator &);
-    bool operator!=(const MessageIterator &);
-    uint8_t & operator*();
-    void append();
-    // size checking
-    bool hasData(uint16_t);
-    bool hasRoom(uint16_t);
-    // finishing
-    void finishWriting();
-    // data members
-    uint8_t * thePoint;
-};
-/**
- * Here's how to handle strings in CHIP. This class has 8-bit
- * and 16-bit variants.
- */
-class DLL_EXPORT ReferencedString : public RetainedPacketBuffer
-{
-public:
-    // constructor
-    ReferencedString();
-    // initializers
-    CHIP_ERROR init(uint16_t aLength, char * aString, System::PacketBuffer * aBuffer);
-    CHIP_ERROR init(uint16_t aLength, char * aString);
-    CHIP_ERROR init(uint8_t aLength, char * aString, System::PacketBuffer * aBuffer);
-    CHIP_ERROR init(uint8_t aLength, char * aString);
-    // pack and parse
-    CHIP_ERROR pack(MessageIterator &);
-    static CHIP_ERROR parse(MessageIterator &, ReferencedString &);
-    // comparison
-    bool operator==(const ReferencedString &) const;
-    // print string generation (for testing)
-    char * printString();
-    // data members
-    uint16_t theLength;
-    char * theString;
-    bool isShort;
-};
-/**
- * Similarly, we need to be able to represent a big old blob
- * of TLV data.
- */
-class DLL_EXPORT ReferencedTLVData : public RetainedPacketBuffer
-{
-public:
-    /*
-     * under certain circumstances, e.g. when we don't want to blow out the
-     * stack by writing some big thing into it in preparation for sending
-     * a message with a referenced extent in it, we want to only write the
-     * bits AFTER we've obtained the outgoing buffer. we do that using one
-     * of these.
-     *
-     * NOTE!!! the handler set up below does NOT return an error and, in
-     * the case where one is supplied, the pack method will not return an
-     * error either. this means that the NHL-supplied handler MUST handler
-     * all errors that arise from the formatting of TLV.
-     *
-     * parameters:
-     * - TLVWriter&, a TLV writer to use to write things out
-     * - void*, a state object known to the application
-     */
-
-    typedef void (*TLVWriteCallback)(TLV::TLVWriter & aWriter, void * aAppState);
-
-    // constructor
-
-    ReferencedTLVData();
-
-    // initializers
-
-    CHIP_ERROR init(System::PacketBuffer * aBuffer);
-    CHIP_ERROR init(MessageIterator & i);
-    CHIP_ERROR init(uint16_t aLength, uint16_t aMaxLength, uint8_t * aByteString);
-    CHIP_ERROR init(TLVWriteCallback aWriteCallback, void * anAppState);
-
-    /*
-     * ReferencedTLVData needs to override the free() and isFree()
-     * methods because "freedom", in this case, is more than nothing
-     * left to lose.
-     */
-
-    void free();
-
-    bool isFree();
-
-    /**
-     * Check if a ReferencedTLVData object has anything in it.
-     *
-     * There are two possible ways such an object could "have"
-     * something. Either it could have 0 length OR it could have no
-     * write callback.
-     *
-     * @return true if the data set has 0 length or there's no write
-     * callback in hand, false otherwise.
-     */
-
-    inline bool isEmpty() { return (theLength == 0 && theWriteCallback == nullptr); }
-
-    // packing and parsing
-
-    /**
-     * @fn CHIP_ERROR ReferencedTLVData::pack(System::PacketBuffer *buff)
-     *
-     * @brief Pack a ReferencedTLVData object directly into a PacketBuffer
-     *
-     * @param [in] buff the buffer to fill.
-     *
-     * @return a CHIP_ERROR reflecting the success of the underlying
-     * pack call.
-     */
-
-    inline CHIP_ERROR pack(System::PacketBuffer * buff)
-    {
-        MessageIterator i(buff);
-
-        return pack(i);
-    }
-
-    CHIP_ERROR pack(MessageIterator & i, uint32_t maxLen = 0xFFFFFFFFUL);
-
-    /**
-     * Return the data length assuming that the object has been packed
-     * into a buffer.
-     *
-     * @return the integer length of the packed data.
-     */
-
-    inline uint16_t packedLength() { return theLength; }
-
-    /**
-     * @fn CHIP_ERROR parse(System::PacketBuffer *buff, ReferencedTLVData &aTarget)
-     *
-     * @brief Parse a ReferencedTLVData object from a supplied PacketBuffer
-     *
-     * Parse a ReferencedTLVData object out of an inet buffer
-     * (assuming it just contains TLV).
-     *
-     * @param [in] buff the buffer to read from.
-     *
-     * @param [out] aTarget a ReferencedTLVData object to "fill" with the result.
-     *
-     * @return a CHIP_ERROR reflecting the success of the underlying
-     * parse call.
-     */
-
-    static inline CHIP_ERROR parse(System::PacketBuffer * buff, ReferencedTLVData & aTarget)
-    {
-        MessageIterator i(buff);
-
-        return parse(i, aTarget);
-    }
-
-    static CHIP_ERROR parse(MessageIterator & i, ReferencedTLVData & aTarget);
-
-    // comparison
-
-    bool operator==(const ReferencedTLVData &) const;
-
-    // data members
-
-    uint16_t theLength;
-    uint16_t theMaxLength;
-    uint8_t * theData;
-
-private:
-    TLVWriteCallback theWriteCallback;
-    void * theAppState;
-};
-
-} // namespace Protocols
-} // namespace chip
-
-#endif // _CHIP_MESSAGE_H
diff --git a/src/lib/protocols/common/CommonProtocol.h b/src/lib/protocols/common/CommonProtocol.h
deleted file mode 100644 (file)
index a81201d..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2017 Nest Labs, 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.
- */
-
-/**
- *    @file
- *      The defines constants for the CHIP Common Protocol, present in
- *      every CHIP device.
- *
- */
-
-#ifndef _COMMON_PROTOCOL_H
-#define _COMMON_PROTOCOL_H
-
-/**
- *   @namespace chip::Protocols::Common
- *
- *   @brief
- *     This namespace includes all interfaces within CHIP for the
- *     CHIP Common profile.
- *
- *     The interfaces define message types and status codes.
- */
-
-namespace chip {
-namespace Protocols {
-namespace Common {
-
-/**
- * Common Profile Message Types
- */
-enum
-{
-    kMsgType_StatusReport = 1,
-    kMsgType_Null         = 2,
-
-    // Reliable Messaging Protocol Message Types
-    kMsgType_RMP_Delayed_Delivery = 3,
-    kMsgType_RMP_Throttle_Flow    = 4
-};
-
-/**
- * Common Protocol Status Codes
- */
-enum
-{
-    kStatus_Success                = 0,      /**< The operation completed without error. */
-    kStatus_Canceled               = 1,      /**< The operation was canceled. */
-    kStatus_BadRequest             = 0x0010, /**< The request was unrecognized or malformed. */
-    kStatus_UnsupportedMessage     = 0x0011, /**< An unrecognized or unsupported message was received. */
-    kStatus_UnexpectedMessage      = 0x0012, /**< A message was received at an unexpected time or in an unexpected context. */
-    kStatus_AuthenticationRequired = 0x0013, /**< The request can only be made by an authenticated party. */
-    kStatus_AccessDenied           = 0x0014, /**< The request can only be made by a party with sufficient access. */
-    kStatus_OutOfMemory =
-        0x0017, /**< The sender is low on memory resources and cannot perform the requested operation at the current time. */
-    kStatus_NotAvailable       = 0x0018, /**< The requested operation cannot be performed given the current state of the sender. */
-    kStatus_LocalSetupRequired = 0x0019, /**< The requested operation could not be performed because one or more necessary local
-                                            configuration steps have not been completed. */
-    kStatus_InternalServerProblem = 0x0020, /**< Request could not be completeted because of problems on the server. */
-    kStatus_Relocated             = 0x0030, /**< Request was made to the wrong endpoint. Client should query its
-                                                 directory server for an updated endpoint list and try again. */
-    kStatus_Busy          = 0x0040, /**< The sender is busy and cannot perform the requested operation at the current time. */
-    kStatus_Timeout       = 0x0041, /**< The operation or protocol interaction failed to complete in the allotted time. */
-    kStatus_InternalError = 0x0050, /**< An internal failure prevented an operation from completing. */
-    kStatus_Continue      = 0x0090, /**< Context-specific signal to proceed. */
-};
-
-/**
- * Common Protocol MIME file type
- */
-enum
-{
-    kMIMEType_AppOctetStream = 0x0000, /**< The most general unrestricted set of bytes, same as "unspecified." */
-    kMIMEType_TextPlain      = 0x0001, /**< Plain text, uncompressed. */
-    kMIMEType_AppGzip        = 0x0002, /**< gzip-compressed data. */
-};
-
-/**
- * @var   kTag_SystemErrorCode
- * @brief [uint] System-specific error.
- *
- * Tag Category: Protocol-specific.  Constraints: none
- *
- * @var   kTag_SchemaVersion
- * @brief [uint] Schema revision.
- *
- * Tag Category: Protocol-specific.  Constraints: 0-255
- *
- * @var   kTag_MIMEType
- * @brief [uint] MIME type.
- *
- * Tag Category: Protocol-agnostic.  Constraints: none
- */
-
-/**
- * Common Protocol Data Tags
- */
-enum
-{
-    //                                      Value       Tag Category      Element Type      Constraints  Description
-    //                                      ------------------------------------------------------------------------
-    kTag_SystemErrorCode = 0x0001, // Protocol-specific  Unsigned Integer  -            System-specific error
-    kTag_SchemaVersion   = 0x0002, // Protocol-specific  Unsigned Integer  0-255        Schema revision
-    kTag_MIMEType        = 0x0004, // Protocol-agnostic  Unsigned Integer  -            MIME type
-};
-
-} // namespace Common
-} // namespace Protocols
-} // namespace chip
-
-#endif // _COMMON_PROTOCOL_H
diff --git a/src/lib/protocols/fabric-provisioning/FabricProvisioning.h b/src/lib/protocols/fabric-provisioning/FabricProvisioning.h
deleted file mode 100644 (file)
index fa8a342..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2017 Nest Labs, 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.
- */
-
-/**
- *    @file
- *      This file defines the Fabric Provisioning Profile, used to
- *      manage membership to CHIP Fabrics.
- *
- *      The Fabric Provisioning Profile facilitates client-server operations
- *      such that the client (the controlling device) can trigger specific
- *      functionality on the server (the device undergoing provisioning),
- *      to allow it to create, join, and leave CHIP Fabrics.  This includes
- *      communicating Fabric configuration information such as identifiers,
- *      keys, security schemes, and related data.
- */
-
-#ifndef FABRICPROVISIONING_H_
-#define FABRICPROVISIONING_H_
-
-#include <core/CHIPCore.h>
-#include <core/CHIPEncoding.h>
-#include <core/CHIPTLV.h>
-#include <message/CHIPServerBase.h>
-#include <support/DLLUtil.h>
-
-/**
- *   @namespace chip::Protocols::FabricProvisioning
- *
- *   @brief
- *     This namespace includes all interfaces within CHIP for the
- *     CHIP Fabric Provisioning profile, the second of the three
- *     CHIP provisioning profiles.
- */
-
-namespace chip {
-namespace Protocols {
-namespace FabricProvisioning {
-
-using Inet::IPAddress;
-
-/**
- * Fabric Provisioning Status Codes
- */
-enum
-{
-    kStatusCode_AlreadyMemberOfFabric = 1, /**< The recipient is already a member of a fabric. */
-    kStatusCode_NotMemberOfFabric     = 2, /**< The recipient is not a member of a fabric. */
-    kStatusCode_InvalidFabricConfig   = 3  /**< The specified fabric configuration was invalid. */
-};
-
-/**
- * Fabric Provisioning Message Types
- */
-enum
-{
-    // Application/Device Messages
-    kMsgType_CreateFabric            = 1,
-    kMsgType_LeaveFabric             = 2,
-    kMsgType_GetFabricConfig         = 3,
-    kMsgType_GetFabricConfigComplete = 4,
-    kMsgType_JoinExistingFabric      = 5
-};
-
-/**
- * Fabric Provisioning Data Element Tags
- */
-enum
-{
-    // ---- Top-level Data Elements ----
-    kTag_FabricConfig = 1, /**< [ structure ] Contains provisioning information for an existing fabric.
-                                  IMPORTANT NOTE: As a convenience to readers, all elements in a FabricConfig
-                                  must be encoded in numeric tag order, at all levels. */
-
-    // ---- Context-specific Tags for FabricConfig Structure ----
-    kTag_FabricId   = 1, /**< [ uint ] Fabric ID. */
-    kTag_FabricKeys = 2, /**< [ array ] List of FabricKey structures. */
-
-    // ---- Context-specific Tags for FabricKey Structure ----
-    kTag_FabricKeyId    = 1,       /**< [ uint ] CHIP key ID for fabric key. */
-    kTag_EncryptionType = 2,       /**< [ uint ] CHIP encryption type supported by the key. */
-    kTag_DataKey        = 3,       /**< [ byte-string ] Data encryption key. */
-    kTag_IntegrityKey   = 4,       /**< [ byte-string ] Data integrity key. */
-    kTag_KeyScope       = 5,       /**< [ uint ] Enumerated value identifying the category of devices that can possess
-                                                 the fabric key. */
-    kTag_RotationScheme    = 6,    /**< [ uint ] Enumerated value identifying the rotation scheme for the key. */
-    kTag_RemainingLifeTime = 7,    /**< [ uint ] Remaining time (in seconds) until key expiration. Absent if lifetime
-                                                 is indefinite or doesn't apply. */
-    kTag_RemainingReservedTime = 8 /**< [ uint ] Remaining time (in seconds) until key is eligible for use. Absent if
-                                                 key can be used right away. */
-};
-
-/**
- * Delegate class for implementing additional actions corresponding to Fabric Provisioning operations.
- */
-class FabricProvisioningDelegate : public ChipServerDelegateBase
-{
-public:
-    /**
-     * Indicates that the device has created a new Fabric.
-     *
-     * @retval #CHIP_NO_ERROR On success.
-     * @retval other           Other CHIP or platform-specific error codes indicating that an error
-     *                         occurred preventing the device from creating a fabric.
-     */
-    virtual CHIP_ERROR HandleCreateFabric() = 0;
-
-    /**
-     * Indicates that the device has joined an existing Fabric.
-     *
-     * @retval #CHIP_NO_ERROR On success.
-     * @retval other           Other CHIP or platform-specific error codes indicating that an error
-     *                         occurred preventing the device from joining the fabric.
-     */
-    virtual CHIP_ERROR HandleJoinExistingFabric() = 0;
-
-    /**
-     * Indicates that the device has left a Fabric.
-     *
-     * @retval #CHIP_NO_ERROR On success.
-     * @retval other           Other CHIP or platform-specific error codes indicating that an error
-     *                         occurred preventing the device from leaving the fabric.
-     */
-    virtual CHIP_ERROR HandleLeaveFabric() = 0;
-
-    /**
-     * Indicates that the configuration of the current CHIP Fabric has been
-     * requested.
-     *
-     * @retval #CHIP_NO_ERROR On success.
-     * @retval other           Other CHIP or platform-specific error codes indicating that an error
-     *                         occurred preventing the device from returning the fabric config.
-     */
-    virtual CHIP_ERROR HandleGetFabricConfig() = 0;
-
-    /**
-     * Enforce message-level access control for an incoming Fabric Provisioning request message.
-     *
-     * @param[in] ec            The ExchangeContext over which the message was received.
-     * @param[in] msgProfileId  The profile id of the received message.
-     * @param[in] msgType       The message type of the received message.
-     * @param[in] msgInfo       A ChipMessageInfo structure containing information about the received message.
-     * @param[inout] result     An enumerated value describing the result of access control policy evaluation for
-     *                          the received message. Upon entry to the method, the value represents the tentative
-     *                          result at the current point in the evaluation process.  Upon return, the result
-     *                          is expected to represent the final assessment of access control policy for the
-     *                          message.
-     */
-    void EnforceAccessControl(ExchangeContext * ec, uint32_t msgProfileId, uint8_t msgType, const ChipMessageInfo * msgInfo,
-                              AccessControlResult & result) override;
-
-    /**
-     * Called to determine if the device is currently paired to an account.
-     */
-    // TODO: make this pure virtual when product code provides appropriate implementations.
-    virtual bool IsPairedToAccount() const;
-};
-
-/**
- * Server class for implementing the Fabric Provisioning profile.
- */
-// TODO: Additional documentation detail required (i.e. expected class usage, number in the system, instantiation requirements,
-// lifetime).
-class DLL_EXPORT FabricProvisioningServer : public ChipServerBase
-{
-public:
-    FabricProvisioningServer();
-    FabricProvisioningServer(const FabricProvisioningServer &) = delete;
-    FabricProvisioningServer & operator=(const FabricProvisioningServer &) = delete;
-
-    CHIP_ERROR Init(ChipExchangeManager * exchangeMgr);
-    CHIP_ERROR Shutdown();
-
-    void SetDelegate(FabricProvisioningDelegate * delegate);
-
-    // Check if the session is marked as privileged to retrieve fabric config information.
-    bool SessionHasFabricConfigAccessPrivilege(uint16_t keyId, uint64_t peerNodeId) const;
-
-    virtual CHIP_ERROR SendSuccessResponse();
-    virtual CHIP_ERROR SendStatusReport(uint32_t statusProfileId, uint16_t statusCode, CHIP_ERROR sysError = CHIP_NO_ERROR);
-
-protected:
-    FabricProvisioningDelegate * mDelegate;
-    ExchangeContext * mCurClientOp;
-
-private:
-    static void HandleClientRequest(ExchangeContext * ec, const Inet::IPPacketInfo * pktInfo, const ChipMessageInfo * msgInfo,
-                                    uint32_t profileId, uint8_t msgType, PacketBuffer * payload);
-
-    // Utility functions for managing registration with/notification from ChipFabricState
-    // about whether the current security session is privileged to
-    // access fabric config information.
-    void GrantFabricConfigAccessPrivilege(uint16_t keyId, uint64_t peerNodeId);
-    void ClearFabricConfigAccessPrivilege();
-    static void HandleSessionEnd(uint16_t keyId, uint64_t peerNodeId, void * context);
-    CHIP_ERROR RegisterSessionEndCallbackWithFabricState();
-
-    // Indicates the session that is privileged to
-    // retrieve fabric config information.
-    struct FabricConfigAccessSession
-    {
-        uint64_t PeerNodeId;
-        uint16_t SessionKeyId;
-    };
-    FabricConfigAccessSession mFabricConfigAccessSession;
-
-    chip::ChipFabricState::SessionEndCbCtxt mSessionEndCbCtxt;
-};
-
-} // namespace FabricProvisioning
-} // namespace Protocols
-} // namespace chip
-
-#endif /* FABRICPROVISIONING_H_ */
diff --git a/src/lib/protocols/security/CHIPApplicationKeys.h b/src/lib/protocols/security/CHIPApplicationKeys.h
deleted file mode 100644 (file)
index 6a4b471..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2016-2017 Nest Labs, 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.
- */
-
-/**
- *    @file
- *      This file defines classes and interfaces for deriving and
- *      managing CHIP constituent and application group keys.
- *
- */
-
-#ifndef CHIPAPPLICATIONKEYS_H_
-#define CHIPAPPLICATIONKEYS_H_
-
-#include <core/CHIPCore.h>
-
-/**
- *   @namespace chip::Protocols::Security::AppKeys
- *
- *   @brief
- *     This namespace includes all interfaces within CHIP for the CHIP
- *     application keys library within the CHIP security profile.
- */
-
-namespace chip {
-namespace Protocols {
-namespace Security {
-namespace AppKeys {
-
-/**
- * @brief
- *   Key diversifier used for CHIP fabric root key derivation. This value represents
- *   first 4 bytes of the SHA-1 HASH of "Fabric Root Key" phrase.
- */
-extern const uint8_t kChipAppFabricRootKeyDiversifier[4];
-
-/**
- * @brief
- *   Key diversifier used for CHIP client root key derivation. This value represents
- *   first 4 bytes of the SHA-1 HASH of "Client Root Key" phrase.
- */
-extern const uint8_t kChipAppClientRootKeyDiversifier[4];
-
-/**
- * @brief
- *   Key diversifier used for CHIP intermediate key derivation. This value represents
- *   first 4 bytes of the SHA-1 HASH of "Intermediate Key" phrase.
- */
-extern const uint8_t kChipAppIntermediateKeyDiversifier[4];
-
-/**
- * @brief
- *   CHIP application keys protocol parameter definitions.
- */
-enum
-{
-    // --- Key sizes.
-    kChipAppGroupKeySize        = 32,                   /**< CHIP constituent group key size. */
-    kChipAppRootKeySize         = kChipAppGroupKeySize, /**< CHIP application root key size. */
-    kChipAppEpochKeySize        = kChipAppGroupKeySize, /**< CHIP application epoch key size. */
-    kChipAppGroupMasterKeySize  = kChipAppGroupKeySize, /**< CHIP application group master key size. */
-    kChipAppIntermediateKeySize = kChipAppGroupKeySize, /**< CHIP application intermediate key size. */
-    kChipFabricSecretSize       = 36,                   /**< CHIP fabric secret size. */
-
-    // --- Key diversifiers sizes.
-    /** Fabric root key diversifier size. */
-    kChipAppFabricRootKeyDiversifierSize = sizeof(kChipAppFabricRootKeyDiversifier),
-    /** Client root key diversifier size. */
-    kChipAppClientRootKeyDiversifierSize = sizeof(kChipAppClientRootKeyDiversifier),
-    /** Intermediate key diversifier size. */
-    kChipAppIntermediateKeyDiversifierSize = sizeof(kChipAppIntermediateKeyDiversifier),
-};
-
-/**
- *  @class ChipGroupKey
- *
- *  @brief
- *    Contains information about CHIP application group keys.
- *    Examples of keys that can be described by this class are: root key,
- *    epoch key, group master key, intermediate key, and fabric secret.
- *
- */
-class ChipGroupKey
-{
-public:
-    enum
-    {
-        MaxKeySize = kChipFabricSecretSize
-    };
-    uint32_t KeyId;          /**< The key ID. */
-    uint8_t KeyLen;          /**< The key length. */
-    uint8_t Key[MaxKeySize]; /**< The secret key material. */
-    union
-    {
-        uint32_t StartTime; /**< The epoch key start time. */
-        uint32_t GlobalId;  /**< The application group key global ID. */
-    };
-};
-
-/**
- *  @class GroupKeyStoreBase
- *
- *  @brief
- *    The definition of the CHIP group key store class. Functions in
- *    this class are called to manage application group keys.
- *
- */
-class DLL_EXPORT GroupKeyStoreBase
-{
-public:
-    // Manage application group key material storage.
-    virtual CHIP_ERROR RetrieveGroupKey(uint32_t keyId, ChipGroupKey & key)                                                 = 0;
-    virtual CHIP_ERROR StoreGroupKey(const ChipGroupKey & key)                                                              = 0;
-    virtual CHIP_ERROR DeleteGroupKey(uint32_t keyId)                                                                       = 0;
-    virtual CHIP_ERROR DeleteGroupKeysOfAType(uint32_t keyType)                                                             = 0;
-    virtual CHIP_ERROR EnumerateGroupKeys(uint32_t keyType, uint32_t * keyIds, uint8_t keyIdsArraySize, uint8_t & keyCount) = 0;
-    virtual CHIP_ERROR Clear()                                                                                              = 0;
-
-    // Get the current time.
-    virtual CHIP_ERROR GetCurrentUTCTime(uint32_t & utcTime);
-
-    // Get current application key Id.
-    CHIP_ERROR GetCurrentAppKeyId(uint32_t keyId, uint32_t & curKeyId);
-
-    // Get/Derive group key.
-    CHIP_ERROR GetGroupKey(uint32_t keyId, ChipGroupKey & groupKey);
-
-    // Derive application key.
-    CHIP_ERROR DeriveApplicationKey(uint32_t & appKeyId, const uint8_t * keySalt, uint8_t saltLen, const uint8_t * keyDiversifier,
-                                    uint8_t diversifierLen, uint8_t * appKey, uint8_t keyBufSize, uint8_t keyLen,
-                                    uint32_t & appGroupGlobalId);
-
-protected:
-    uint32_t LastUsedEpochKeyId;
-    uint32_t NextEpochKeyStartTime;
-
-    void Init();
-    void OnEpochKeysChange();
-
-    // Retrieve and Store LastUsedEpochKeyId value.
-    virtual CHIP_ERROR RetrieveLastUsedEpochKeyId() = 0;
-    virtual CHIP_ERROR StoreLastUsedEpochKeyId()    = 0;
-
-private:
-    // Derive fabric/client root key.
-    CHIP_ERROR DeriveFabricOrClientRootKey(uint32_t rootKeyId, ChipGroupKey & rootKey);
-
-    // Derive intermediate key.
-    CHIP_ERROR DeriveIntermediateKey(uint32_t keyId, ChipGroupKey & intermediateKey);
-};
-
-extern CHIP_ERROR GetAppGroupMasterKeyId(uint32_t groupGlobalId, GroupKeyStoreBase * groupKeyStore, uint32_t & groupMasterKeyId);
-
-extern CHIP_ERROR LogGroupKeys(GroupKeyStoreBase * groupKeyStore);
-
-} // namespace AppKeys
-} // namespace Security
-} // namespace Protocols
-} // namespace chip
-
-#endif /* CHIPAPPLICATIONKEYS_H_ */
diff --git a/src/lib/protocols/security/CHIPDummyGroupKeyStore.h b/src/lib/protocols/security/CHIPDummyGroupKeyStore.h
deleted file mode 100644 (file)
index 6c5f9c5..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2016-2017 Nest Labs, 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.
- */
-
-/**
- *    @file
- *      This file defines class, which is used as a default dummy (empty)
- *      implementation of the group key store.
- *
- */
-
-#ifndef CHIPDUMMYGROUPKEYSTORE_H_
-#define CHIPDUMMYGROUPKEYSTORE_H_
-
-#include "CHIPApplicationKeys.h"
-
-namespace chip {
-namespace Protocols {
-namespace Security {
-namespace AppKeys {
-
-/**
- *  @class DummyKeyStore
- *
- *  @brief
- *    The definition of the dummy group key store.
- *
- */
-class DummyGroupKeyStore : public GroupKeyStoreBase
-{
-public:
-    DummyGroupKeyStore();
-
-    // Manage application group key material storage.
-    CHIP_ERROR RetrieveGroupKey(uint32_t keyId, ChipGroupKey & key) override;
-    CHIP_ERROR StoreGroupKey(const ChipGroupKey & key) override;
-    CHIP_ERROR DeleteGroupKey(uint32_t keyId) override;
-    CHIP_ERROR DeleteGroupKeysOfAType(uint32_t keyType) override;
-    CHIP_ERROR EnumerateGroupKeys(uint32_t keyType, uint32_t * keyIds, uint8_t keyIdsArraySize, uint8_t & keyCount) override;
-    CHIP_ERROR Clear() override;
-
-private:
-    // Retrieve and Store LastUsedEpochKeyId value.
-    CHIP_ERROR RetrieveLastUsedEpochKeyId() override;
-    CHIP_ERROR StoreLastUsedEpochKeyId() override;
-
-    // Get current platform UTC time in seconds.
-    CHIP_ERROR GetCurrentUTCTime(uint32_t & utcTime) override;
-};
-
-} // namespace AppKeys
-} // namespace Security
-} // namespace Protocols
-} // namespace chip
-
-#endif /* CHIPDUMMYGROUPKEYSTORE_H_ */
diff --git a/src/lib/protocols/security/CHIPSecurity.h b/src/lib/protocols/security/CHIPSecurity.h
deleted file mode 100644 (file)
index 22c5315..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2019-2020 Google LLC.
- *    Copyright (c) 2013-2017 Nest Labs, 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.
- */
-
-/**
- *    @file
- *      This file defines base and common data types and interfaces
- *      for the CHIP Security profile.
- *
- */
-
-#ifndef CHIPSECURITY_H_
-#define CHIPSECURITY_H_
-
-#include <core/CHIPVendorIdentifiers.hpp>
-
-/**
- *   @namespace chip::Protocols::Security
- *
- *   @brief
- *     This namespace includes all interfaces within CHIP for the
- *     CHIP Security profile.
- */
-
-namespace chip {
-namespace Protocols {
-namespace Security {
-
-// Message Types for CHIP Security Protocol
-//
-enum
-{
-    // ---- Certificate Provisioning Protocol ----
-    kMsgType_GetCertificateRequest  = 40,
-    kMsgType_GetCertificateResponse = 41,
-
-    // ---- General Messages ----
-    kMsgType_EndSession         = 100,
-    kMsgType_KeyError           = 101,
-    kMsgType_MsgCounterSyncResp = 102,
-};
-
-// CHIP Security Status Codes
-//
-enum
-{
-    kStatusCode_SessionAborted                 = 1,  // The sender has aborted the session establishment process.
-    kStatusCode_PASESupportsOnlyConfig1        = 2,  // PASE supports only Config1.
-    kStatusCode_UnsupportedEncryptionType      = 3,  // The requested encryption type is not supported.
-    kStatusCode_InvalidKeyId                   = 4,  // An invalid key id was requested.
-    kStatusCode_DuplicateKeyId                 = 5,  // The specified key id is already in use.
-    kStatusCode_KeyConfirmationFailed          = 6,  // The derived session keys do not agree.
-    kStatusCode_InternalError                  = 7,  // The sender encountered an internal error (e.g. no memory, etc...).
-    kStatusCode_AuthenticationFailed           = 8,  // The sender rejected the authentication attempt.
-    kStatusCode_UnsupportedCASEConfiguration   = 9,  // No common CASE configuration supported.
-    kStatusCode_UnsupportedCertificate         = 10, // An unsupported certificate was offered.
-    kStatusCode_NoCommonPASEConfigurations     = 11, // No common PASE configuration supported.
-    kStatusCode_KeyNotFound                    = 12, // The specified key is not found.
-    kStatusCode_WrongEncryptionType            = 13, // The specified encryption type is invalid.
-    kStatusCode_UnknownKeyType                 = 14, // The specified key has unknown key type.
-    kStatusCode_InvalidUseOfSessionKey         = 15, // The specified key is used incorrectly.
-    kStatusCode_InternalKeyError               = 16, // The receiver of the CHIP message encountered key error.
-    kStatusCode_NoCommonKeyExportConfiguration = 17, // No common key export protocol configuration supported.
-    kStatusCode_UnauthorizedKeyExportRequest   = 18, // An unauthorized key export request.
-    kStatusCode_NoNewOperationalCertRequired   = 19, // No new operational certificate required.
-    kStatusCode_OperationalNodeIdInUse =
-        20, // The specified operational node Id is already used by another CHIP node (indication of node id collision).
-    kStatusCode_InvalidOperationalNodeId      = 21, // The specified operational node Id is invalid.
-    kStatusCode_InvalidOperationalCertificate = 22, // The specified operational certificate is invalid.
-};
-
-// CHIP Key Error Message Size
-//
-enum
-{
-    kChipKeyErrorMessageSize = 9, // The size of the key error message.
-};
-
-// CHIP Message Counter Synchronization Response Message Size.
-//
-enum
-{
-    kChipMsgCounterSyncRespMsgSize = 4, // The size of the message counter synchronization response message.
-};
-
-// Data Element Tags for the CHIP Security Protocol
-//
-enum
-{
-    // ---- Top-level Protocol-Specific Tags ----
-    kTag_ChipCertificate                = 1, // [ structure ] A CHIP certificate.
-    kTag_EllipticCurvePrivateKey        = 2, // [ structure ] An elliptic curve private key.
-    kTag_RSAPrivateKey                  = 3, // [ structure ] An RSA private key.
-    kTag_ChipCertificateList            = 4, // [ array ] An array of CHIP certificates.
-    kTag_ChipSignature                  = 5, // [ structure ] A CHIP signature object.
-    kTag_ChipCertificateReference       = 6, // [ structure ] A CHIP certificate reference object.
-    kTag_ChipCASECertificateInformation = 7, // [ structure ] A CHIP CASE certificate information object.
-    kTag_ChipCASESignature              = 8, // [ structure ] An CHIP CASE signature object.
-                                             //    Presently this has the same internal structure as an ECDSASignature.
-    kTag_ChipAccessToken   = 9,              // [ structure ] A CHIP Access Token object
-    kTag_GroupKeySignature = 10,             // [ structure ] A CHIP group Key signature object
-    kTag_SerializedSession = 11,             // [ structure ] A serialized representation of CHIP session
-                                             //    suitable for persisting.
-
-    // ---- Context-specific Tags for ChipCertificate Structure ----
-    kTag_SerialNumber            = 1,  // [ byte string ] Certificate serial number, in BER integer encoding.
-    kTag_SignatureAlgorithm      = 2,  // [ unsigned int ] Enumerated value identifying the certificate signature algorithm.
-    kTag_Issuer                  = 3,  // [ path ] The issuer distinguished name of the certificate.
-    kTag_NotBefore               = 4,  // [ unsigned int ] Certificate validity period start (certificate date format).
-    kTag_NotAfter                = 5,  // [ unsigned int ] Certificate validity period end (certificate date format).
-    kTag_Subject                 = 6,  // [ path ] The subject distinguished name of the certificate.
-    kTag_PublicKeyAlgorithm      = 7,  // [ unsigned int ] Identifies the algorithm with which the public key can be used.
-    kTag_EllipticCurveIdentifier = 8,  // [ unsigned int ] For EC certs, identifies the elliptic curve used.
-    kTag_RSAPublicKey            = 9,  // [ structure ] The RSA public key.
-    kTag_EllipticCurvePublicKey  = 10, // [ byte string ] The elliptic curve public key, in X9.62 encoded format.
-    kTag_RSASignature            = 11, // [ byte string ] The RSA signature for the certificate.
-    kTag_ECDSASignature          = 12, // [ structure ] The ECDSA signature for the certificate.
-                                       // Tags identifying certificate extensions (tag numbers 128 - 255)
-    kCertificateExtensionTagsStart = 128,
-    kTag_AuthorityKeyIdentifier    = 128, // [ structure ] Information about the public key used to sign the certificate.
-    kTag_SubjectKeyIdentifier      = 129, // [ structure ] Information about the certificate's public key.
-    kTag_KeyUsage                  = 130, // [ structure ] TODO: document me
-    kTag_BasicConstraints          = 131, // [ structure ] TODO: document me
-    kTag_ExtendedKeyUsage          = 132, // [ structure ] TODO: document me
-    kCertificateExtensionTagsEnd   = 255,
-
-    // ---- Context-specific Tags for RSAPublicKey Structure ----
-    kTag_RSAPublicKey_Modulus        = 1, // [ byte string ] RSA public key modulus, in ASN.1 integer encoding.
-    kTag_RSAPublicKey_PublicExponent = 2, // [ unsigned int ] RSA public key exponent.
-
-    // ---- Context-specific Tags for ECDSASignature Structure ----
-    kTag_ECDSASignature_r = 1, // [ byte string ] ECDSA r value, in ASN.1 integer encoding.
-    kTag_ECDSASignature_s = 2, // [ byte string ] ECDSA s value, in ASN.1 integer encoding.
-
-    // ---- Context-specific Tags for AuthorityKeyIdentifier Structure ----
-    kTag_AuthorityKeyIdentifier_Critical =
-        1, // [ boolean ] True if the AuthorityKeyIdentifier extension is critical. Otherwise absent.
-    kTag_AuthorityKeyIdentifier_KeyIdentifier = 2, // [ byte string ] TODO: document me
-    kTag_AuthorityKeyIdentifier_Issuer        = 3, // [ path ] TODO: document me
-    kTag_AuthorityKeyIdentifier_SerialNumber  = 4, // [ byte string ] TODO: document me
-
-    // ---- Context-specific Tags for SubjectKeyIdentifier Structure ----
-    kTag_SubjectKeyIdentifier_Critical = 1, // [ boolean ] True if the SubjectKeyIdentifier extension is critical. Otherwise absent.
-    kTag_SubjectKeyIdentifier_KeyIdentifier = 2, // [ byte string ] Unique identifier for certificate's public key, per RFC5280.
-
-    // ---- Context-specific Tags for KeyUsage Structure ----
-    kTag_KeyUsage_Critical = 1, // [ boolean ] True if the KeyUsage extension is critical. Otherwise absent.
-    kTag_KeyUsage_KeyUsage = 2, // [ unsigned int ] Integer containing key usage bits, per to RFC5280.
-
-    // ---- Context-specific Tags for BasicConstraints Structure ----
-    kTag_BasicConstraints_Critical = 1, // [ boolean ] True if the BasicConstraints extension is critical. Otherwise absent.
-    kTag_BasicConstraints_IsCA     = 2, // [ boolean ] True if the certificate can be used to verify certificate signatures.
-    kTag_BasicConstraints_PathLenConstraint = 3, // [ unsigned int ] Maximum number of subordinate intermediate certificates.
-
-    // ---- Context-specific Tags for ExtendedKeyUsage Structure ----
-    kTag_ExtendedKeyUsage_Critical = 1, // [ boolean ] True if the ExtendedKeyUsage extension is critical. Otherwise absent.
-    kTag_ExtendedKeyUsage_KeyPurposes =
-        2, // [ array ] Array of enumerated values giving the purposes for which the public key can be used.
-
-    // ---- Context-specific Tags for EllipticCurvePrivateKey Structure ----
-    kTag_EllipticCurvePrivateKey_CurveIdentifier = 1, // [ unsigned int ] ChipCurveId identifying the elliptic curve.
-    kTag_EllipticCurvePrivateKey_PrivateKey =
-        2,                                      // [ byte string ] Private key encoded using the I2OSP algorithm defined in RFC3447.
-    kTag_EllipticCurvePrivateKey_PublicKey = 3, // [ byte string ] The elliptic curve public key, in X9.62 encoded format.
-
-    // ---- Context-specific Tags for RSAPrivateKey Structure ----
-    // ... TBD ...
-
-    // ---- Context-specific Tags for ChipSignature Structure ----
-    kTag_ChipSignature_ECDSASignatureData = 1, // [ structure ] ECDSA signature data for the signed message.
-    kTag_ChipSignature_RSASignatureData   = 2, // [ byte string ] RSA signature for the signed message.
-                                               //   Per the schema, exactly one of ECDSASignature or RSASignature must be present.
-    kTag_ChipSignature_SigningCertificateRef =
-        3, // [ structure ] A CHIP certificate reference structure identifying the certificate
-           //   used to generate the signature. If absent, the signature was generated by the
-           //   first certificate in the RelatedCertificates list.
-    kTag_ChipSignature_RelatedCertificates =
-        4, // [ array ] Array of certificates needed to validate the signature.  May be omitted if
-           //   validators are expected to have the necessary certificates for validation.
-           //   At least one of SigningCertificateRef or RelatedCertificates must be present.
-    kTag_ChipSignature_SignatureAlgorithm =
-        5, // [ unsigned int ] Enumerated value identifying the signature algorithm.
-           //   Legal values per the schema are: kOID_SigAlgo_ECDSAWithSHA1, kOID_SigAlgo_ECDSAWithSHA256,
-           //     kOID_SigAlgo_SHA1WithRSAEncryption and kOID_SigAlgo_SHA256WithRSAEncryption.
-           //   For backwards compatibility, this field should be omitted when the signature
-           //     algorithm is ECDSAWithSHA1.
-           //   When this field is included it must appear first within the ChipSignature structure.
-           //   kOID_SigAlgo_SHA1WithRSAEncryption and kOID_SigAlgo_SHA256WithRSAEncryption are
-           //     not presently supported in the code.
-
-    // ---- Context-specific Tags for CHIP Certificate Reference Structure ----
-    kTag_ChipCertificateRef_Subject = 1, // [ path ] The subject DN of the referenced certificate.
-    kTag_ChipCertificateRef_PublicKeyId =
-        2, // [ byte string ] Unique identifier for referenced certificate's public key, per RFC5280.
-
-    // ---- Context-specific Tags for CHIP CASE Certificate Information Structure ----
-    kTag_CASECertificateInfo_EntityCertificate =
-        1, // [ structure ] A CHIP certificate object representing the authenticating entity.
-    kTag_CASECertificateInfo_EntityCertificateRef =
-        2, // [ structure ] A CHIP certificate reference object identifying the authenticating entity.
-    kTag_CASECertificateInfo_RelatedCertificates = 3, // [ path ] A collection of certificates related to the authenticating entity.
-    kTag_CASECertificateInfo_TrustAnchors =
-        4, // [ path ] A collection of CHIP certificate reference identifying certificates trusted
-           //   by the authenticating entity.
-
-    // ---- Context-specific Tags for CHIP Access Token Structure ----
-    kTag_AccessToken_Certificate = 1, // [ structure ] A CHIP certificate object representing the entity that is trusted to
-                                      //   access a device or fabric.
-    kTag_AccessToken_PrivateKey = 2,  // [ structure ] An EllipticCurvePrivateKey object containing the private key associated
-                                      //   with the access token certificate.
-    kTag_AccessToken_RelatedCertificates = 3, // [ array, optional ] An optional array of certificates related to the access token
-                                              //   certificate that may be needed to validate it.
-
-    kTag_GroupKeySignature_SignatureAlgorithm = 1, //  [ unsigned int ] Enumerated value identifying the certificate signature
-                                                   //  algorithm.  Legal values are taken from the kOID_SigAlgo_* constant
-                                                   //  namespace.  The only value currently supported is
-                                                   //  kOID_SigAlgo_HMACWithSHA256.  When the tag is ommitted the signature
-                                                   //  algorithm defaults to HMACWithSHA256
-    kTag_GroupKeySignature_KeyId     = 2,          //  [ unsigned int ] CHIP KeyId to be used to generate and verify the signature
-    kTag_GroupKeySignature_Signature = 3,          //  [ byte string ] Signature bytes themselves.
-
-    // ---- Context-specific Tags for GetCertificateRequest Message Structure ----
-    kTag_GetCertReqMsg_ReqType = 1, // [ unsigned int ] Identifies the certificate request type.
-    kTag_GetCertReqMsg_Authorize_PairingToken =
-        2, // [ byte string, optional ] Pairing token from the service. This token is used to authorize
-           //   GetCertificateRequest message to the CA service.
-    kTag_GetCertReqMsg_Authorize_PairingInitData =
-        3, // [ byte string, optional ] Pairing initialization data from the service. This data is used
-           //   to authorize GetCertificateRequest message to the CA service.
-    kTag_GetCertReqMsg_OpDeviceCert = 4, // [ structure ] CHIP operational device certificate.
-                                         //   This has the same internal structure as an kTag_ChipCertificate.
-    kTag_GetCertReqMsg_OpRelatedCerts =
-        5, // [ array, optional ] An optional array of CHIP operational intermediate CA certificates,
-           //   which are needed to validate CHIP operational device certificate. May be omitted if
-           //   validators are expected to have the necessary certificates for validation.
-           //   Each element of this array has the same internal structure as an kTag_ChipCertificate.
-    kTag_GetCertReqMsg_MfrAttest_ChipCert =
-        6, // [ structure ] CHIP device certificate provisioned at the factory at manufacturing time.
-           //   This has the same internal structure as an kTag_ChipCertificate.
-    kTag_GetCertReqMsg_MfrAttest_ChipRelCerts =
-        7, // [ array, optional ] An optional array of CHIP intermediate CA certificates, which are needed
-           //   to validate included manufacturer-assigned CHIP device certificate. May be omitted if
-           //   validators are expected to have the necessary certificates for validation.
-           //   Each element of this array has the same internal structure as an kTag_ChipCertificate.
-    kTag_GetCertReqMsg_MfrAttest_X509Cert =
-        8, // [ byte string ] X509 device certificate provisioned at the factory at manufacturing time.
-           //   This is an ASN1 encoded ECDSA or RSA certificate TLV-encoded as a data blob.
-    kTag_GetCertReqMsg_MfrAttest_X509RelCerts =
-        9, // [ array, optional ] An optional array of X509 intermediate CA certificates,
-           //   which are needed to validate included manufacturer-assigned X509 device certificate.
-           //   May be omitted if validators are expected to have the necessary certificates for validation.
-           //   Each element of this array is a byte string, and each X509 certificate is TLV-encoded as a data blob.
-    kTag_GetCertReqMsg_MfrAttest_HMACKeyId =
-        10, // [ unsigned int ] Identifies the secret key that is used for the HMAC manufacturer attestation.
-    kTag_GetCertReqMsg_MfrAttest_HMACMetaData =
-        11, // [ byte string, optional ] Meta data associated with the HMAC manufacturer attestation.
-    kTag_GetCertReqMsg_OpDeviceSigAlgo = 12,   // [ unsigned int ] Enumerated value identifying the operational signature algorithm.
-                                               //   Legal values are taken from the kOID_SigAlgo_* constant namespace.
-    kTag_GetCertReqMsg_OpDeviceSig_ECDSA = 13, // [ structure ] Operational device EC signature.
-                                               //   This has the same internal structure as an kTag_ECDSASignature.
-    kTag_GetCertReqMsg_MfrAttestSigAlgo =
-        14, // [ unsigned int ] Enumerated value identifying the manufacturer attestation signature algorithm.
-            //   Legal values are taken from the kOID_SigAlgo_* constant namespace.
-    kTag_GetCertReqMsg_MfrAttestSig_ECDSA = 15, // [ structure ] Manufacturer attestation device EC signature.
-                                                //   This has the same internal structure as an kTag_ECDSASignature.
-    kTag_GetCertReqMsg_MfrAttestSig_RSA  = 16,  // [ byte string ] Manufacturer attestation device RSA signature.
-    kTag_GetCertReqMsg_MfrAttestSig_HMAC = 17,  // [ byte string ] Manufacturer attestation device HMAC signature.
-
-    // ---- Context-specific Tags for GetCertificateResponse Message Structure ----
-    kTag_GetCertRespMsg_OpDeviceCert = 1, // [ structure ] Service assigned CHIP operational device certificate.
-                                          //   This has the same internal structure as an kTag_ChipCertificate.
-    kTag_GetCertRespMsg_OpRelatedCerts =
-        2, // [ array, optional ] An optional array of CHIP certificates related to the
-           //   operational device certificate, which are needed to validate certificate.
-           //   Each element of this array has the same internal structure as an kTag_ChipCertificate.
-
-    // ---- Context-specific Tags for CHIP representation of X.509 Distinguished Name Attributes ----
-    //
-    // The value used here must match *exactly* the OID enum values assigned to the corresponding object ids in the gen-oid-table.py
-    // script.
-    //
-    // WARNING! Assign no values higher than 127.
-    //
-    kTag_DNAttrType_CommonName              = 1,  // [ UTF8 string ]
-    kTag_DNAttrType_Surname                 = 2,  // [ UTF8 string ]
-    kTag_DNAttrType_SerialNumber            = 3,  // [ UTF8 string ]
-    kTag_DNAttrType_CountryName             = 4,  // [ UTF8 string ]
-    kTag_DNAttrType_LocalityName            = 5,  // [ UTF8 string ]
-    kTag_DNAttrType_StateOrProvinceName     = 6,  // [ UTF8 string ]
-    kTag_DNAttrType_OrganizationName        = 7,  // [ UTF8 string ]
-    kTag_DNAttrType_OrganizationalUnitName  = 8,  // [ UTF8 string ]
-    kTag_DNAttrType_Title                   = 9,  // [ UTF8 string ]
-    kTag_DNAttrType_Name                    = 10, // [ UTF8 string ]
-    kTag_DNAttrType_GivenName               = 11, // [ UTF8 string ]
-    kTag_DNAttrType_Initials                = 12, // [ UTF8 string ]
-    kTag_DNAttrType_GenerationQualifier     = 13, // [ UTF8 string ]
-    kTag_DNAttrType_DNQualifier             = 14, // [ UTF8 string ]
-    kTag_DNAttrType_Pseudonym               = 15, // [ UTF8 string ]
-    kTag_DNAttrType_DomainComponent         = 16, // [ UTF8 string ]
-    kTag_DNAttrType_ChipDeviceId            = 17, // [ unsigned int ]
-    kTag_DNAttrType_ChipServiceEndpointId   = 18, // [ unsigned int ]
-    kTag_DNAttrType_ChipCAId                = 19, // [ unsigned int ]
-    kTag_DNAttrType_ChipSoftwarePublisherId = 20, // [ unsigned int ]
-
-    // ---- Context-specific Tags for Serialized Session structure ----
-    kTag_SerializedSession_KeyId                   = 1,     // [ UNSIGNED INT, range 16bits ] Assigned session key id
-    kTag_SerializedSession_PeerNodeId              = 2,     // [ UNSIGNED INT, range 64bits ] Node id of session peer
-    kTag_SerializedSession_NextMessageId           = 3,     // [ UNSIGNED INT, range 32bits ] Next message id
-    kTag_SerializedSession_MaxRcvdMessageId        = 4,     // [ UNSIGNED INT, range 32bits ] Max received message id
-    kTag_SerializedSession_MessageRcvdFlags        = 5,     // [ UNSIGNED INT, range 64bits ] Message received flags
-    kTag_SerializedSession_IsLocallyInitiated      = 6,     // [ BOOLEAN ] Is session locally initiated
-    kTag_SerializedSession_IsShared                = 7,     // [ BOOLEAN ] Is session shared
-    kTag_SerializedSession_SharedSessionAltNodeIds = 8,     // [ ARRAY OF UNSIGNED INT, range 64bits ] For a shared session,
-                                                            //    list of alternate peer node ids.
-    kTag_SerializedSession_CASE_PeerCertType = 9,           // [ UNSIGNED INT, range 8bits ] For CASE sessions, the type
-                                                            //    of certificate presented by the peer.
-    kTag_SerializedSession_EncryptionType        = 10,      // [ UNSIGNED INT, range 8bits ] Message encryption type
-    kTag_SerializedSession_AES128CTRSHA1_DataKey = 11,      // [ BYTE STRING, len 16 ] For sessions supporting AES128CTRSHA1
-                                                            //    message encryption, the data encryption key.
-    kTag_SerializedSession_AES128CTRSHA1_IntegrityKey = 12, // [ BYTE STRING, len 20 ] For sessions supporting AES128CTRSHA1
-                                                            //    message encryption, the data integrity key.
-};
-
-} // namespace Security
-} // namespace Protocols
-} // namespace chip
-
-#endif /* CHIPSECURITY_H_ */
diff --git a/src/lib/protocols/status-report/StatusReportProtocol.h b/src/lib/protocols/status-report/StatusReportProtocol.h
deleted file mode 100644 (file)
index 0e452c3..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2017 Nest Labs, 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.
- */
-
-/**
- *    @file
- *      This file defines an object for reading and writing CHIP
- *      Status Reports.
- *
- *      Status Reports are used in CHIP for over-the-wire status and
- *      error reporting that can act as a notification or confirmation
- *      in response to a request or command.
- *
- *      The format of a status report is:
- *      @code
- *        | <profile ID> | <status code> | <additional status info> |
- *      @endcode
- *
- */
-
-#ifndef _STATUS_REPORT_PROTOCOL_H
-#define _STATUS_REPORT_PROTOCOL_H
-
-#include <message/CHIPMessageLayer.h>
-#include <support/DLLUtil.h>
-
-/**
- *   @namespace chip::Protocols::StatusReporting
- *
- *   @brief
- *     This namespace includes all interfaces within CHIP for the
- *     CHIP Status Reporting subprofile, which is part of and within
- *     the CHIP Common profile.
- */
-
-namespace chip {
-namespace Protocols {
-namespace StatusReporting {
-
-/*
- * in-memory, a status report, at its most basic, is a CHIP profile
- * ID and status code pair. then there's the option of chaining on
- * more status information as TLV.
- */
-
-class DLL_EXPORT StatusReport
-{
-public:
-    StatusReport();
-    ~StatusReport();
-
-    CHIP_ERROR init(uint32_t aProtocolId, uint16_t aCode, ReferencedTLVData * aInfo = nullptr);
-
-    /*
-     * this version of the intializer is provided as a convenience in
-     * the case where we want to make a status report that reports an
-     * internal error.
-     */
-
-    CHIP_ERROR init(CHIP_ERROR aError);
-
-    CHIP_ERROR pack(PacketBuffer * aBuffer, uint32_t maxLen = 0xFFFFFFFFUL);
-    uint16_t packedLength();
-    static CHIP_ERROR parse(PacketBuffer * aBuffer, StatusReport & aDestination);
-
-    bool operator==(const StatusReport & another) const;
-
-    bool success();
-
-    /*
-     * here are some static convenience methods for adding metadata
-     */
-
-    static CHIP_ERROR StartMetaData(chip::TLV::TLVWriter & aWriter);
-    static CHIP_ERROR EndMetaData(chip::TLV::TLVWriter & aWriter);
-
-    static CHIP_ERROR AddErrorCode(chip::TLV::TLVWriter & aWriter, CHIP_ERROR aError);
-
-    // data members
-
-    uint32_t mProtocolId;
-    uint16_t mStatusCode;
-    CHIP_ERROR mError;
-    ReferencedTLVData mAdditionalInfo;
-};
-
-} // namespace StatusReporting
-} // namespace Protocols
-} // namespace chip
-
-#endif // _STATUS_REPORT_PROTOCOL_H
index 4d22b66..fb99ed9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2013-2017 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,6 +27,7 @@
 
 #include <stdint.h>
 
+#include <type_traits>
 #include <utility>
 
 namespace chip {
@@ -34,115 +35,217 @@ namespace chip {
 /**
  * Stores bit flags in a type safe manner.
  *
+ * @tparam FlagsEnum is an `enum` or (preferably) `enum class` type.
  * @tparam StorageType is the underlying storage type (like uint16_t, uint32_t etc.)
- * @tparam FlagsEnum is the typesafe flags setting
+ *         and defaults to the underlying storage type of `FlagsEnum`.
  */
-template <typename StorageType, typename FlagsEnum>
+template <typename FlagsEnum, typename StorageType = typename std::underlying_type_t<FlagsEnum>>
 class BitFlags
 {
 public:
     static_assert(sizeof(StorageType) >= sizeof(FlagsEnum), "All flags should fit in the storage type");
+    using IntegerType = StorageType;
 
-    BitFlags() {}
-    BitFlags(const BitFlags &) = default;
+    BitFlags() : mValue(0) {}
+    BitFlags(const BitFlags & other) = default;
     BitFlags & operator=(const BitFlags &) = default;
 
-    explicit BitFlags(FlagsEnum v) { Set(v); }
+    explicit BitFlags(FlagsEnum value) : mValue(static_cast<IntegerType>(value)) {}
+    explicit BitFlags(IntegerType value) : mValue(value) {}
 
-    explicit BitFlags(StorageType value) { SetRaw(value); }
+    template <typename... Args>
+    BitFlags(FlagsEnum flag, Args &&... args) : mValue(Or(flag, std::forward<Args>(args)...))
+    {}
+
+    template <typename... Args>
+    BitFlags(const BitFlags<FlagsEnum> & flags, Args &&... args) : mValue(Or(flags, std::forward<Args>(args)...))
+    {}
 
-    BitFlags & Set(FlagsEnum v)
+    template <typename... Args>
+    BitFlags(IntegerType value, Args &&... args) : mValue(value | Or(std::forward<Args>(args)...))
+    {}
+
+    /**
+     * Set flag(s).
+     *
+     * @param other     Flag(s) to set. Any flags not set in @a other are unaffected.
+     */
+    BitFlags & Set(const BitFlags & other)
     {
-        mValue = static_cast<StorageType>(mValue | static_cast<StorageType>(v));
+        mValue |= other.mValue;
         return *this;
     }
 
-    BitFlags & Clear(FlagsEnum v)
+    /**
+     * Set flag(s).
+     *
+     * @param flag      Typed flag(s) to set. Any flags not in @a v are unaffected.
+     */
+    BitFlags & Set(FlagsEnum flag)
     {
-        mValue &= static_cast<StorageType>(~static_cast<StorageType>(v));
+        mValue |= static_cast<IntegerType>(flag);
         return *this;
     }
 
-    BitFlags & Set(FlagsEnum v, bool isSet) { return isSet ? Set(v) : Clear(v); }
-
-    bool Has(FlagsEnum v) const { return (mValue & static_cast<StorageType>(v)) != 0; }
-
-    bool Has(StorageType other) const { return (mValue & other) == other; }
+    /**
+     * Set or clear flag(s).
+     *
+     * @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); }
+
+    /**
+     * Clear flag(s).
+     *
+     * @param other     Typed flag(s) to clear. Any flags not in @a other are unaffected.
+     */
+    BitFlags & Clear(const BitFlags & other)
+    {
+        mValue &= ~other.mValue;
+        return *this;
+    }
 
-    BitFlags & Set(const BitFlags & other)
+    /**
+     * Clear flag(s).
+     *
+     * @param flag  Typed flag(s) to clear. Any flags not in @a flag are unaffected.
+     */
+    BitFlags & Clear(FlagsEnum flag)
     {
-        mValue |= other.mValue;
+        mValue &= static_cast<IntegerType>(~static_cast<IntegerType>(flag));
         return *this;
     }
 
-    StorageType Raw() const { return mValue; }
-    BitFlags & SetRaw(StorageType value)
+    /**
+     * Clear all flags.
+     */
+    BitFlags & ClearAll()
     {
-        mValue = value;
+        mValue = 0;
         return *this;
     }
 
-    /** Check that no flags outside the arguments are set.*/
+    /**
+     * Check whether flag(s) are set.
+     *
+     * @param flag      Flag(s) to test.
+     * @returns         True if any flag in @a flag is set, otherwise false.
+     */
+    bool Has(FlagsEnum flag) const { return (mValue & static_cast<IntegerType>(flag)) != 0; }
+
+    /**
+     * Check that no flags outside the arguments are set.
+     *
+     * @param args      Flags to test. Arguments can be BitFlags<FlagsEnum>, BitFlags<FlagsEnum>, or FlagsEnum.
+     * @returns         True if no flag is set other than those passed.
+     *                  False if any flag is set other than those passed.
+     *
+     * @note            Flags passed need not be set; this test only requires that no *other* flags be set.
+     */
     template <typename... Args>
     bool HasOnly(Args &&... args) const
     {
-        return IsZeroAfterClearing(mValue, std::forward<Args>(args)...);
+        return (mValue & Or(std::forward<Args>(args)...)) == mValue;
     }
 
-private:
-    StorageType mValue = 0;
+    /**
+     * Check that all given flags are set.
+     *
+     * @param args      Flags to test. Arguments can be BitFlags<FlagsEnum>, BitFlags<FlagsEnum>, or FlagsEnum.
+     * @returns         True if all given flags are set.
+     *                  False if any given flag is not set.
+     */
+    template <typename... Args>
+    bool HasAll(Args &&... args) const
+    {
+        const IntegerType all = Or(std::forward<Args>(args)...);
+        return (mValue & all) == all;
+    }
 
+    /**
+     * Check that at least one of the given flags is set.
+     *
+     * @param args      Flags to test. Arguments can be BitFlags<FlagsEnum>, BitFlags<FlagsEnum>, or FlagsEnum.
+     * @returns         True if all given flags are set.
+     *                  False if any given flag is not set.
+     */
     template <typename... Args>
-    static bool IsZeroAfterClearing(StorageType value, FlagsEnum flagToClear, Args &&... args)
+    bool HasAny(Args &&... args) const
     {
-        value &= static_cast<StorageType>(~static_cast<StorageType>(flagToClear));
-        return IsZeroAfterClearing(value, std::forward<Args>(args)...);
+        return (mValue & Or(std::forward<Args>(args)...)) != 0;
     }
 
-    static bool IsZeroAfterClearing(StorageType value) { return value == 0; }
-};
+    /**
+     * Check that at least one flag is set.
+     *
+     * @returns         True if any flag is set, false otherwise.
+     */
+    bool HasAny() const { return mValue != 0; }
+
+    /**
+     * Find the logical intersection of flags.
+     *
+     * @param lhs       Some flags.
+     * @param rhs       Some flags.
+     * @returns         Flags set in both @a lhs and @a rhs.
+     *
+     * @note: A multi-argument `BitFlags` constructor serves the function of `operator|`.
+     */
+    friend BitFlags<FlagsEnum> operator&(BitFlags<FlagsEnum> lhs, const BitFlags<FlagsEnum> & rhs)
+    {
+        return BitFlags<FlagsEnum>(lhs.mValue & rhs.mValue);
+    }
 
-/**
- * @deprecated Use typesafe BitFlags class instead.
- */
-template <typename FlagsT, typename FlagT>
-inline bool GetFlag(const FlagsT & inFlags, const FlagT inFlag)
-{
-    return (inFlags & static_cast<FlagsT>(inFlag)) != 0;
-}
+    /**
+     * Get the flags as the type FlagsEnum.
+     *
+     * @note            This allows easily storing flags as a base FlagsEnum in a POD type,
+     *                  and enables equality comparisons.
+     */
+    operator FlagsEnum() const { return static_cast<FlagsEnum>(mValue); }
+
+    /**
+     * Set and/or clear all flags with a value of the underlying storage type.
+     *
+     * @param value     New storage value.
+     */
+    BitFlags & SetRaw(IntegerType value)
+    {
+        mValue = value;
+        return *this;
+    }
 
-/**
- * @deprecated Use typesafe BitFlags class instead.
- */
-template <typename FlagsT, typename FlagT>
-inline void ClearFlag(FlagsT & inFlags, const FlagT inFlag)
-{
-    inFlags &= static_cast<FlagsT>(~static_cast<FlagsT>(inFlag));
-}
+    /**
+     * Get the flags as the underlying integer type.
+     *
+     * @note            This is intended to be used only to store flags into a raw binary record.
+     */
+    IntegerType Raw() const { return mValue; }
 
-/**
- * @deprecated Use typesafe BitFlags class instead.
- */
-template <typename FlagsT, typename FlagT>
-inline void SetFlag(FlagsT & inFlags, const FlagT inFlag)
-{
-    inFlags = static_cast<FlagsT>(inFlags | static_cast<FlagsT>(inFlag));
-}
+    /**
+     * Get the address of the flags as a pointer to the underlying integer type.
+     *
+     * @note            This is intended to be used only to read flags from a raw binary record.
+     */
+    StorageType * RawStorage() { return &mValue; }
 
-/**
- * @deprecated Use typesafe BitFlags class instead.
- */
-template <typename FlagsT, typename FlagT>
-inline void SetFlag(FlagsT & inFlags, const FlagT inFlag, const bool inValue)
-{
-    if (inValue)
+private:
+    // Find the union of BitFlags and/or FlagsEnum values.
+    template <typename... Args>
+    static constexpr IntegerType Or(FlagsEnum flag, Args &&... args)
     {
-        SetFlag(inFlags, inFlag);
+        return static_cast<IntegerType>(flag) | Or(std::forward<Args>(args)...);
     }
-    else
+    template <typename... Args>
+    static constexpr IntegerType Or(const BitFlags<FlagsEnum> & flags, Args &&... args)
     {
-        ClearFlag(inFlags, inFlag);
+        return flags.mValue | Or(std::forward<Args>(args)...);
     }
-}
+    static constexpr IntegerType Or(FlagsEnum value) { return static_cast<IntegerType>(value); }
+    static constexpr IntegerType Or(const BitFlags<FlagsEnum> & flags) { return flags.Raw(); }
+
+    StorageType mValue = 0;
+};
 
 } // namespace chip
diff --git a/src/lib/support/BufBound.h b/src/lib/support/BufBound.h
deleted file mode 100644 (file)
index 2262a74..0000000
+++ /dev/null
@@ -1,160 +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.
- */
-
-/**
- *  @file
- *    BufBound manages serial writes to a buffer, guarding that the bounds of
- *     the buffer are not exceeded.
- *
- */
-
-#pragma once
-
-#include <climits>
-#include <stdint.h>
-#include <string.h>
-
-namespace chip {
-
-/**
- *  @class BufBound
- *
- *  simple buffer writer
- */
-class BufBound
-{
-private:
-    uint8_t * mBuf;
-    size_t mSize;
-    size_t mNeeded;
-
-public:
-    BufBound(uint8_t * buf, size_t len) : mBuf(buf), mSize(len), mNeeded(0) {}
-    BufBound(const BufBound & other) = default;
-
-    /*
-     * @brief append a single byte
-     */
-    BufBound & Put(uint8_t c)
-    {
-        if (mNeeded < mSize)
-        {
-            mBuf[mNeeded] = c;
-        }
-        ++mNeeded;
-        return *this;
-    }
-
-    /*
-     * @brief append a null terminated string, exclude the null term
-     */
-    BufBound & Put(const char * s)
-    {
-        static_assert(CHAR_BIT == 8, "We're assuming char and uint8_t are the same size");
-        while (*s != 0)
-        {
-            Put(static_cast<uint8_t>(*s++));
-        }
-        return *this;
-    }
-    BufBound & Put8(uint8_t c) { return Put(c); }
-
-    BufBound & Put(uint64_t x, size_t size)
-    {
-        while (size-- > 0)
-        {
-            uint8_t c = x & 0xff;
-            Put(c);
-            x >>= 8;
-        }
-        return *this;
-    }
-
-    /*
-     * @brief write integer x into the buffer, least significant byte first
-     */
-    BufBound & Put64(uint64_t x) { return Put(x, sizeof(x)); }
-    BufBound & Put32(uint32_t x) { return Put(x, sizeof(x)); }
-    BufBound & Put16(uint16_t x) { return Put(x, sizeof(x)); }
-
-    BufBound & PutBE(uint64_t x, size_t size)
-    {
-        while (size-- > 0)
-        {
-            uint8_t c = (x >> (size * 8)) & 0xff;
-            Put(c);
-        }
-        return *this;
-    }
-
-    /*
-     * @brief write integer x into the buffer, most significant byte first
-     */
-    BufBound & PutBE64(uint64_t x) { return PutBE(x, sizeof(x)); }
-    BufBound & PutBE32(uint32_t x) { return PutBE(x, sizeof(x)); }
-    BufBound & PutBE16(uint16_t x) { return PutBE(x, sizeof(x)); }
-
-    /*
-     * @brief append a buffer
-     */
-    BufBound & Put(const uint8_t * buf, size_t len) { return Put(reinterpret_cast<const void *>(buf), len); }
-    BufBound & Put(const void * buf, size_t len)
-    {
-        size_t available = Available();
-
-        memmove(mBuf + mNeeded, buf, available < len ? available : len);
-
-        mNeeded += len;
-
-        return *this;
-    }
-
-    /*
-     * @brief number of bytes required to satisfy all calls to Put() so far
-     */
-    size_t Needed() const { return mNeeded; }
-    /*
-     * @brief bytes available
-     */
-    size_t Available() const { return mSize < mNeeded ? 0 : mSize - mNeeded; }
-
-    /*
-     * @brief whether the input fit in the buffer
-     */
-    bool Fit() const
-    {
-        size_t _;
-        return Fit(_);
-    }
-
-    /*
-     * @brief returns whether the input fit in the buffer, outputs what was
-     *        actually written
-     */
-    bool Fit(size_t & actually_written) const
-    {
-        actually_written = mSize >= mNeeded ? mNeeded : mSize;
-        return mSize >= mNeeded;
-    }
-
-    /*
-     * @brief Size of the buffer
-     */
-    size_t Size() const { return mSize; }
-};
-
-} // namespace chip
index e1f4093..11b2714 100644 (file)
@@ -38,7 +38,7 @@ char NibbleToHex(uint8_t nibble, bool uppercase)
 
 } // namespace
 
-CHIP_ERROR BytesToHex(const uint8_t * src_bytes, size_t src_size, char * dest_hex, size_t dest_size_max, HexFlags flags)
+CHIP_ERROR BytesToHex(const uint8_t * src_bytes, size_t src_size, char * dest_hex, size_t dest_size_max, BitFlags<HexFlags> flags)
 {
     if ((src_bytes == nullptr) || (dest_hex == nullptr))
     {
@@ -52,14 +52,14 @@ CHIP_ERROR BytesToHex(const uint8_t * src_bytes, size_t src_size, char * dest_he
         return CHIP_ERROR_INVALID_ARGUMENT;
     }
 
-    bool nul_terminate          = (static_cast<int>(flags) & static_cast<int>(HexFlags::kNullTerminate)) != 0;
+    bool nul_terminate          = flags.Has(HexFlags::kNullTerminate);
     size_t expected_output_size = (src_size * 2u) + (nul_terminate ? 1u : 0u);
     if (dest_size_max < expected_output_size)
     {
         return CHIP_ERROR_BUFFER_TOO_SMALL;
     }
 
-    bool uppercase = (static_cast<int>(flags) & static_cast<int>(HexFlags::kUppercase)) != 0;
+    bool uppercase = flags.Has(HexFlags::kUppercase);
     char * cursor  = dest_hex;
     for (size_t byte_idx = 0; byte_idx < src_size; ++byte_idx)
     {
index b62617b..bbd2025 100644 (file)
 #pragma once
 
 #include <core/CHIPError.h>
+#include <support/BitFlags.h>
+
 #include <stdint.h>
 #include <stdlib.h>
 
 namespace chip {
 namespace Encoding {
 
-enum HexFlags : int
+enum class HexFlags : int
 {
     kNone = 0u,
     // Use uppercase A-F if set otherwise, lowercase a-f
@@ -68,7 +70,7 @@ enum HexFlags : int
  * @return CHIP_NO_ERROR on success
  */
 
-CHIP_ERROR BytesToHex(const uint8_t * src_bytes, size_t src_size, char * dest_hex, size_t dest_size_max, HexFlags flags);
+CHIP_ERROR BytesToHex(const uint8_t * src_bytes, size_t src_size, char * dest_hex, size_t dest_size_max, BitFlags<HexFlags> flags);
 
 // Alias for Uppercase option, no null-termination
 inline CHIP_ERROR BytesToUppercaseHexBuffer(const uint8_t * src_bytes, size_t src_size, char * dest_hex_buf, size_t dest_size_max)
diff --git a/src/lib/support/logging/CHIPLoggingLogV.cpp b/src/lib/support/logging/CHIPLoggingLogV.cpp
deleted file mode 100644 (file)
index 32895ff..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2017 Nest Labs, Inc.
- *
- *    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.
- */
-
-/**
- *    @file
- *      This file implements macros, constants, and interfaces for a
- *      platform-independent logging interface for the chip SDK.
- *
- */
-
-#include "CHIPLogging.h"
-
-#include <core/CHIPCore.h>
-#include <support/CodeUtils.h>
-#include <support/DLLUtil.h>
-
-#if CHIP_LOGGING_STYLE_ANDROID && defined(__ANDROID__)
-#include <android/log.h>
-#endif
-
-#if CHIP_LOGGING_STYLE_DARWIN
-#include <os/log.h>
-#endif
-
-#if HAVE_SYS_TIME_H && CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS
-#include <sys/time.h>
-#endif // HAVE_SYS_TIME_H && CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-namespace chip {
-namespace Logging {
-
-#if _CHIP_USE_LOGGING
-
-#if !CHIP_LOGGING_STYLE_EXTERNAL
-/*
- * Only enable an in-package implementation of the logging interface
- * if external logging was not requested. Within that, the package
- * supports either Android-style or C Standard I/O-style logging.
- *
- * In the event a "weak" variant is specified, i.e
- * CHIP_LOGGING_STYLE_STDIO_WEAK, the in-package implementation will
- * be provided but with "weak" linkage
- */
-
-/**
- * Log, to the platform-specified mechanism, the specified log
- * message, @a msg, for the specified module, @a module, in the
- * provided category, @a category.
- *
- * @param[in] module    A LogModule enumeration indicating the
- *                      source of the chip package module that
- *                      generated the log message. This must be
- *                      translated within the function to a module
- *                      name for inclusion in the log message.
- * @param[in] category  A LogCategory enumeration indicating the
- *                      category of the log message. The category
- *                      may be filtered in or out if
- *                      CHIP_LOG_FILTERING was asserted.
- * @param[in] msg       A pointer to a NULL-terminated C string with
- *                      C Standard Library-style format specifiers
- *                      containing the log message to be formatted and
- *                      logged.
- * @param[in] v         A variadic argument list whose elements should
- *                      correspond to the format specifiers in @a msg.
- *
- */
-
-#if CHIP_LOGGING_STYLE_STDIO_WEAK
-#define __CHIP_LOGGING_LINK_ATTRIBUTE __attribute__((weak))
-#else
-#define __CHIP_LOGGING_LINK_ATTRIBUTE
-#endif
-
-DLL_EXPORT __CHIP_LOGGING_LINK_ATTRIBUTE void LogV(uint8_t module, uint8_t category, const char * msg, va_list v)
-{
-    if (IsCategoryEnabled(category))
-    {
-
-#if CHIP_LOGGING_STYLE_ANDROID
-
-        char moduleName[ChipLoggingModuleNameLen + 1];
-        GetModuleName(moduleName, module);
-
-        int priority = (category == kLogCategory_Error) ? ANDROID_LOG_ERROR : ANDROID_LOG_DEBUG;
-
-        __android_log_vprint(priority, moduleName, msg, v);
-
-#elif CHIP_LOGGING_STYLE_STDIO || CHIP_LOGGING_STYLE_STDIO_WEAK
-
-        PrintMessagePrefix(module);
-        vprintf(msg, v);
-        printf("\n");
-
-#elif CHIP_LOGGING_STYLE_DARWIN
-
-        char moduleName[ChipLoggingModuleNameLen + 1];
-        GetModuleName(moduleName, module);
-
-        char formattedMsg[512];
-        int32_t prefixLen = snprintf(formattedMsg, sizeof(formattedMsg), "CHIP: [%s] ", moduleName);
-        if (prefixLen < 0)
-        {
-            // This should never happens.
-            return;
-        }
-
-        if (static_cast<size_t>(prefixLen) >= sizeof(formattedMsg))
-        {
-            prefixLen = sizeof(formattedMsg) - 1;
-        }
-
-        vsnprintf(formattedMsg + prefixLen, sizeof(formattedMsg) - static_cast<size_t>(prefixLen), msg, v);
-
-        switch (category)
-        {
-        case kLogCategory_Error:
-            os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_ERROR, "🔴 %{public}s", formattedMsg);
-#if TARGET_OS_MAC && TARGET_OS_IPHONE == 0
-            fprintf(stdout, "\033[1;31m");
-#endif
-            break;
-
-        case kLogCategory_Progress:
-            os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_INFO, "🔵 %{public}s", formattedMsg);
-#if TARGET_OS_MAC && TARGET_OS_IPHONE == 0
-            fprintf(stdout, "\033[0;32m");
-#endif
-            break;
-
-        case kLogCategory_Detail:
-            os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_DEBUG, "🟢 %{public}s", formattedMsg);
-#if TARGET_OS_MAC && TARGET_OS_IPHONE == 0
-            fprintf(stdout, "\033[0;34m");
-#endif
-            break;
-        }
-#if TARGET_OS_MAC && TARGET_OS_IPHONE == 0
-        fprintf(stdout, "%s\033[0m\n", formattedMsg);
-#endif
-
-#else
-
-#error "Undefined platform-specific implementation for non-externnal chip logging style!"
-
-#endif /* CHIP_LOGGING_STYLE_ANDROID */
-    }
-}
-
-#endif /* !CHIP_LOGGING_STYLE_EXTERNAL */
-
-#endif /* _CHIP_USE_LOGGING */
-
-} // namespace Logging
-} // namespace chip
diff --git a/src/lib/support/tests/TestBufBound.cpp b/src/lib/support/tests/TestBufBound.cpp
deleted file mode 100644 (file)
index 3889fd5..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      This file implements a unit test suite for CHIP BufBound
- *
- */
-
-#include "TestSupport.h"
-
-#include <support/BufBound.h>
-#include <support/UnitTestRegistration.h>
-
-#include <nlunit-test.h>
-
-using namespace chip;
-
-class BBTest : public BufBound
-{
-public:
-    static const size_t kLen    = 64;
-    static const uint8_t kGuard = 0xfe;
-    uint8_t mBuf[kLen];
-    size_t mLen;
-
-    BBTest(size_t len) : BufBound(mBuf + 1, len), mLen(len) { memset(mBuf, kGuard, kLen); }
-
-    bool expect(const void * val, size_t needed, size_t available)
-    {
-        // check guards
-        for (size_t i = mLen + 1; i < sizeof(mBuf); i++)
-        {
-            if (mBuf[i] != kGuard)
-            {
-                return false;
-            }
-        }
-        if (mBuf[0] != kGuard)
-        {
-            return false;
-        }
-
-        size_t written = 0xcafebabe;
-        bool fit       = Fit(written);
-        if (written == 0xcafebabe)
-        {
-            printf("Fit(written) didn't set written\n");
-            return false;
-        }
-        if ((fit && (mLen < needed || written != needed)) || (!fit && (mLen >= needed || written != mLen)))
-        {
-            printf("Fit(written) is wrong: mLen == %zu, needed == %zu, written == %zu, Fit() == %s\n", mLen, needed, written,
-                   fit ? "true" : "false");
-            return false;
-        }
-
-        // check everything else
-        if (memcmp(mBuf + 1, val, needed < mLen ? needed : mLen) != 0)
-        {
-            return false;
-        }
-
-        return Available() == available && Needed() == needed;
-    }
-};
-
-static void TestBufBound_Str(nlTestSuite * inSuite, void * inContext)
-{
-    {
-        (void) inContext;
-        BBTest bb(2);
-
-        bb.Put("hi");
-
-        NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0));
-    }
-    {
-        (void) inContext;
-        BBTest bb(1);
-        bb.Put("hi");
-
-        NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0));
-    }
-}
-
-static void TestBufBound_Buf(nlTestSuite * inSuite, void * inContext)
-{
-    {
-        (void) inContext;
-        BBTest bb(2);
-        bb.Put("hi", 2);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0));
-    }
-    {
-        (void) inContext;
-        BBTest bb(1);
-        bb.Put("hi", 2);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0));
-    }
-}
-
-static void TestBufBound_Put(nlTestSuite * inSuite, void * inContext)
-{
-    (void) inContext;
-    {
-        BBTest bb(2);
-
-        bb.Put16('h' + 'i' * 256);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0));
-    }
-    {
-        BBTest bb(4);
-
-        bb.Put32(0x01020304);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("\x04\x03\x02\x01", 4, 0));
-    }
-
-    {
-        BBTest bb(8);
-
-        bb.Put64(0x0102030405060708);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("\x08\x07\x06\x05\x04\x03\x02\x01", 8, 0));
-    }
-
-    {
-        BBTest bb(3);
-
-        bb.Put(0x0102030405060708u, 3);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("\x08\x07\x06", 3, 0));
-    }
-}
-
-static void TestBufBound_PutBE(nlTestSuite * inSuite, void * inContext)
-{
-    (void) inContext;
-    {
-        BBTest bb(2);
-
-        bb.PutBE16('i' + 'h' * 256);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0));
-    }
-
-    {
-        BBTest bb(4);
-
-        bb.PutBE32(0x01020304);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("\x01\x02\x03\x04", 4, 0));
-    }
-
-    {
-        BBTest bb(8);
-
-        bb.PutBE64(0x0102030405060708);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("\x01\x02\x03\x04\x05\x06\x07\x08", 8, 0));
-    }
-
-    {
-        BBTest bb(3);
-
-        bb.PutBE(0x0102030405060708u, 3);
-
-        NL_TEST_ASSERT(inSuite, bb.expect("\x06\x07\x08", 3, 0));
-    }
-}
-
-#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn)
-/**
- *   Test Suite. It lists all the test functions.
- */
-static const nlTest sTests[] = { NL_TEST_DEF_FN(TestBufBound_Str), NL_TEST_DEF_FN(TestBufBound_Buf),
-                                 NL_TEST_DEF_FN(TestBufBound_Put), NL_TEST_DEF_FN(TestBufBound_PutBE), NL_TEST_SENTINEL() };
-
-int TestBufBound(void)
-{
-    nlTestSuite theSuite = { "CHIP BufBound tests", &sTests[0], nullptr, nullptr };
-
-    // Run test suit againt one context.
-    nlTestRunner(&theSuite, nullptr);
-    return nlTestRunnerStats(&theSuite);
-}
-
-CHIP_REGISTER_TEST_SUITE(TestBufBound)
diff --git a/src/lib/support/tests/TestBufBoundDriver.cpp b/src/lib/support/tests/TestBufBoundDriver.cpp
deleted file mode 100644 (file)
index a7c5950..0000000
+++ /dev/null
@@ -1,31 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the support library BufBound unit
- *      tests.
- *
- */
-
-#include "TestSupport.h"
-
-int main()
-{
-    return TestBufBound();
-}
diff --git a/src/lib/support/tests/TestBufferReaderDriver.cpp b/src/lib/support/tests/TestBufferReaderDriver.cpp
deleted file mode 100644 (file)
index 02aec2a..0000000
+++ /dev/null
@@ -1,31 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the support library buffer reader unit
- *      tests.
- *
- */
-
-#include "TestSupport.h"
-
-int main()
-{
-    return TestBufferReader();
-}
diff --git a/src/lib/support/tests/TestCHIPArgParserDriver.cpp b/src/lib/support/tests/TestCHIPArgParserDriver.cpp
deleted file mode 100644 (file)
index 706f48b..0000000
+++ /dev/null
@@ -1,35 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the support library argument parser unit
- *      tests.
- *
- */
-
-#include "TestSupport.h"
-
-#include <support/CHIPMem.h>
-
-int main()
-{
-    chip::Platform::MemoryInit();
-
-    return TestCHIPArgParser();
-}
diff --git a/src/lib/support/tests/TestCHIPCounterDriver.cpp b/src/lib/support/tests/TestCHIPCounterDriver.cpp
deleted file mode 100644 (file)
index 8f524c1..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      Unit tests driver for the Chip Counter API.
- *
- */
-
-#include "TestSupport.h"
-
-#include <nlunit-test.h>
-
-int main(int argc, char * argv[])
-{
-    // Generate machine-readable, comma-separated value (CSV) output.
-    nl_test_set_output_style(OUTPUT_CSV);
-
-    return TestCHIPCounter();
-}
diff --git a/src/lib/support/tests/TestCHIPMemDriver.cpp b/src/lib/support/tests/TestCHIPMemDriver.cpp
deleted file mode 100644 (file)
index 1ea1114..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for CHIP Memory Management code code unit tests.
- *
- */
-
-#include "TestSupport.h"
-
-int main()
-{
-    return (TestMemAlloc());
-}
diff --git a/src/lib/support/tests/TestErrorStrDriver.cpp b/src/lib/support/tests/TestErrorStrDriver.cpp
deleted file mode 100644 (file)
index c42c25e..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the support library error string unit tests.
- *
- */
-
-#include "TestSupport.h"
-
-int main()
-{
-    return (TestErrorStr());
-}
diff --git a/src/lib/support/tests/TestPersistedCounterDriver.cpp b/src/lib/support/tests/TestPersistedCounterDriver.cpp
deleted file mode 100644 (file)
index adfe082..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      Unit tests driver for the Chip Persisted Storage API.
- *
- */
-
-#include "TestSupport.h"
-
-#include <nlunit-test.h>
-
-int main(int argc, char * argv[])
-{
-    // Generate machine-readable, comma-separated value (CSV) output.
-    nl_test_set_output_style(OUTPUT_CSV);
-
-    return TestPersistedCounter(argc, argv);
-}
diff --git a/src/lib/support/tests/TestSafeIntDriver.cpp b/src/lib/support/tests/TestSafeIntDriver.cpp
deleted file mode 100644 (file)
index 00bafa8..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the support library safe integer casting functions.
- *
- */
-
-#include "TestSupport.h"
-
-int main()
-{
-    return TestSafeInt();
-}
diff --git a/src/lib/support/tests/TestScopedBufferDriver.cpp b/src/lib/support/tests/TestScopedBufferDriver.cpp
deleted file mode 100644 (file)
index 9cea899..0000000
+++ /dev/null
@@ -1,22 +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.
- */
-#include "TestSupport.h"
-
-int main()
-{
-    return (TestScopedBuffer());
-}
diff --git a/src/lib/support/tests/TestSerializableIntegerSetDriver.cpp b/src/lib/support/tests/TestSerializableIntegerSetDriver.cpp
deleted file mode 100644 (file)
index 32ff80c..0000000
+++ /dev/null
@@ -1,22 +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.
- */
-#include "TestSupport.h"
-
-int main()
-{
-    return (TestSerializableIntegerSet());
-}
diff --git a/src/lib/support/tests/TestSupport.h b/src/lib/support/tests/TestSupport.h
deleted file mode 100644 (file)
index ffa78d7..0000000
+++ /dev/null
@@ -1,45 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry points for CHIP support library
- *      unit tests.
- *
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int TestCHIPArgParser(void);
-int TestErrorStr(void);
-int TestTimeUtils(void);
-int TestMemAlloc(void);
-int TestBufBound(void);
-int TestCHIPCounter(void);
-int TestPersistedCounter(int argc, char * argv[]);
-int TestScopedBuffer(void);
-int TestSafeInt();
-int TestSerializableIntegerSet(void);
-int TestBufferReader();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/src/lib/support/tests/TestTimeUtilsDriver.cpp b/src/lib/support/tests/TestTimeUtilsDriver.cpp
deleted file mode 100644 (file)
index a3680ef..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the support library time utilities unit tests.
- *
- */
-
-#include "TestSupport.h"
-
-int main()
-{
-    return (TestTimeUtils());
-}
index 2c9917a..35e33d4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -205,7 +205,7 @@ private:
     // actions with a delegate pattern.
     uint8_t mChallenge[kMsgCounterChallengeSize]; // Challenge number to identify the sychronization request cryptographically.
 
-    BitFlags<uint16_t, ExFlagValues> mFlags; // Internal state flags
+    BitFlags<ExFlagValues> mFlags; // Internal state flags
 
     /**
      *  Search for an existing exchange that the message applies to.
index aafa7d8..61d7dd8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    All rights reserved.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -55,7 +55,7 @@ enum class MessageFlagValues : uint32_t
     kViaEphemeralUDPPort = 0x00040000,
 };
 
-using MessageFlags = BitFlags<uint32_t, MessageFlagValues>;
+using MessageFlags = BitFlags<MessageFlagValues>;
 
 enum class SendMessageFlags : uint16_t
 {
@@ -76,7 +76,7 @@ enum class SendMessageFlags : uint16_t
     kNoAutoRequestAck = 0x0400,
 };
 
-using SendFlags = BitFlags<uint16_t, SendMessageFlags>;
+using SendFlags = BitFlags<SendMessageFlags>;
 
 } // namespace Messaging
 } // namespace chip
index 577e9a8..d1cefb9 100644 (file)
@@ -181,7 +181,7 @@ CHIP_ERROR ReliableMessageContext::HandleRcvdAck(uint32_t AckMsgId)
     return err;
 }
 
-CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t MessageId, BitFlags<uint32_t, MessageFlagValues> MsgFlags)
+CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t MessageId, BitFlags<MessageFlagValues> MsgFlags)
 
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
@@ -260,7 +260,7 @@ CHIP_ERROR ReliableMessageContext::SendStandaloneAckMessage()
     if (mExchange != nullptr)
     {
         err = mExchange->SendMessage(Protocols::SecureChannel::MsgType::StandaloneAck, std::move(msgBuf),
-                                     BitFlags<uint16_t, SendMessageFlags>{ SendMessageFlags::kNoAutoRequestAck });
+                                     BitFlags<SendMessageFlags>{ SendMessageFlags::kNoAutoRequestAck });
     }
     else
     {
index 77c55db..57bf18e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    All rights reserved.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -203,12 +203,12 @@ private:
         kFlagMsgRcvdFromPeer = 0x0080,
     };
 
-    BitFlags<uint16_t, Flags> mFlags; // Internal state flags
+    BitFlags<Flags> mFlags; // Internal state flags
 
     void Retain();
     void Release();
     CHIP_ERROR HandleRcvdAck(uint32_t AckMsgId);
-    CHIP_ERROR HandleNeedsAck(uint32_t MessageId, BitFlags<uint32_t, MessageFlagValues> Flags);
+    CHIP_ERROR HandleNeedsAck(uint32_t MessageId, BitFlags<MessageFlagValues> Flags);
 
 private:
     friend class ReliableMessageMgr;
diff --git a/src/messaging/ReliableMessageManager.cpp b/src/messaging/ReliableMessageManager.cpp
deleted file mode 100644 (file)
index 9857430..0000000
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      This file implements the CHIP reliable message protocol.
- *
- */
-
-#include <inttypes.h>
-
-#include <messaging/ReliableMessageManager.h>
-
-#include <messaging/ErrorCategory.h>
-#include <messaging/Flags.h>
-#include <messaging/ReliableMessageContext.h>
-#include <support/BitFlags.h>
-#include <support/CHIPFaultInjection.h>
-#include <support/CodeUtils.h>
-#include <support/logging/CHIPLogging.h>
-
-namespace chip {
-namespace Messaging {
-
-ReliableMessageManager::RetransTableEntry::RetransTableEntry() :
-    rc(nullptr), msgBuf(nullptr), msgId(0), msgSendFlags(0), nextRetransTimeTick(0), sendCount(0)
-{}
-
-ReliableMessageManager::ReliableMessageManager() :
-    mTimeStampBase(System::Timer::GetCurrentEpoch()), mCurrentTimerExpiry(0),
-    mTimerIntervalShift(CHIP_CONFIG_RMP_TIMER_DEFAULT_PERIOD_SHIFT)
-{}
-
-ReliableMessageManager::~ReliableMessageManager() {}
-
-void ReliableMessageManager::ProcessDelayedDeliveryMessage(ReliableMessageContext * rc, uint32_t PauseTimeMillis)
-{
-    // Expire any virtual ticks that have expired so all wakeup sources reflect the current time
-    ExpireTicks();
-
-    // Go through the retrans table entries for that node and adjust the timer.
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        // Exchcontext is the sentinel object to ascertain validity of the element
-        if (RetransTable[i].rc && RetransTable[i].rc == rc)
-        {
-            // Paustime is specified in milliseconds; Update retrans values
-            RetransTable[i].nextRetransTimeTick =
-                static_cast<uint16_t>(RetransTable[i].nextRetransTimeTick + (PauseTimeMillis >> mTimerIntervalShift));
-        } // exchContext
-    }     // for loop in table entry
-
-    // Schedule next physical wakeup
-    StartTimer();
-}
-
-/**
- * Return a tick counter value given a time period.
- *
- * @param[in]  newTime        Timestamp value of in milliseconds.
- *
- * @return Tick count for the time period.
- */
-uint64_t ReliableMessageManager::GetTickCounterFromTimePeriod(uint64_t period)
-{
-    return (period >> mTimerIntervalShift);
-}
-
-/**
- * Return a tick counter value between the given time and the stored time.
- *
- * @param[in]  newTime        Timestamp value of in milliseconds.
- *
- * @return Tick count of the difference between the given time and the stored time.
- */
-uint64_t ReliableMessageManager::GetTickCounterFromTimeDelta(uint64_t newTime)
-{
-    return GetTickCounterFromTimePeriod(newTime - mTimeStampBase);
-}
-
-#if defined(RMP_TICKLESS_DEBUG)
-void ReliableMessageManager::TicklessDebugDumpRetransTable(const char * log)
-{
-    ChipLogProgress(ExchangeManager, log);
-
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        if (RetransTable[i].rc)
-        {
-            ChipLogProgress(ExchangeManager, "EC:%04" PRIX16 " MsgId:%08" PRIX32 " NextRetransTimeCtr:%04" PRIX16,
-                            RetransTable[i].rc, RetransTable[i].msgId, RetransTable[i].nextRetransTimeTick);
-        }
-    }
-}
-#else
-void ReliableMessageManager::TicklessDebugDumpRetransTable(const char * log)
-{
-    return;
-}
-#endif // RMP_TICKLESS_DEBUG
-
-/**
- * Iterate through active exchange contexts and retrans table entries.  If an
- * action needs to be triggered by ReliableMessageProtocol time facilities,
- * execute that action.
- */
-void ReliableMessageManager::ExecuteActions()
-{
-#if defined(RMP_TICKLESS_DEBUG)
-    ChipLogProgress(ExchangeManager, "ReliableMessageManager::ExecuteActions");
-#endif
-
-    ExecuteForAllContext([](ReliableMessageContext * rc) {
-        if (rc->IsAckPending())
-        {
-            if (0 == rc->mNextAckTimeTick)
-            {
-#if defined(RMP_TICKLESS_DEBUG)
-                ChipLogProgress(ExchangeManager, "ReliableMessageManager::ExecuteActions sending ACK");
-#endif
-                // Send the Ack in a Common::Null message
-                rc->SendCommonNullMessage();
-                rc->SetAckPending(false);
-            }
-        }
-    });
-
-    TicklessDebugDumpRetransTable("ReliableMessageManager::ExecuteActions Dumping RetransTable entries before processing");
-
-    // Retransmit / cancel anything in the retrans table whose retrans timeout
-    // has expired
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        ReliableMessageContext * rc = RetransTable[i].rc;
-        CHIP_ERROR err              = CHIP_NO_ERROR;
-
-        if (!rc || RetransTable[i].nextRetransTimeTick != 0)
-            continue;
-
-        uint8_t sendCount = RetransTable[i].sendCount;
-
-        if (sendCount == rc->mConfig.mMaxRetrans)
-        {
-            err = CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED;
-
-            ChipLogError(ExchangeManager, "Failed to Send CHIP MsgId:%08" PRIX32 " sendCount: %" PRIu8 " max retries: %" PRIu8,
-                         RetransTable[i].msgId, sendCount, rc->mConfig.mMaxRetrans);
-
-            // Remove from Table
-            ClearRetransmitTable(RetransTable[i]);
-        }
-
-        // Resend from Table (if the operation fails, the entry is cleared)
-        if (err == CHIP_NO_ERROR)
-            err = SendFromRetransTable(&(RetransTable[i]));
-
-        if (err == CHIP_NO_ERROR)
-        {
-            // If the retransmission was successful, update the passive timer
-            RetransTable[i].nextRetransTimeTick = static_cast<uint16_t>(rc->GetCurrentRetransmitTimeoutTick());
-#if !defined(NDEBUG)
-            ChipLogProgress(ExchangeManager, "Retransmit MsgId:%08" PRIX32 " Send Cnt %d", RetransTable[i].msgId,
-                            RetransTable[i].sendCount);
-#endif
-        }
-
-        if (err != CHIP_NO_ERROR)
-            rc->mDelegate->OnSendError(err);
-    }
-
-    TicklessDebugDumpRetransTable("ReliableMessageManager::ExecuteActions Dumping RetransTable entries after processing");
-}
-
-static void TickProceed(uint16_t & time, uint64_t ticks)
-{
-    if (time >= ticks)
-    {
-        time = static_cast<uint16_t>(time - ticks);
-    }
-    else
-    {
-        time = 0;
-    }
-}
-
-/**
- * Calculate number of virtual ReliableMessageProtocol ticks that have expired
- * since we last called this function. Iterate through active exchange contexts
- * and retrans table entries, subtracting expired virtual ticks to synchronize
- * wakeup times with the current system time. Do not perform any actions beyond
- * updating tick counts, actions will be performed by the physical
- * ReliableMessageProtocol timer tick expiry.
- *
- */
-void ReliableMessageManager::ExpireTicks()
-{
-    uint64_t now = System::Timer::GetCurrentEpoch();
-
-    // Number of full ticks elapsed since last timer processing.  We always round down
-    // to the previous tick.  If we are between tick boundaries, the extra time since the
-    // last virtual tick is not accounted for here (it will be accounted for when resetting
-    // the ReliableMessageProtocol timer)
-    uint64_t deltaTicks = GetTickCounterFromTimeDelta(now);
-
-#if defined(RMP_TICKLESS_DEBUG)
-    ChipLogProgress(ExchangeManager, "ReliableMessageManager::ExpireTicks at %" PRIu64 ", %" PRIu64 ", %u", now, mTimeStampBase,
-                    deltaTicks);
-#endif
-
-    ExecuteForAllContext([deltaTicks](ReliableMessageContext * rc) {
-        if (rc->IsAckPending())
-        {
-            // Decrement counter of Ack timestamp by the elapsed timer ticks
-            TickProceed(rc->mNextAckTimeTick, deltaTicks);
-#if defined(RMP_TICKLESS_DEBUG)
-            ChipLogProgress(ExchangeManager, "ReliableMessageManager::ExpireTicks set mNextAckTimeTick to %u",
-                            rc->mNextAckTimeTick);
-#endif
-        }
-    });
-
-    // Process Throttle Time
-    // Check Throttle timeout stored in EC to set/unset Throttle flag
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        ReliableMessageContext * rc = RetransTable[i].rc;
-        if (rc)
-        {
-            // Process Retransmit Table
-            // Decrement Throttle timeout by elapsed timeticks
-            TickProceed(rc->mThrottleTimeoutTick, deltaTicks);
-#if defined(RMP_TICKLESS_DEBUG)
-            ChipLogProgress(ExchangeManager, "ReliableMessageManager::ExpireTicks set mThrottleTimeoutTick to %u",
-                            RetransTable[i].nextRetransTimeTick);
-#endif
-
-            // Decrement Retransmit timeout by elapsed timeticks
-            TickProceed(RetransTable[i].nextRetransTimeTick, deltaTicks);
-#if defined(RMP_TICKLESS_DEBUG)
-            ChipLogProgress(ExchangeManager, "ReliableMessageManager::ExpireTicks set nextRetransTimeTick to %u",
-                            RetransTable[i].nextRetransTimeTick);
-#endif
-        } // rc entry is allocated
-    }
-
-    // Re-Adjust the base time stamp to the most recent tick boundary
-    mTimeStampBase += (deltaTicks << mTimerIntervalShift);
-
-#if defined(RMP_TICKLESS_DEBUG)
-    ChipLogProgress(ExchangeManager, "ReliableMessageManager::ExpireTicks mTimeStampBase to %" PRIu64, mTimeStampBase);
-#endif
-}
-
-/**
- * Handle physical wakeup of system due to ReliableMessageProtocol wakeup.
- *
- */
-void ReliableMessageManager::Timeout(System::Layer * aSystemLayer, void * aAppState, System::Error aError)
-{
-    ReliableMessageManager * manager = reinterpret_cast<ReliableMessageManager *>(aAppState);
-
-    VerifyOrDie((aSystemLayer != nullptr) && (manager != nullptr));
-
-#if defined(RMP_TICKLESS_DEBUG)
-    ChipLogProgress(ExchangeManager, "ReliableMessageManager::Timeout\n");
-#endif
-
-    // Make sure all tick counts are sync'd to the current time
-    manager->ExpireTicks();
-
-    // Execute any actions that are due this tick
-    manager->ExecuteActions();
-
-    // Calculate next physical wakeup
-    manager->StartTimer();
-}
-
-/**
- *  Add a CHIP message into the retransmission table to be subsequently resent if a corresponding acknowledgment
- *  is not received within the retransmission timeout.
- *
- *  @param[in]    rc        A pointer to the ExchangeContext object.
- *
- *  @param[in]    msgBuf    A pointer to the message buffer holding the CHIP message to be retransmitted.
- *
- *  @param[in]    messageId The message identifier of the stored CHIP message.
- *
- *  @param[out]   rEntry    A pointer to a pointer of a retransmission table entry added into the table.
- *
- *  @retval  #CHIP_ERROR_RETRANS_TABLE_FULL If there is no empty slot left in the table for addition.
- *  @retval  #CHIP_NO_ERROR On success.
- *
- */
-CHIP_ERROR ReliableMessageManager::AddToRetransTable(ReliableMessageContext * rc, System::PacketBuffer * msgBuf, uint32_t messageId,
-                                                     uint16_t msgSendFlags, RetransTableEntry ** rEntry)
-{
-    bool added     = false;
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        // Check the exchContext pointer for finding an empty slot in Table
-        if (!RetransTable[i].rc)
-        {
-            // Expire any virtual ticks that have expired so all wakeup sources reflect the current time
-            ExpireTicks();
-
-            RetransTable[i].rc                  = rc;
-            RetransTable[i].msgId               = messageId;
-            RetransTable[i].msgBuf              = msgBuf;
-            RetransTable[i].msgSendFlags        = msgSendFlags;
-            RetransTable[i].sendCount           = 0;
-            RetransTable[i].nextRetransTimeTick = static_cast<uint16_t>(
-                rc->GetCurrentRetransmitTimeoutTick() + GetTickCounterFromTimeDelta(System::Timer::GetCurrentEpoch()));
-
-            *rEntry = &RetransTable[i];
-            // Increment the reference count
-            rc->Retain();
-            added = true;
-
-            // Check if the timer needs to be started and start it.
-            StartTimer();
-            break;
-        }
-    }
-
-    if (!added)
-    {
-        ChipLogError(ExchangeManager, "RetransTable Already Full");
-        err = CHIP_ERROR_RETRANS_TABLE_FULL;
-    }
-
-    return err;
-}
-
-void ReliableMessageManager::PauseRetransTable(ReliableMessageContext * rc, uint32_t PauseTimeMillis)
-{
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        if (RetransTable[i].rc == rc)
-        {
-            RetransTable[i].nextRetransTimeTick =
-                static_cast<uint16_t>(RetransTable[i].nextRetransTimeTick + (PauseTimeMillis >> mTimerIntervalShift));
-            break;
-        }
-    }
-}
-
-void ReliableMessageManager::ResumeRetransTable(ReliableMessageContext * rc)
-{
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        if (RetransTable[i].rc == rc)
-        {
-            RetransTable[i].nextRetransTimeTick = 0;
-            break;
-        }
-    }
-}
-
-bool ReliableMessageManager::CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t ackMsgId)
-{
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        if ((RetransTable[i].rc == rc) && RetransTable[i].msgId == ackMsgId)
-        {
-            // Clear the entry from the retransmision table.
-            ClearRetransmitTable(RetransTable[i]);
-
-#if !defined(NDEBUG)
-            ChipLogProgress(ExchangeManager, "Rxd Ack; Removing MsgId:%08" PRIX32 " from Retrans Table", ackMsgId);
-#endif
-            return true;
-        }
-    }
-
-    return false;
-}
-
-/**
- *  Send the specified entry from the retransmission table.
- *
- *  @param[in]    entry                A pointer to a retransmission table entry object that needs to be sent.
- *
- *  @return  #CHIP_NO_ERROR On success, else corresponding CHIP_ERROR returned from SendMessage.
- *
- */
-CHIP_ERROR ReliableMessageManager::SendFromRetransTable(RetransTableEntry * entry)
-{
-    CHIP_ERROR err              = CHIP_NO_ERROR;
-    ReliableMessageContext * rc = entry->rc;
-
-    // To trigger a call to OnSendError, set the number of transmissions so
-    // that the next call to ExecuteActions will abort this entry,
-    // restart the timer immediately, and ExitNow.
-
-    CHIP_FAULT_INJECT(FaultInjection::kFault_RMPSendError, entry->sendCount = static_cast<uint8_t>(rc->mConfig.mMaxRetrans + 1);
-                      entry->nextRetransTimeTick = 0; StartTimer(); ExitNow());
-
-    if (rc)
-    {
-        // Locally store the start and length;
-        uint8_t * p  = entry->msgBuf->Start();
-        uint16_t len = entry->msgBuf->DataLength();
-
-        // Send the message through
-        uint16_t msgSendFlags = entry->msgSendFlags;
-        SetFlag(msgSendFlags, MessageFlagValues::kMessageFlag_RetainBuffer);
-        err = SendMessage(rc, entry->msgBuf, msgSendFlags);
-
-        // Reset the msgBuf start pointer and data length after sending
-        entry->msgBuf->SetStart(p);
-        entry->msgBuf->SetDataLength(len);
-
-        // Update the counters
-        entry->sendCount++;
-    }
-    else
-    {
-        ChipLogError(ExchangeManager, "Table entry invalid");
-    }
-
-    VerifyOrExit(err != CHIP_NO_ERROR, err = CHIP_NO_ERROR);
-
-    // Any error generated during initial sending is evaluated for criticality which would
-    // qualify it to be reportable back to the caller. If it is non-critical then
-    // err is set to CHIP_NO_ERROR.
-    if (IsSendErrorNonCritical(err))
-    {
-        ChipLogError(ExchangeManager, "Non-crit err %ld sending CHIP MsgId:%08" PRIX32 " from retrans table", long(err),
-                     entry->msgId);
-        err = CHIP_NO_ERROR;
-    }
-    else
-    {
-        // Remove from table
-        ChipLogError(ExchangeManager, "Crit-err %ld when sending CHIP MsgId:%08" PRIX32 ", send tries: %d", long(err), entry->msgId,
-                     entry->sendCount);
-
-        ClearRetransmitTable(*entry);
-    }
-
-exit:
-    return err;
-}
-
-/**
- *  Clear entries matching a specified ExchangeContext.
- *
- *  @param[in]    rc    A pointer to the ExchangeContext object.
- *
- */
-void ReliableMessageManager::ClearRetransmitTable(ReliableMessageContext * rc)
-{
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        if (RetransTable[i].rc == rc)
-        {
-            // Clear the retransmit table entry.
-            ClearRetransmitTable(RetransTable[i]);
-        }
-    }
-}
-
-/**
- *  Clear an entry in the retransmission table.
- *
- *  @param[in]    rEntry   A reference to the RetransTableEntry object.
- *
- */
-void ReliableMessageManager::ClearRetransmitTable(RetransTableEntry & rEntry)
-{
-    if (rEntry.rc)
-    {
-        // Expire any virtual ticks that have expired so all wakeup sources reflect the current time
-        ExpireTicks();
-
-        rEntry.rc->Release();
-        rEntry.rc = nullptr;
-
-        if (rEntry.msgBuf)
-        {
-            System::PacketBuffer::Free(rEntry.msgBuf);
-            rEntry.msgBuf = nullptr;
-        }
-
-        // Clear all other fields
-        rEntry = RetransTableEntry();
-
-        // Schedule next physical wakeup
-        StartTimer();
-    }
-}
-
-/**
- *  Fail entries matching a specified ExchangeContext.
- *
- *  @param[in]    rc    A pointer to the ExchangeContext object.
- *
- *  @param[in]    err   The error for failing table entries.
- *
- */
-void ReliableMessageManager::FailRetransmitTableEntries(ReliableMessageContext * rc, CHIP_ERROR err)
-{
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        if (RetransTable[i].rc == rc)
-        {
-            // Remove the entry from the retransmission table.
-            ClearRetransmitTable(RetransTable[i]);
-
-            // Application callback OnSendError.
-            rc->mDelegate->OnSendError(err);
-        }
-    }
-}
-
-/**
- * Iterate through active exchange contexts and retrans table entries.
- * Determine how many ReliableMessageProtocol ticks we need to sleep before we
- * need to physically wake the CPU to perform an action.  Set a timer to go off
- * when we next need to wake the system.
- */
-void ReliableMessageManager::StartTimer()
-{
-    CHIP_ERROR res            = CHIP_NO_ERROR;
-    uint64_t nextWakeTimeTick = UINT64_MAX;
-    bool foundWake            = false;
-
-    // When do we need to next wake up to send an ACK?
-
-    ExecuteForAllContext([&nextWakeTimeTick, &foundWake](ReliableMessageContext * rc) {
-        if (rc->IsAckPending() && rc->mNextAckTimeTick < nextWakeTimeTick)
-        {
-            nextWakeTimeTick = rc->mNextAckTimeTick;
-            foundWake        = true;
-#if defined(RMP_TICKLESS_DEBUG)
-            ChipLogProgress(ExchangeManager, "ReliableMessageManager::StartTimer next ACK time %u", nextWakeTimeTick);
-#endif
-        }
-    });
-
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        ReliableMessageContext * rc = RetransTable[i].rc;
-        if (rc)
-        {
-            // When do we need to next wake up for throttle retransmission?
-            if (rc->mThrottleTimeoutTick != 0 && rc->mThrottleTimeoutTick < nextWakeTimeTick)
-            {
-                nextWakeTimeTick = rc->mThrottleTimeoutTick;
-                foundWake        = true;
-#if defined(RMP_TICKLESS_DEBUG)
-                ChipLogProgress(ExchangeManager, "ReliableMessageManager::StartTimer throttle timeout %u", nextWakeTimeTick);
-#endif
-            }
-
-            // When do we need to next wake up for ReliableMessageProtocol retransmit?
-            if (RetransTable[i].nextRetransTimeTick < nextWakeTimeTick)
-            {
-                nextWakeTimeTick = RetransTable[i].nextRetransTimeTick;
-                foundWake        = true;
-#if defined(RMP_TICKLESS_DEBUG)
-                ChipLogProgress(ExchangeManager, "ReliableMessageManager::StartTimer RetransTime %u", nextWakeTimeTick);
-#endif
-            }
-        }
-    }
-
-    if (foundWake)
-    {
-        // Set timer for next tick boundary - subtract the elapsed time from the current tick
-        System::Timer::Epoch timerExpiryEpoch = (nextWakeTimeTick << mTimerIntervalShift) + mTimeStampBase;
-
-#if defined(RMP_TICKLESS_DEBUG)
-        ChipLogProgress(ExchangeManager, "ReliableMessageManager::StartTimer wake at %" PRIu64 " ms (%" PRIu64 " %" PRIu64 ")",
-                        timerExpiryEpoch, nextWakeTimeTick, mTimeStampBase);
-#endif
-        if (timerExpiryEpoch != mCurrentTimerExpiry)
-        {
-            // If the tick boundary has expired in the past (delayed processing of event due to other system activity),
-            // expire the timer immediately
-            uint64_t now           = System::Timer::GetCurrentEpoch();
-            uint64_t timerArmValue = (timerExpiryEpoch > now) ? timerExpiryEpoch - now : 0;
-
-#if defined(RMP_TICKLESS_DEBUG)
-            ChipLogProgress(ExchangeManager, "ReliableMessageManager::StartTimer set timer for %" PRIu64, timerArmValue);
-#endif
-            StopTimer();
-            res = mSystemLayer->StartTimer((uint32_t) timerArmValue, Timeout, this);
-
-            VerifyOrDieWithMsg(res == CHIP_NO_ERROR, ExchangeManager, "Cannot start ReliableMessageManager::Timeout\n");
-            mCurrentTimerExpiry = timerExpiryEpoch;
-#if defined(RMP_TICKLESS_DEBUG)
-        }
-        else
-        {
-            ChipLogProgress(ExchangeManager, "ReliableMessageManager::StartTimer timer already set for %" PRIu64, timerExpiryEpoch);
-#endif
-        }
-    }
-    else
-    {
-#if defined(RMP_TICKLESS_DEBUG)
-        ChipLogProgress(ExchangeManager, "Not setting ReliableMessageProtocol timeout at %" PRIu64,
-                        System::Timer::GetCurrentEpoch());
-#endif
-        StopTimer();
-    }
-
-    TicklessDebugDumpRetransTable("ReliableMessageManager::StartTimer Dumping RetransTable entries after setting wakeup times");
-}
-
-void ReliableMessageManager::StopTimer()
-{
-    mSystemLayer->CancelTimer(Timeout, this);
-}
-
-int ReliableMessageManager::TestGetCountRetransTable()
-{
-    int count = 0;
-    for (int i = 0; i < CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE; i++)
-    {
-        ReliableMessageContext * rc = RetransTable[i].rc;
-        if (rc)
-            count++;
-    }
-    return count;
-}
-
-} // namespace Messaging
-} // namespace chip
diff --git a/src/messaging/ReliableMessageManager.h b/src/messaging/ReliableMessageManager.h
deleted file mode 100644 (file)
index 2696348..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      This file defines the classes corresponding to CHIP reliable message
- *      protocol.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-#include <messaging/ReliableMessageProtocolConfig.h>
-
-#include <core/CHIPError.h>
-#include <support/BitFlags.h>
-#include <system/SystemLayer.h>
-#include <system/SystemPacketBuffer.h>
-#include <system/SystemTimer.h>
-#include <transport/raw/MessageHeader.h>
-
-namespace chip {
-namespace Messaging {
-
-enum class SendMessageFlags : uint16_t;
-class ReliableMessageContext;
-
-class ReliableMessageManager
-{
-public:
-    /**
-     *  @class RetransTableEntry
-     *
-     *  @brief
-     *    This class is part of the CHIP Reliable Messaging Protocol and is used
-     *    to keep track of CHIP messages that have been sent and are expecting an
-     *    acknowledgment back. If the acknowledgment is not received within a
-     *    specific timeout, the message would be retransmitted from this table.
-     *
-     */
-    struct RetransTableEntry
-    {
-        RetransTableEntry();
-
-        ReliableMessageContext * rc;   /**< The context for the stored CHIP message. */
-        System::PacketBuffer * msgBuf; /**< A pointer to the PacketBuffer object holding the CHIP message. */
-        uint32_t msgId;                /**< The message identifier of the CHIP message awaiting acknowledgment. */
-        uint16_t msgSendFlags;
-        uint16_t nextRetransTimeTick; /**< A counter representing the next retransmission time for the message. */
-        uint8_t sendCount;            /**< A counter representing the number of times the message has been sent. */
-    };
-
-public:
-    ReliableMessageManager();
-    ~ReliableMessageManager();
-
-    void Init(chip::System::Layer & system) { mSystemLayer = &system; }
-    void Shutdown() {}
-
-    void FreeContext(ReliableMessageContext * rc);
-
-    uint64_t GetTickCounterFromTimePeriod(uint64_t period);
-    uint64_t GetTickCounterFromTimeDelta(uint64_t newTime);
-
-    void ExecuteActions();
-    void ProcessDelayedDeliveryMessage(ReliableMessageContext * rc, uint32_t PauseTimeMillis);
-    static void Timeout(System::Layer * aSystemLayer, void * aAppState, System::Error aError);
-
-    CHIP_ERROR AddToRetransTable(ReliableMessageContext * rc, System::PacketBuffer * msgBuf, uint32_t messageId,
-                                 uint16_t msgSendFlags, RetransTableEntry ** rEntry);
-    void PauseRetransTable(ReliableMessageContext * rc, uint32_t PauseTimeMillis);
-    void ResumeRetransTable(ReliableMessageContext * rc);
-    bool CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t msgId);
-    CHIP_ERROR SendFromRetransTable(RetransTableEntry * entry);
-    void ClearRetransmitTable(ReliableMessageContext * rc);
-    void ClearRetransmitTable(RetransTableEntry & rEntry);
-    void FailRetransmitTableEntries(ReliableMessageContext * rc, CHIP_ERROR err);
-
-    void StartTimer();
-    void StopTimer();
-    void ExpireTicks();
-
-    // Functions for testing
-    int TestGetCountRetransTable();
-    void TestSetIntervalShift(uint16_t value) { mTimerIntervalShift = value; }
-
-public:
-    // public functions for ReliableMessageProtocol internal usage
-    CHIP_ERROR SendMessage(ReliableMessageContext * context, System::PacketBuffer * msgBuf, uint16_t sendFlags);
-    CHIP_ERROR SendMessage(ReliableMessageContext * context, uint32_t profileId, uint8_t msgType, System::PacketBuffer * msgBuf,
-                           BitFlags<uint16_t, SendMessageFlags> sendFlags);
-
-private:
-    chip::System::Layer * mSystemLayer;
-    uint64_t mTimeStampBase;                  // ReliableMessageProtocol timer base value to add offsets to evaluate timeouts
-    System::Timer::Epoch mCurrentTimerExpiry; // Tracks when the ReliableMessageProtocol timer will next expire
-    uint16_t mTimerIntervalShift;             // ReliableMessageProtocol Timer tick period shift
-
-    /* Placeholder function to run a function for all exchanges */
-    template <typename Function>
-    void ExecuteForAllContext(Function function)
-    {}
-
-    void TicklessDebugDumpRetransTable(const char * log);
-
-    // ReliableMessageProtocol Global tables for timer context
-    RetransTableEntry RetransTable[CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE];
-};
-
-} // namespace Messaging
-} // namespace chip
index 275d39d..9f0cc44 100644 (file)
@@ -103,7 +103,7 @@ CHIP_ERROR SendEchoRequest(void)
 
     printf("\nSend echo request message to Node: %" PRIu64 "\n", chip::kTestDeviceNodeId);
 
-    err = gEchoClient.SendEchoRequest(std::move(payloadBuf));
+    err = gEchoClient.SendEchoRequest(std::move(payloadBuf), chip::Messaging::SendFlags(chip::Messaging::SendMessageFlags::kNone));
 
     if (err == CHIP_NO_ERROR)
     {
index 4b924b5..e5451ad 100644 (file)
@@ -30,7 +30,7 @@ if (chip_enable_openthread) {
   }
 }
 
-if (chip_device_platform == "linux" && chip_enable_mdns) {
+if (chip_device_platform == "linux" && chip_mdns != "none") {
   pkg_config("avahi_client_config") {
     packages = [ "avahi-client" ]
   }
@@ -75,7 +75,7 @@ if (chip_device_platform != "none") {
       defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=${chip_enable_ble}" ]
     }
 
-    if (chip_enable_mdns) {
+    if (chip_mdns != "none") {
       defines += [ "CHIP_DEVICE_CONFIG_ENABLE_MDNS=1" ]
     }
 
@@ -241,7 +241,7 @@ if (chip_device_platform != "none" && chip_device_platform != "external") {
       "${chip_root}/src:includes",
     ]
 
-    if (chip_enable_mdns) {
+    if (chip_mdns != "none") {
       public_deps += [ "${chip_root}/src/lib/mdns:platform_header" ]
     }
 
@@ -494,7 +494,7 @@ if (chip_device_platform != "none" && chip_device_platform != "external") {
         "Linux/bluez/Types.h",
       ]
 
-      if (chip_enable_mdns) {
+      if (chip_mdns != "none") {
         sources += [
           "Linux/MdnsImpl.cpp",
           "Linux/MdnsImpl.h",
@@ -595,6 +595,11 @@ if (chip_device_platform != "none" && chip_device_platform != "external") {
       }
     }
 
+    if (chip_enable_openthread && chip_mdns == "platform" &&
+        chip_device_platform != "linux") {
+      sources += [ "OpenThread/MdnsImpl.cpp" ]
+    }
+
     allow_circular_includes_from = [ "${chip_root}/src/lib/support" ]
   }
 } else if (chip_device_platform == "external") {
index 85d44f3..82e0404 100644 (file)
@@ -171,7 +171,7 @@ 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. */
 
-    mFlags = CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? kFlag_AdvertisingEnabled : 0;
+    mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 
 exit:
@@ -315,9 +315,9 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+        mFlags.Set(Flags::kAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -331,9 +331,9 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kFastAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -366,7 +366,7 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
             return CHIP_ERROR_INVALID_ARGUMENT;
         }
         strcpy(mDeviceName, deviceName);
-        SetFlag(mFlags, kFlag_DeviceNameSet, true);
+        mFlags.Set(Flags::kDeviceNameSet);
         ChipLogProgress(DeviceLayer, "Setting device name to : \"%s\"", deviceName);
         static_assert(kMaxDeviceNameLength <= UINT16_MAX, "deviceName length might not fit in a uint8_t");
         ret = sl_bt_gatt_server_write_attribute_value(gattdb_device_name, 0, strlen(deviceName), (uint8_t *) deviceName);
@@ -539,14 +539,14 @@ void BLEManagerImpl::DriveBLEState(void)
     CHIP_ERROR err = CHIP_NO_ERROR;
 
     // Check if BLE stack is initialized
-    VerifyOrExit(GetFlag(mFlags, kFlag_EFRBLEStackInitialized), /* */);
+    VerifyOrExit(mFlags.Has(Flags::kEFRBLEStackInitialized), /* */);
 
     // Start advertising if needed...
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && GetFlag(mFlags, kFlag_AdvertisingEnabled))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled))
     {
         // Start/re-start advertising if not already started, or if there is a pending change
         // to the advertising configuration.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_RestartAdvertising))
+        if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kRestartAdvertising))
         {
             err = StartAdvertising();
             SuccessOrExit(err);
@@ -554,7 +554,7 @@ void BLEManagerImpl::DriveBLEState(void)
     }
 
     // Otherwise, stop advertising if it is enabled.
-    else if (GetFlag(mFlags, kFlag_Advertising))
+    else if (mFlags.Has(Flags::kAdvertising))
     {
         err = StopAdvertising();
         SuccessOrExit(err);
@@ -587,7 +587,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
     err = ConfigurationMgr().GetBLEDeviceIdentificationInfo(mDeviceIdInfo);
     SuccessOrExit(err);
 
-    if (!GetFlag(mFlags, kFlag_DeviceNameSet))
+    if (!mFlags.Has(Flags::kDeviceNameSet))
     {
         snprintf(mDeviceName, sizeof(mDeviceName), "%s%04" PRIX32, CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, (uint32_t) 0);
 
@@ -685,10 +685,10 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     err = ConfigureAdvertisingData();
     SuccessOrExit(err);
 
-    ClearFlag(mFlags, kFlag_RestartAdvertising);
+    mFlags.Clear(Flags::kRestartAdvertising);
 
     interval_min = interval_max =
-        ((numConnectionss == 0 && !ConfigurationMgr().IsPairedToAccount()) || GetFlag(mFlags, kFlag_FastAdvertisingEnabled))
+        ((numConnectionss == 0 && !ConfigurationMgr().IsPairedToAccount()) || mFlags.Has(Flags::kFastAdvertisingEnabled))
         ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
         : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL;
 
@@ -700,7 +700,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
 
     if (SL_STATUS_OK == ret)
     {
-        SetFlag(mFlags, kFlag_Advertising, true);
+        mFlags.Set(Flags::kAdvertising);
     }
 
     err = MapBLEError(ret);
@@ -714,10 +714,9 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
     CHIP_ERROR err = CHIP_NO_ERROR;
     sl_status_t ret;
 
-    if (GetFlag(mFlags, kFlag_Advertising))
+    if (mFlags.Has(Flags::kAdvertising))
     {
-        ClearFlag(mFlags, kFlag_Advertising);
-        ClearFlag(mFlags, kFlag_RestartAdvertising);
+        mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising);
 
         ret = sl_bt_advertiser_stop(advertising_set_handle);
         sl_bt_advertiser_delete_set(advertising_set_handle);
@@ -754,7 +753,7 @@ void BLEManagerImpl::UpdateMtu(volatile sl_bt_msg_t * evt)
 
 void BLEManagerImpl::HandleBootEvent(void)
 {
-    SetFlag(mFlags, kFlag_EFRBLEStackInitialized, true);
+    mFlags.Set(Flags::kEFRBLEStackInitialized);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 }
 
@@ -768,7 +767,7 @@ void BLEManagerImpl::HandleConnectEvent(volatile sl_bt_msg_t * evt)
 
     AddConnection(connHandle, bondingHandle);
 
-    // SetFlag(mFlags, kFlag_RestartAdvertising, true);
+    // mFlags.Set(Flags::kRestartAdvertising);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 }
 
@@ -808,7 +807,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.
-        SetFlag(mFlags, kFlag_RestartAdvertising, true);
+        mFlags.Set(Flags::kRestartAdvertising);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 }
index 84cfc6d..3d1df68 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2019 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -90,14 +90,14 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
 
     // ===== Private members reserved for use by this class only.
 
-    enum
+    enum class Flags : uint16_t
     {
-        kFlag_AdvertisingEnabled     = 0x0001,
-        kFlag_FastAdvertisingEnabled = 0x0002,
-        kFlag_Advertising            = 0x0004,
-        kFlag_RestartAdvertising     = 0x0008,
-        kFlag_EFRBLEStackInitialized = 0x0010,
-        kFlag_DeviceNameSet          = 0x0020,
+        kAdvertisingEnabled     = 0x0001,
+        kFastAdvertisingEnabled = 0x0002,
+        kAdvertising            = 0x0004,
+        kRestartAdvertising     = 0x0008,
+        kEFRBLEStackInitialized = 0x0010,
+        kDeviceNameSet          = 0x0020,
     };
 
     enum
@@ -121,7 +121,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
     CHIPoBLEConState mBleConnections[kMaxConnections];
     uint8_t mIndConfId[kMaxConnections];
     CHIPoBLEServiceMode mServiceMode;
-    uint16_t mFlags;
+    BitFlags<Flags> mFlags;
     char mDeviceName[kMaxDeviceNameLength + 1];
     // The advertising set handle allocated from Bluetooth stack.
     uint8_t advertising_set_handle = 0xff;
@@ -182,12 +182,12 @@ inline BLEManager::CHIPoBLEServiceMode BLEManagerImpl::_GetCHIPoBLEServiceMode(v
 
 inline bool BLEManagerImpl::_IsAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
+    return mFlags.Has(Flags::kAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsFastAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
+    return mFlags.Has(Flags::kFastAdvertisingEnabled);
 }
 
 } // namespace Internal
index 0cafee5..702a0ac 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2018 Nest Labs, Inc.
  *    All rights reserved.
  *
@@ -117,20 +117,20 @@ class BLEManagerImpl final : public BLEManager,
 
     // ===== Private members reserved for use by this class only.
 
-    enum
+    enum class Flags : uint16_t
     {
-        kFlag_AsyncInitCompleted       = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
-        kFlag_ESPBLELayerInitialized   = 0x0002, /**< The ESP BLE layer has been initialized. */
-        kFlag_AppRegistered            = 0x0004, /**< The CHIPoBLE application has been registered with the ESP BLE layer. */
-        kFlag_AttrsRegistered          = 0x0008, /**< The CHIPoBLE GATT attributes have been registered with the ESP BLE layer. */
-        kFlag_GATTServiceStarted       = 0x0010, /**< The CHIPoBLE GATT service has been started. */
-        kFlag_AdvertisingConfigured    = 0x0020, /**< CHIPoBLE advertising has been configured in the ESP BLE layer. */
-        kFlag_Advertising              = 0x0040, /**< The system is currently CHIPoBLE advertising. */
-        kFlag_ControlOpInProgress      = 0x0080, /**< An async control operation has been issued to the ESP BLE layer. */
-        kFlag_AdvertisingEnabled       = 0x0100, /**< The application has enabled CHIPoBLE advertising. */
-        kFlag_FastAdvertisingEnabled   = 0x0200, /**< The application has enabled fast advertising. */
-        kFlag_UseCustomDeviceName      = 0x0400, /**< The application has configured a custom BLE device name. */
-        kFlag_AdvertisingRefreshNeeded = 0x0800, /**< The advertising configuration/state in ESP BLE layer needs to be updated. */
+        kAsyncInitCompleted       = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
+        kESPBLELayerInitialized   = 0x0002, /**< The ESP BLE layer has been initialized. */
+        kAppRegistered            = 0x0004, /**< The CHIPoBLE application has been registered with the ESP BLE layer. */
+        kAttrsRegistered          = 0x0008, /**< The CHIPoBLE GATT attributes have been registered with the ESP BLE layer. */
+        kGATTServiceStarted       = 0x0010, /**< The CHIPoBLE GATT service has been started. */
+        kAdvertisingConfigured    = 0x0020, /**< CHIPoBLE advertising has been configured in the ESP BLE layer. */
+        kAdvertising              = 0x0040, /**< The system is currently CHIPoBLE advertising. */
+        kControlOpInProgress      = 0x0080, /**< An async control operation has been issued to the ESP BLE layer. */
+        kAdvertisingEnabled       = 0x0100, /**< The application has enabled CHIPoBLE advertising. */
+        kFastAdvertisingEnabled   = 0x0200, /**< The application has enabled fast advertising. */
+        kUseCustomDeviceName      = 0x0400, /**< The application has configured a custom BLE device name. */
+        kAdvertisingRefreshNeeded = 0x0800, /**< The advertising configuration/state in ESP BLE layer needs to be updated. */
     };
 
     enum
@@ -183,7 +183,7 @@ class BLEManagerImpl final : public BLEManager,
     uint16_t mRXCharAttrHandle;
     uint16_t mTXCharAttrHandle;
     uint16_t mTXCharCCCDAttrHandle;
-    uint16_t mFlags;
+    BitFlags<Flags> mFlags;
     char mDeviceName[kMaxDeviceNameLength + 1];
 
     void DriveBLEState(void);
@@ -266,17 +266,17 @@ inline BLEManager::CHIPoBLEServiceMode BLEManagerImpl::_GetCHIPoBLEServiceMode(v
 
 inline bool BLEManagerImpl::_IsAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
+    return mFlags.Has(Flags::kAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsFastAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
+    return mFlags.Has(Flags::kFastAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsAdvertising(void)
 {
-    return GetFlag(mFlags, kFlag_Advertising);
+    return mFlags.Has(Flags::kAdvertising);
 }
 
 } // namespace Internal
index 8c0aff5..caa48de 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2018 Nest Labs, Inc.
  *    All rights reserved.
  *
@@ -401,7 +401,7 @@ CHIP_ERROR ConnectivityManagerImpl::_Init()
     mWiFiAPState                    = kWiFiAPState_NotActive;
     mWiFiStationReconnectIntervalMS = CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL;
     mWiFiAPIdleTimeoutMS            = CHIP_DEVICE_CONFIG_WIFI_AP_IDLE_TIMEOUT;
-    mFlags                          = 0;
+    mFlags.SetRaw(0);
 
     // TODO Initialize the Chip Addressing and Routing Module.
 
@@ -902,10 +902,10 @@ void ConnectivityManagerImpl::DriveAPState(::chip::System::Layer * aLayer, void
 
 void ConnectivityManagerImpl::UpdateInternetConnectivityState(void)
 {
-    bool haveIPv4Conn = false;
-    bool haveIPv6Conn = false;
-    bool hadIPv4Conn  = GetFlag(mFlags, kFlag_HaveIPv4InternetConnectivity);
-    bool hadIPv6Conn  = GetFlag(mFlags, kFlag_HaveIPv6InternetConnectivity);
+    bool haveIPv4Conn      = false;
+    bool haveIPv6Conn      = false;
+    const bool hadIPv4Conn = mFlags.Has(ConnectivityFlags::kHaveIPv4InternetConnectivity);
+    const bool hadIPv6Conn = mFlags.Has(ConnectivityFlags::kHaveIPv6InternetConnectivity);
     IPAddress addr;
 
     // If the WiFi station is currently in the connected state...
@@ -962,8 +962,8 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void)
     if (haveIPv4Conn != hadIPv4Conn || haveIPv6Conn != hadIPv6Conn)
     {
         // Update the current state.
-        SetFlag(mFlags, kFlag_HaveIPv4InternetConnectivity, haveIPv4Conn);
-        SetFlag(mFlags, kFlag_HaveIPv6InternetConnectivity, haveIPv6Conn);
+        mFlags.Set(ConnectivityFlags::kHaveIPv4InternetConnectivity, haveIPv4Conn)
+            .Set(ConnectivityFlags::kHaveIPv6InternetConnectivity, haveIPv6Conn);
 
         // Alert other components of the state change.
         ChipDeviceEvent event;
index 2a53293..f698f38 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2018 Nest Labs, Inc.
  *    All rights reserved.
  *
@@ -28,6 +28,7 @@
 #include <platform/internal/GenericConnectivityManagerImpl_NoBLE.h>
 #endif
 #include <platform/internal/GenericConnectivityManagerImpl_NoThread.h>
+#include <support/BitFlags.h>
 
 #include "esp_event.h"
 
@@ -67,6 +68,7 @@ class ConnectivityManagerImpl final : public ConnectivityManager,
     friend class ConnectivityManager;
 
 private:
+    using Flags = GenericConnectivityManagerImpl_WiFi::ConnectivityFlags;
     // ===== Members that implement the ConnectivityManager abstract interface.
 
     WiFiStationMode _GetWiFiStationMode(void);
@@ -114,7 +116,7 @@ private:
     WiFiAPState mWiFiAPState;
     uint32_t mWiFiStationReconnectIntervalMS;
     uint32_t mWiFiAPIdleTimeoutMS;
-    uint16_t mFlags;
+    BitFlags<Flags> mFlags;
 
     void DriveStationState(void);
     void OnStationConnected(void);
@@ -172,12 +174,12 @@ inline uint32_t ConnectivityManagerImpl::_GetWiFiAPIdleTimeoutMS(void)
 
 inline bool ConnectivityManagerImpl::_HaveIPv4InternetConnectivity(void)
 {
-    return ::chip::GetFlag(mFlags, kFlag_HaveIPv4InternetConnectivity);
+    return mFlags.Has(Flags::kHaveIPv4InternetConnectivity);
 }
 
 inline bool ConnectivityManagerImpl::_HaveIPv6InternetConnectivity(void)
 {
-    return ::chip::GetFlag(mFlags, kFlag_HaveIPv6InternetConnectivity);
+    return mFlags.Has(Flags::kHaveIPv6InternetConnectivity);
 }
 
 inline bool ConnectivityManagerImpl::_CanStartWiFiScan()
index 82810b3..55f9d02 100644 (file)
@@ -140,7 +140,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
     mRXCharAttrHandle     = 0;
     mTXCharAttrHandle     = 0;
     mTXCharCCCDAttrHandle = 0;
-    mFlags                = CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? kFlag_AdvertisingEnabled : 0;
+    mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
     memset(mDeviceName, 0, sizeof(mDeviceName));
 
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
@@ -172,9 +172,9 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+        mFlags.Set(Flags::kAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -188,9 +188,9 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kFastAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -221,12 +221,12 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
             return CHIP_ERROR_INVALID_ARGUMENT;
         }
         strcpy(mDeviceName, deviceName);
-        SetFlag(mFlags, kFlag_UseCustomDeviceName);
+        mFlags.Set(Flags::kUseCustomDeviceName);
     }
     else
     {
         mDeviceName[0] = 0;
-        ClearFlag(mFlags, kFlag_UseCustomDeviceName);
+        mFlags.Clear(Flags::kUseCustomDeviceName);
     }
     return CHIP_NO_ERROR;
 }
@@ -271,15 +271,15 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
 
         // Force the advertising configuration to be refreshed to reflect new provisioning state.
         ChipLogProgress(DeviceLayer, "Updating advertising data");
-        ClearFlag(mFlags, kFlag_AdvertisingConfigured);
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+        mFlags.Clear(Flags::kAdvertisingConfigured);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
 
         DriveBLEState();
 
@@ -317,8 +317,8 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId)
     ReleaseConnectionState(conId);
 
     // Force a refresh of the advertising state.
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-    ClearFlag(mFlags, kFlag_AdvertisingConfigured);
+    mFlags.Set(Flags::kAdvertisingRefreshNeeded);
+    mFlags.Clear(Flags::kAdvertisingConfigured);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 
     return (err == CHIP_NO_ERROR);
@@ -390,33 +390,33 @@ void BLEManagerImpl::DriveBLEState(void)
     CHIP_ERROR err = CHIP_NO_ERROR;
 
     // Perform any initialization actions that must occur after the Chip task is running.
-    if (!GetFlag(mFlags, kFlag_AsyncInitCompleted))
+    if (!mFlags.Has(Flags::kAsyncInitCompleted))
     {
-        SetFlag(mFlags, kFlag_AsyncInitCompleted);
+        mFlags.Set(Flags::kAsyncInitCompleted);
 
         // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled,
         // disable CHIPoBLE advertising if the device is fully provisioned.
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
     }
 
     // If there's already a control operation in progress, wait until it completes.
-    VerifyOrExit(!GetFlag(mFlags, kFlag_ControlOpInProgress), /* */);
+    VerifyOrExit(!mFlags.Has(Flags::kControlOpInProgress), /* */);
 
     // Initializes the ESP BLE layer if needed.
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_ESPBLELayerInitialized))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !mFlags.Has(Flags::kESPBLELayerInitialized))
     {
         err = InitESPBleLayer();
         SuccessOrExit(err);
     }
 
     // Register the CHIPoBLE application with the ESP BLE layer if needed.
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_AppRegistered))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !mFlags.Has(Flags::kAppRegistered))
     {
         err = esp_ble_gatts_app_register(CHIPoBLEAppId);
         if (err != CHIP_NO_ERROR)
@@ -425,13 +425,13 @@ void BLEManagerImpl::DriveBLEState(void)
             ExitNow();
         }
 
-        SetFlag(mFlags, kFlag_ControlOpInProgress);
+        mFlags.Set(Flags::kControlOpInProgress);
 
         ExitNow();
     }
 
     // Register the CHIPoBLE GATT attributes with the ESP BLE layer if needed.
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_AttrsRegistered))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !mFlags.Has(Flags::kAttrsRegistered))
     {
         err = esp_ble_gatts_create_attr_tab(CHIPoBLEGATTAttrs, mAppIf, CHIPoBLEGATTAttrCount, 0);
         if (err != CHIP_NO_ERROR)
@@ -440,13 +440,13 @@ void BLEManagerImpl::DriveBLEState(void)
             ExitNow();
         }
 
-        SetFlag(mFlags, kFlag_ControlOpInProgress);
+        mFlags.Set(Flags::kControlOpInProgress);
 
         ExitNow();
     }
 
     // Start the CHIPoBLE GATT service if needed.
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_GATTServiceStarted))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !mFlags.Has(Flags::kGATTServiceStarted))
     {
         err = esp_ble_gatts_start_service(mServiceAttrHandle);
         if (err != CHIP_NO_ERROR)
@@ -455,14 +455,14 @@ void BLEManagerImpl::DriveBLEState(void)
             ExitNow();
         }
 
-        SetFlag(mFlags, kFlag_ControlOpInProgress);
+        mFlags.Set(Flags::kControlOpInProgress);
 
         ExitNow();
     }
 
     // If the application has enabled CHIPoBLE and BLE advertising...
     if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled &&
-        GetFlag(mFlags, kFlag_AdvertisingEnabled)
+        mFlags.Has(Flags::kAdvertisingEnabled)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION
         // and no connections are active...
         && (_NumConnections() == 0)
@@ -471,12 +471,12 @@ void BLEManagerImpl::DriveBLEState(void)
     {
         // Start/re-start advertising if not already advertising, or if the advertising state of the
         // ESP BLE layer needs to be refreshed.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_AdvertisingRefreshNeeded))
+        if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kAdvertisingRefreshNeeded))
         {
             // Configure advertising data if it hasn't been done yet.  This is an asynchronous step which
             // must complete before advertising can be started.  When that happens, this method will
             // be called again, and execution will proceed to the code below.
-            if (!GetFlag(mFlags, kFlag_AdvertisingConfigured))
+            if (!mFlags.Has(Flags::kAdvertisingConfigured))
             {
                 err = ConfigureAdvertisingData();
                 ExitNow();
@@ -491,7 +491,7 @@ void BLEManagerImpl::DriveBLEState(void)
     // Otherwise stop advertising if needed...
     else
     {
-        if (GetFlag(mFlags, kFlag_Advertising))
+        if (mFlags.Has(Flags::kAdvertising))
         {
             err = esp_ble_gap_stop_advertising();
             if (err != CHIP_NO_ERROR)
@@ -500,14 +500,14 @@ void BLEManagerImpl::DriveBLEState(void)
                 ExitNow();
             }
 
-            SetFlag(mFlags, kFlag_ControlOpInProgress);
+            mFlags.Set(Flags::kControlOpInProgress);
 
             ExitNow();
         }
     }
 
     // Stop the CHIPoBLE GATT service if needed.
-    if (mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_Enabled && GetFlag(mFlags, kFlag_GATTServiceStarted))
+    if (mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kGATTServiceStarted))
     {
         // TODO: what to do about existing connections??
 
@@ -518,7 +518,7 @@ void BLEManagerImpl::DriveBLEState(void)
             ExitNow();
         }
 
-        SetFlag(mFlags, kFlag_ControlOpInProgress);
+        mFlags.Set(Flags::kControlOpInProgress);
 
         ExitNow();
     }
@@ -535,7 +535,7 @@ CHIP_ERROR BLEManagerImpl::InitESPBleLayer(void)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
 
-    VerifyOrExit(!GetFlag(mFlags, kFlag_ESPBLELayerInitialized), /* */);
+    VerifyOrExit(!mFlags.Has(Flags::kESPBLELayerInitialized), /* */);
 
     // If the ESP Bluetooth controller has not been initialized...
     if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE)
@@ -615,7 +615,7 @@ CHIP_ERROR BLEManagerImpl::InitESPBleLayer(void)
     }
     SuccessOrExit(err);
 
-    SetFlag(mFlags, kFlag_ESPBLELayerInitialized);
+    mFlags.Set(Flags::kESPBLELayerInitialized);
 
 exit:
     return err;
@@ -632,7 +632,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
     uint16_t discriminator;
     SuccessOrExit(err = ConfigurationMgr().GetSetupDiscriminator(discriminator));
 
-    if (!GetFlag(mFlags, kFlag_UseCustomDeviceName))
+    if (!mFlags.Has(Flags::kUseCustomDeviceName))
     {
         snprintf(mDeviceName, sizeof(mDeviceName), "%s%04u", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, discriminator);
         mDeviceName[kMaxDeviceNameLength] = 0;
@@ -675,7 +675,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
         ExitNow();
     }
 
-    SetFlag(mFlags, kFlag_ControlOpInProgress);
+    mFlags.Set(Flags::kControlOpInProgress);
 
 exit:
     return err;
@@ -708,7 +708,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     // Advertise in fast mode if not fully provisioned and there are no CHIPoBLE connections, or
     // if the application has expressly requested fast advertising.
     advertParams.adv_int_min = advertParams.adv_int_max =
-        ((numCons == 0 && !ConfigurationMgr().IsFullyProvisioned()) || GetFlag(mFlags, kFlag_FastAdvertisingEnabled))
+        ((numCons == 0 && !ConfigurationMgr().IsFullyProvisioned()) || mFlags.Has(Flags::kFastAdvertisingEnabled))
         ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
         : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL;
 
@@ -722,7 +722,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
         ExitNow();
     }
 
-    SetFlag(mFlags, kFlag_ControlOpInProgress);
+    mFlags.Set(Flags::kControlOpInProgress);
 
 exit:
     return err;
@@ -734,7 +734,7 @@ void BLEManagerImpl::HandleGATTControlEvent(esp_gatts_cb_event_t event, esp_gatt
     bool controlOpComplete = false;
 
     // Ignore GATT control events that do not pertain to the CHIPoBLE application, except for ESP_GATTS_REG_EVT.
-    if (event != ESP_GATTS_REG_EVT && (!GetFlag(mFlags, kFlag_AppRegistered) || gatts_if != mAppIf))
+    if (event != ESP_GATTS_REG_EVT && (!mFlags.Has(Flags::kAppRegistered) || gatts_if != mAppIf))
     {
         ExitNow();
     }
@@ -754,7 +754,7 @@ void BLEManagerImpl::HandleGATTControlEvent(esp_gatts_cb_event_t event, esp_gatt
             // Save the 'interface type' assigned to the CHIPoBLE application by the ESP BLE layer.
             mAppIf = gatts_if;
 
-            SetFlag(mFlags, kFlag_AppRegistered);
+            mFlags.Set(Flags::kAppRegistered);
             controlOpComplete = true;
         }
 
@@ -774,7 +774,7 @@ void BLEManagerImpl::HandleGATTControlEvent(esp_gatts_cb_event_t event, esp_gatt
         mTXCharAttrHandle     = param->add_attr_tab.handles[kAttrIndex_TXCharValue];
         mTXCharCCCDAttrHandle = param->add_attr_tab.handles[kAttrIndex_TXCharCCCDValue];
 
-        SetFlag(mFlags, kFlag_AttrsRegistered);
+        mFlags.Set(Flags::kAttrsRegistered);
         controlOpComplete = true;
 
         break;
@@ -789,7 +789,7 @@ void BLEManagerImpl::HandleGATTControlEvent(esp_gatts_cb_event_t event, esp_gatt
 
         ChipLogProgress(DeviceLayer, "CHIPoBLE GATT service started");
 
-        SetFlag(mFlags, kFlag_GATTServiceStarted);
+        mFlags.Set(Flags::kGATTServiceStarted);
         controlOpComplete = true;
 
         break;
@@ -804,7 +804,7 @@ void BLEManagerImpl::HandleGATTControlEvent(esp_gatts_cb_event_t event, esp_gatt
 
         ChipLogProgress(DeviceLayer, "CHIPoBLE GATT service stopped");
 
-        ClearFlag(mFlags, kFlag_GATTServiceStarted);
+        mFlags.Clear(Flags::kGATTServiceStarted);
         controlOpComplete = true;
 
         break;
@@ -826,7 +826,7 @@ exit:
     }
     if (controlOpComplete)
     {
-        ClearFlag(mFlags, kFlag_ControlOpInProgress);
+        mFlags.Clear(Flags::kControlOpInProgress);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 }
@@ -835,7 +835,7 @@ void BLEManagerImpl::HandleGATTCommEvent(esp_gatts_cb_event_t event, esp_gatt_if
 {
     // Ignore the event if the CHIPoBLE service hasn't been started, or if the event is for a different
     // BLE application.
-    if (!GetFlag(sInstance.mFlags, kFlag_GATTServiceStarted) || gatts_if != sInstance.mAppIf)
+    if (!sInstance.mFlags.Has(Flags::kGATTServiceStarted) || gatts_if != sInstance.mAppIf)
     {
         return;
     }
@@ -850,8 +850,8 @@ void BLEManagerImpl::HandleGATTCommEvent(esp_gatts_cb_event_t event, esp_gatt_if
 
         // Receiving a connection stops the advertising processes.  So force a refresh of the advertising
         // state.
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-        ClearFlag(mFlags, kFlag_AdvertisingConfigured);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
+        mFlags.Clear(Flags::kAdvertisingConfigured);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
 
         break;
@@ -1110,8 +1110,8 @@ void BLEManagerImpl::HandleDisconnect(esp_ble_gatts_cb_param_t * param)
         PlatformMgr().PostEvent(&event);
 
         // Force a refresh of the advertising state.
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-        ClearFlag(mFlags, kFlag_AdvertisingConfigured);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
+        mFlags.Clear(Flags::kAdvertisingConfigured);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 }
@@ -1212,8 +1212,8 @@ void BLEManagerImpl::HandleGAPEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb
             ExitNow(err = ESP_ERR_INVALID_RESPONSE);
         }
 
-        SetFlag(sInstance.mFlags, kFlag_AdvertisingConfigured);
-        ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress);
+        sInstance.mFlags.Set(Flags::kAdvertisingConfigured);
+        sInstance.mFlags.Clear(Flags::kControlOpInProgress);
 
         break;
 
@@ -1225,15 +1225,15 @@ void BLEManagerImpl::HandleGAPEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb
             ExitNow(err = ESP_ERR_INVALID_RESPONSE);
         }
 
-        ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress);
-        ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded);
+        sInstance.mFlags.Clear(Flags::kControlOpInProgress);
+        sInstance.mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
 
         // Transition to the Advertising state...
-        if (!GetFlag(sInstance.mFlags, kFlag_Advertising))
+        if (!sInstance.mFlags.Has(Flags::kAdvertising))
         {
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising started");
 
-            SetFlag(sInstance.mFlags, kFlag_Advertising);
+            sInstance.mFlags.Set(Flags::kAdvertising);
 
             // Post a CHIPoBLEAdvertisingChange(Started) event.
             {
@@ -1254,13 +1254,13 @@ void BLEManagerImpl::HandleGAPEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb
             ExitNow(err = ESP_ERR_INVALID_RESPONSE);
         }
 
-        ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress);
-        ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded);
+        sInstance.mFlags.Clear(Flags::kControlOpInProgress);
+        sInstance.mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
 
         // Transition to the not Advertising state...
-        if (GetFlag(sInstance.mFlags, kFlag_Advertising))
+        if (sInstance.mFlags.Has(Flags::kAdvertising))
         {
-            ClearFlag(sInstance.mFlags, kFlag_Advertising);
+            sInstance.mFlags.Clear(Flags::kAdvertising);
 
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");
 
index 1a6dddf..1960d9d 100644 (file)
@@ -129,8 +129,8 @@ CHIP_ERROR BLEManagerImpl::_Init()
 
     mRXCharAttrHandle     = 0;
     mTXCharCCCDAttrHandle = 0;
-    mFlags                = CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? kFlag_AdvertisingEnabled : 0;
-    mNumGAPCons           = 0;
+    mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
+    mNumGAPCons = 0;
     memset(mCons, 0, sizeof(mCons));
     mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
     memset(mDeviceName, 0, sizeof(mDeviceName));
@@ -164,9 +164,9 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+        mFlags.Set(Flags::kAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -180,9 +180,9 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kFastAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -212,12 +212,12 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
             return CHIP_ERROR_INVALID_ARGUMENT;
         }
         strcpy(mDeviceName, deviceName);
-        SetFlag(mFlags, kFlag_UseCustomDeviceName);
+        mFlags.Set(Flags::kUseCustomDeviceName);
     }
     else
     {
         mDeviceName[0] = 0;
-        ClearFlag(mFlags, kFlag_UseCustomDeviceName);
+        mFlags.Clear(Flags::kUseCustomDeviceName);
     }
 
 exit:
@@ -265,15 +265,15 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
 
         // Force the advertising configuration to be refreshed to reflect new provisioning state.
         ChipLogProgress(DeviceLayer, "Updating advertising data");
-        ClearFlag(mFlags, kFlag_AdvertisingConfigured);
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+        mFlags.Clear(Flags::kAdvertisingConfigured);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
 
         DriveBLEState();
         break;
@@ -309,8 +309,8 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId)
     }
 
     // Force a refresh of the advertising state.
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-    ClearFlag(mFlags, kFlag_AdvertisingConfigured);
+    mFlags.Set(Flags::kAdvertisingRefreshNeeded);
+    mFlags.Clear(Flags::kAdvertisingConfigured);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 
     return (err == CHIP_NO_ERROR);
@@ -384,23 +384,23 @@ void BLEManagerImpl::DriveBLEState(void)
     CHIP_ERROR err = CHIP_NO_ERROR;
 
     // Perform any initialization actions that must occur after the Chip task is running.
-    if (!GetFlag(mFlags, kFlag_AsyncInitCompleted))
+    if (!mFlags.Has(Flags::kAsyncInitCompleted))
     {
-        SetFlag(mFlags, kFlag_AsyncInitCompleted);
+        mFlags.Set(Flags::kAsyncInitCompleted);
 
         // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled,
         // disable CHIPoBLE advertising if the device is fully provisioned.
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
     }
 
     // Initializes the ESP BLE layer if needed.
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_ESPBLELayerInitialized))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !mFlags.Has(Flags::kESPBLELayerInitialized))
     {
         err = InitESPBleLayer();
         SuccessOrExit(err);
@@ -413,7 +413,7 @@ void BLEManagerImpl::DriveBLEState(void)
 
     // If the application has enabled CHIPoBLE and BLE advertising...
     if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled &&
-        GetFlag(mFlags, kFlag_AdvertisingEnabled)
+        mFlags.Has(Flags::kAdvertisingEnabled)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION
         // and no connections are active...
         && (_NumConnections() == 0)
@@ -422,12 +422,12 @@ void BLEManagerImpl::DriveBLEState(void)
     {
         // Start/re-start advertising if not already advertising, or if the advertising state of the
         // ESP BLE layer needs to be refreshed.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_AdvertisingRefreshNeeded))
+        if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kAdvertisingRefreshNeeded))
         {
             // Configure advertising data if it hasn't been done yet.  This is an asynchronous step which
             // must complete before advertising can be started.  When that happens, this method will
             // be called again, and execution will proceed to the code below.
-            if (!GetFlag(mFlags, kFlag_AdvertisingConfigured))
+            if (!mFlags.Has(Flags::kAdvertisingConfigured))
             {
                 err = ConfigureAdvertisingData();
                 if (err != CHIP_NO_ERROR)
@@ -446,13 +446,13 @@ void BLEManagerImpl::DriveBLEState(void)
                 ExitNow();
             }
 
-            ClearFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+            mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
             // Transition to the Advertising state...
-            if (!GetFlag(mFlags, kFlag_Advertising))
+            if (!mFlags.Has(Flags::kAdvertising))
             {
                 ChipLogProgress(DeviceLayer, "CHIPoBLE advertising started");
 
-                SetFlag(mFlags, kFlag_Advertising);
+                mFlags.Set(Flags::kAdvertising);
 
                 // Post a CHIPoBLEAdvertisingChange(Started) event.
                 {
@@ -468,7 +468,7 @@ void BLEManagerImpl::DriveBLEState(void)
     // Otherwise stop advertising if needed...
     else
     {
-        if (GetFlag(mFlags, kFlag_Advertising))
+        if (mFlags.Has(Flags::kAdvertising))
         {
             ret = ble_gap_adv_stop();
             if (ret != 0)
@@ -478,12 +478,12 @@ void BLEManagerImpl::DriveBLEState(void)
                 ExitNow();
             }
 
-            // ClearFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+            // mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
 
             // Transition to the not Advertising state...
-            if (GetFlag(mFlags, kFlag_Advertising))
+            if (mFlags.Has(Flags::kAdvertising))
             {
-                ClearFlag(mFlags, kFlag_Advertising);
+                mFlags.Clear(Flags::kAdvertising);
 
                 ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");
 
@@ -506,7 +506,7 @@ void BLEManagerImpl::DriveBLEState(void)
     }
 
     // Stop the CHIPoBLE GATT service if needed.
-    if (mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_Enabled && GetFlag(mFlags, kFlag_GATTServiceStarted))
+    if (mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kGATTServiceStarted))
     {
         // TODO: Not supported
     }
@@ -528,8 +528,8 @@ void BLEManagerImpl::bleprph_on_sync(void)
 {
     int rc;
 
-    SetFlag(sInstance.mFlags, kFlag_ESPBLELayerInitialized);
-    SetFlag(sInstance.mFlags, kFlag_GATTServiceStarted);
+    sInstance.mFlags.Set(Flags::kESPBLELayerInitialized);
+    sInstance.mFlags.Set(Flags::kGATTServiceStarted);
     ESP_LOGI(TAG, "BLE host-controller synced");
 
     uint8_t own_addr_type = BLE_OWN_ADDR_PUBLIC;
@@ -554,7 +554,7 @@ CHIP_ERROR BLEManagerImpl::InitESPBleLayer(void)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
 
-    VerifyOrExit(!GetFlag(mFlags, kFlag_ESPBLELayerInitialized), /* */);
+    VerifyOrExit(!mFlags.Has(Flags::kESPBLELayerInitialized), /* */);
 
     for (int i = 0; i < kMaxConnections; i++)
     {
@@ -609,7 +609,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
     uint16_t discriminator;
     SuccessOrExit(err = ConfigurationMgr().GetSetupDiscriminator(discriminator));
 
-    if (!GetFlag(mFlags, kFlag_UseCustomDeviceName))
+    if (!mFlags.Has(Flags::kUseCustomDeviceName))
     {
         snprintf(mDeviceName, sizeof(mDeviceName), "%s%04u", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, discriminator);
         mDeviceName[kMaxDeviceNameLength] = 0;
@@ -809,8 +809,8 @@ CHIP_ERROR BLEManagerImpl::HandleGAPConnect(struct ble_gap_event * gapEvent)
     VerifyOrExit(err != CHIP_ERROR_NO_MEMORY, err = CHIP_NO_ERROR);
     SuccessOrExit(err);
 
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-    ClearFlag(mFlags, kFlag_AdvertisingConfigured);
+    mFlags.Set(Flags::kAdvertisingRefreshNeeded);
+    mFlags.Clear(Flags::kAdvertisingConfigured);
 
 exit:
     return err;
@@ -847,8 +847,8 @@ CHIP_ERROR BLEManagerImpl::HandleGAPDisconnect(struct ble_gap_event * gapEvent)
 
     // Force a reconfiguration of advertising in case we switched to non-connectable mode when
     // the BLE connection was established.
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-    ClearFlag(mFlags, kFlag_AdvertisingConfigured);
+    mFlags.Set(Flags::kAdvertisingRefreshNeeded);
+    mFlags.Clear(Flags::kAdvertisingConfigured);
 
     return CHIP_NO_ERROR;
 }
@@ -1025,7 +1025,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     }
 #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD
 
-    ClearFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+    mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
 
     // Advertise connectable if we haven't reached the maximum number of connections.
     size_t numCons       = _NumConnections();
index 4baa040..09c216c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2020 Nest Labs, Inc.
  *    All rights reserved.
  *
@@ -119,7 +119,6 @@ EventGroupHandle_t bleAppTaskLoopEvent;
 
 /* keep the device ID of the connected peer */
 uint8_t device_id;
-uint16_t mFlags;
 
 const uint8_t ShortUUID_CHIPoBLEService[]  = { 0xAF, 0xFE };
 const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F,
@@ -140,7 +139,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
     mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
 
     // Check if BLE stack is initialized
-    VerifyOrExit(!GetFlag(mFlags, kFlag_K32WBLEStackInitialized), err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(!mFlags.Has(Flags::kK32WBLEStackInitialized), err = CHIP_ERROR_INCORRECT_STATE);
 
     // Initialize the Chip BleLayer.
     err = BleLayer::Init(this, this, &SystemLayer);
@@ -194,8 +193,8 @@ CHIP_ERROR BLEManagerImpl::_Init()
 
     GattServer_RegisterHandlesForWriteNotifications(1, attChipRxHandle);
 
-    SetFlag(mFlags, kFlag_K32WBLEStackInitialized, true);
-    SetFlag(mFlags, kFlag_AdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? true : false);
+    mFlags.Set(Flags::kK32WBLEStackInitialized);
+    mFlags.Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? true : false);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 
 exit:
@@ -218,12 +217,12 @@ uint16_t BLEManagerImpl::_NumConnections(void)
 
 bool BLEManagerImpl::_IsAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
+    return mFlags.Has(Flags::kAdvertisingEnabled);
 }
 
 bool BLEManagerImpl::_IsFastAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
+    return mFlags.Has(Flags::kFastAdvertisingEnabled);
 }
 
 bool BLEManagerImpl::RemoveConnection(uint8_t connectionHandle)
@@ -308,9 +307,9 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+        mFlags.Set(Flags::kAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -324,9 +323,9 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kFastAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -358,13 +357,13 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
         }
         memset(mDeviceName, 0, kMaxDeviceNameLength);
         strcpy(mDeviceName, deviceName);
-        SetFlag(mFlags, kFlag_DeviceNameSet, true);
+        mFlags.Set(Flags::kDeviceNameSet);
         ChipLogProgress(DeviceLayer, "Setting device name to : \"%s\"", deviceName);
     }
     else
     {
         mDeviceName[0] = 0;
-        SetFlag(mFlags, kFlag_DeviceNameSet, false);
+        mFlags.Clear(Flags::kDeviceNameSet);
     }
 
     return CHIP_NO_ERROR;
@@ -403,7 +402,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
     case DeviceEventType::kServiceProvisioningChange:
         ChipLogProgress(DeviceLayer, "_OnPlatformEvent kServiceProvisioningChange");
 
-        ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+        mFlags.Clear(Flags::kAdvertisingEnabled);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
         break;
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
@@ -764,7 +763,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
         return chipErr;
     }
 
-    if (!GetFlag(mFlags, kFlag_DeviceNameSet))
+    if (!mFlags.Has(Flags::kDeviceNameSet))
     {
         memset(mDeviceName, 0, kMaxDeviceNameLength);
         snprintf(mDeviceName, kMaxDeviceNameLength, "%s%04u", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, discriminator);
@@ -809,8 +808,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
     scanRsp.aAdStructures = scan_rsp_data;
 
     /**************** Prepare advertising parameters *************************************/
-    advInterval =
-        ((NumConnections() == 0 && !ConfigurationMgr().IsPairedToAccount()) || GetFlag(mFlags, kFlag_FastAdvertisingEnabled))
+    advInterval = ((NumConnections() == 0 && !ConfigurationMgr().IsPairedToAccount()) || mFlags.Has(Flags::kFastAdvertisingEnabled))
         ? (CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL * 3)
         : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL;
 
@@ -839,8 +837,8 @@ exit:
 
 CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
 {
-    SetFlag(mFlags, kFlag_Advertising, true);
-    ClearFlag(mFlags, kFlag_RestartAdvertising);
+    mFlags.Set(Flags::kAdvertising);
+    mFlags.Clear(Flags::kRestartAdvertising);
 
     return ConfigureAdvertisingData();
 }
@@ -849,10 +847,10 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
 {
     ble_err_t err;
 
-    if (GetFlag(mFlags, kFlag_Advertising))
+    if (mFlags.Has(Flags::kAdvertising))
     {
-        ClearFlag(mFlags, kFlag_Advertising);
-        ClearFlag(mFlags, kFlag_RestartAdvertising);
+        mFlags.Clear(Flags::kAdvertising);
+        mFlags.Clear(Flags::kRestartAdvertising);
 
         err = blekw_stop_advertising();
         if (err != BLE_OK)
@@ -869,29 +867,29 @@ void BLEManagerImpl::DriveBLEState(void)
     CHIP_ERROR err = CHIP_NO_ERROR;
 
     // Check if BLE stack is initialized
-    VerifyOrExit(GetFlag(mFlags, kFlag_K32WBLEStackInitialized), /* */);
+    VerifyOrExit(mFlags.Has(Flags::kK32WBLEStackInitialized), /* */);
 
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
     if (ConfigurationMgr().IsFullyProvisioned())
     {
-        ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+        mFlags.Clear(Flags::kAdvertisingEnabled);
         ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
     }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
 
     // Start advertising if needed...
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && GetFlag(mFlags, kFlag_AdvertisingEnabled))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled))
     {
         // Start/re-start advertising if not already started, or if there is a pending change
         // to the advertising configuration.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_RestartAdvertising))
+        if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kRestartAdvertising))
         {
             err = StartAdvertising();
             SuccessOrExit(err);
         }
     }
     // Otherwise, stop advertising if it is enabled.
-    else if (GetFlag(mFlags, kFlag_Advertising))
+    else if (mFlags.Has(Flags::kAdvertising))
     {
         err = StopAdvertising();
         SuccessOrExit(err);
@@ -977,7 +975,7 @@ void BLEManagerImpl::HandleConnectEvent(blekw_msg_t * msg)
     device_id = device_id_loc;
     blekw_start_connection_timeout();
     sInstance.AddConnection(device_id_loc);
-    SetFlag(mFlags, kFlag_RestartAdvertising, true);
+    mFlags.Set(Flags::kRestartAdvertising);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 }
 
@@ -994,7 +992,7 @@ void BLEManagerImpl::HandleConnectionCloseEvent(blekw_msg_t * msg)
         event.CHIPoBLEConnectionError.Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED;
 
         PlatformMgr().PostEvent(&event);
-        SetFlag(mFlags, kFlag_RestartAdvertising, true);
+        mFlags.Set(Flags::kRestartAdvertising);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 }
index 22e632a..c31b9fb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2020 Nest Labs, Inc.
  *    All rights reserved.
  *
@@ -107,15 +107,16 @@ private:
 
     // ===== Private members reserved for use by this class only.
 
-    enum
+    enum class Flags : uint8_t
     {
-        kFlag_AdvertisingEnabled      = 0x0001,
-        kFlag_FastAdvertisingEnabled  = 0x0002,
-        kFlag_Advertising             = 0x0004,
-        kFlag_RestartAdvertising      = 0x0008,
-        kFlag_K32WBLEStackInitialized = 0x0010,
-        kFlag_DeviceNameSet           = 0x0020,
+        kAdvertisingEnabled      = 0x0001,
+        kFastAdvertisingEnabled  = 0x0002,
+        kAdvertising             = 0x0004,
+        kRestartAdvertising      = 0x0008,
+        kK32WBLEStackInitialized = 0x0010,
+        kDeviceNameSet           = 0x0020,
     };
+    BitFlags<BLEManagerImpl::Flags> mFlags;
 
     enum
     {
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index fc317af..8180cba 100644 (file)
@@ -90,3 +90,30 @@ extern "C" void otSysEventSignalPending(void)
     BaseType_t yieldRequired = ThreadStackMgrImpl().SignalThreadActivityPendingFromISR();
     portYIELD_FROM_ISR(yieldRequired);
 }
+
+extern "C" void * pvPortCallocRtos(size_t num, size_t size)
+{
+    size_t totalAllocSize = (size_t)(num * size);
+
+    if (size && totalAllocSize / size != num)
+        return nullptr;
+
+    void * p = pvPortMalloc(totalAllocSize);
+
+    if (p)
+    {
+        memset(p, 0, totalAllocSize);
+    }
+
+    return p;
+}
+
+extern "C" void * otPlatCAlloc(size_t aNum, size_t aSize)
+{
+    return pvPortCallocRtos(aNum, aSize);
+}
+
+extern "C" void otPlatFree(void * aPtr)
+{
+    return vPortFree(aPtr);
+}
index 4afbc9f..a2c9272 100644 (file)
 #if USE_RTOS && defined(FSL_RTOS_FREE_RTOS)
 #include "FreeRTOS.h"
 
-extern void * pvPortCallocRtos(size_t num, size_t size); /*Calloc for HEAP3.*/
-
 #define MBEDTLS_PLATFORM_MEMORY
-#define MBEDTLS_PLATFORM_STD_CALLOC pvPortCallocRtos
-#define MBEDTLS_PLATFORM_STD_FREE vPortFree
 
 #endif /* USE_RTOS*/
 /**************************** KSDK end ****************************************/
index 803d31e..e1a6069 100644 (file)
@@ -69,8 +69,8 @@ CHIP_ERROR BLEManagerImpl::_Init()
     SuccessOrExit(err);
 
     mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
-    mFlags       = (CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART && !mIsCentral) ? kFlag_AdvertisingEnabled : 0;
-    mAppState    = nullptr;
+    mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART && !mIsCentral);
+    mAppState = nullptr;
 
     memset(mDeviceName, 0, sizeof(mDeviceName));
 
@@ -103,9 +103,9 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
 
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+        mFlags.Set(Flags::kAdvertisingEnabled, val);
     }
 
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
@@ -119,9 +119,9 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kFastAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -150,7 +150,7 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
     {
         VerifyOrExit(strlen(deviceName) < kMaxDeviceNameLength, err = CHIP_ERROR_INVALID_ARGUMENT);
         strcpy(mDeviceName, deviceName);
-        SetFlag(mFlags, kFlag_UseCustomDeviceName);
+        mFlags.Set(Flags::kUseCustomDeviceName);
     }
     else
     {
@@ -158,7 +158,7 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
         SuccessOrExit(err = ConfigurationMgr().GetSetupDiscriminator(discriminator));
         snprintf(mDeviceName, sizeof(mDeviceName), "%s%04u", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, discriminator);
         mDeviceName[kMaxDeviceNameLength] = 0;
-        ClearFlag(mFlags, kFlag_UseCustomDeviceName);
+        mFlags.Clear(Flags::kUseCustomDeviceName);
     }
 
 exit:
@@ -240,13 +240,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
 
         // Force the advertising configuration to be refreshed to reflect new provisioning state.
-        ClearFlag(mFlags, kFlag_AdvertisingConfigured);
+        mFlags.Clear(Flags::kAdvertisingConfigured);
 
         DriveBLEState();
         break;
@@ -284,38 +284,35 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv
         break;
     case DeviceEventType::kPlatformLinuxBLEPeripheralAdvConfiguredComplete:
         VerifyOrExit(apEvent->Platform.BLEPeripheralAdvConfiguredComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE);
-        SetFlag(sInstance.mFlags, kFlag_AdvertisingConfigured);
-        ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress);
+        sInstance.mFlags.Set(Flags::kAdvertisingConfigured).Clear(Flags::kControlOpInProgress);
         controlOpComplete = true;
         ChipLogProgress(DeviceLayer, "CHIPoBLE advertising config complete");
         break;
     case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete:
         VerifyOrExit(apEvent->Platform.BLEPeripheralAdvStartComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE);
-        ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress);
-        ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded);
+        sInstance.mFlags.Clear(Flags::kControlOpInProgress).Clear(Flags::kAdvertisingRefreshNeeded);
 
-        if (!GetFlag(sInstance.mFlags, kFlag_Advertising))
+        if (!sInstance.mFlags.Has(Flags::kAdvertising))
         {
-            SetFlag(sInstance.mFlags, kFlag_Advertising);
+            sInstance.mFlags.Set(Flags::kAdvertising);
         }
 
         break;
     case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStopComplete:
         VerifyOrExit(apEvent->Platform.BLEPeripheralAdvStopComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE);
 
-        ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress);
-        ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded);
+        sInstance.mFlags.Clear(Flags::kControlOpInProgress).Clear(Flags::kAdvertisingRefreshNeeded);
 
         // Transition to the not Advertising state...
-        if (GetFlag(sInstance.mFlags, kFlag_Advertising))
+        if (sInstance.mFlags.Has(Flags::kAdvertising))
         {
-            ClearFlag(sInstance.mFlags, kFlag_Advertising);
+            sInstance.mFlags.Clear(Flags::kAdvertising);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");
         }
         break;
     case DeviceEventType::kPlatformLinuxBLEPeripheralRegisterAppComplete:
         VerifyOrExit(apEvent->Platform.BLEPeripheralRegisterAppComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE);
-        SetFlag(mFlags, kFlag_AppRegistered);
+        mFlags.Set(Flags::kAppRegistered);
         controlOpComplete = true;
         break;
     default:
@@ -327,12 +324,12 @@ exit:
     {
         ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err));
         mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled;
-        ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress);
+        sInstance.mFlags.Clear(Flags::kControlOpInProgress);
     }
 
     if (controlOpComplete)
     {
-        ClearFlag(mFlags, kFlag_ControlOpInProgress);
+        mFlags.Clear(Flags::kControlOpInProgress);
         DriveBLEState();
     }
 }
@@ -542,16 +539,16 @@ void BLEManagerImpl::DriveBLEState()
     CHIP_ERROR err = CHIP_NO_ERROR;
 
     // Perform any initialization actions that must occur after the Chip task is running.
-    if (!GetFlag(mFlags, kFlag_AsyncInitCompleted))
+    if (!mFlags.Has(Flags::kAsyncInitCompleted))
     {
-        SetFlag(mFlags, kFlag_AsyncInitCompleted);
+        mFlags.Set(Flags::kAsyncInitCompleted);
 
         // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled,
         // disable CHIPoBLE advertising if the device is fully provisioned.
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
@@ -559,35 +556,35 @@ void BLEManagerImpl::DriveBLEState()
     }
 
     // If there's already a control operation in progress, wait until it completes.
-    VerifyOrExit(!GetFlag(mFlags, kFlag_ControlOpInProgress), /* */);
+    VerifyOrExit(!mFlags.Has(Flags::kControlOpInProgress), /* */);
 
     // Initializes the Bluez BLE layer if needed.
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_BluezBLELayerInitialized))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !mFlags.Has(Flags::kBluezBLELayerInitialized))
     {
         err = InitBluezBleLayer(mIsCentral, nullptr, mBLEAdvConfig, mpEndpoint);
         SuccessOrExit(err);
-        SetFlag(mFlags, kFlag_BluezBLELayerInitialized);
+        mFlags.Set(Flags::kBluezBLELayerInitialized);
     }
 
     // Register the CHIPoBLE application with the Bluez BLE layer if needed.
-    if (!mIsCentral && mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_AppRegistered))
+    if (!mIsCentral && mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !mFlags.Has(Flags::kAppRegistered))
     {
         err = BluezGattsAppRegister(mpEndpoint);
-        SetFlag(mFlags, kFlag_ControlOpInProgress);
+        mFlags.Set(Flags::kControlOpInProgress);
         ExitNow();
     }
 
     // If the application has enabled CHIPoBLE and BLE advertising...
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && GetFlag(mFlags, kFlag_AdvertisingEnabled))
+    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled))
     {
         // Start/re-start advertising if not already advertising, or if the advertising state of the
         // Bluez BLE layer needs to be refreshed.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_AdvertisingRefreshNeeded))
+        if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kAdvertisingRefreshNeeded))
         {
             // Configure advertising data if it hasn't been done yet.  This is an asynchronous step which
             // must complete before advertising can be started.  When that happens, this method will
             // be called again, and execution will proceed to the code below.
-            if (!GetFlag(mFlags, kFlag_AdvertisingConfigured))
+            if (!mFlags.Has(Flags::kAdvertisingConfigured))
             {
                 err = BluezAdvertisementSetup(mpEndpoint);
                 ExitNow();
@@ -597,7 +594,7 @@ void BLEManagerImpl::DriveBLEState()
             err = StartBLEAdvertising();
             SuccessOrExit(err);
 
-            SetFlag(sInstance.mFlags, kFlag_Advertising);
+            sInstance.mFlags.Set(Flags::kAdvertising);
             ExitNow();
         }
     }
@@ -605,11 +602,11 @@ void BLEManagerImpl::DriveBLEState()
     // Otherwise stop advertising if needed...
     else
     {
-        if (GetFlag(mFlags, kFlag_Advertising))
+        if (mFlags.Has(Flags::kAdvertising))
         {
             err = StopBLEAdvertising();
             SuccessOrExit(err);
-            SetFlag(mFlags, kFlag_ControlOpInProgress);
+            mFlags.Set(Flags::kControlOpInProgress);
 
             ExitNow();
         }
index 318202f..7e9f567 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -163,18 +163,18 @@ private:
     static BLEManagerImpl sInstance;
 
     // ===== Private members reserved for use by this class only.
-    enum
+    enum class Flags : uint16_t
     {
-        kFlag_AsyncInitCompleted       = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
-        kFlag_BluezBLELayerInitialized = 0x0002, /**< The Bluez layer has been initialized. */
-        kFlag_AppRegistered            = 0x0004, /**< The CHIPoBLE application has been registered with the Bluez layer. */
-        kFlag_AdvertisingConfigured    = 0x0008, /**< CHIPoBLE advertising has been configured in the Bluez layer. */
-        kFlag_Advertising              = 0x0010, /**< The system is currently CHIPoBLE advertising. */
-        kFlag_ControlOpInProgress      = 0x0020, /**< An async control operation has been issued to the ESP BLE layer. */
-        kFlag_AdvertisingEnabled       = 0x0040, /**< The application has enabled CHIPoBLE advertising. */
-        kFlag_FastAdvertisingEnabled   = 0x0080, /**< The application has enabled fast advertising. */
-        kFlag_UseCustomDeviceName      = 0x0100, /**< The application has configured a custom BLE device name. */
-        kFlag_AdvertisingRefreshNeeded = 0x0200, /**< The advertising configuration/state in BLE layer needs to be updated. */
+        kAsyncInitCompleted       = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
+        kBluezBLELayerInitialized = 0x0002, /**< The Bluez layer has been initialized. */
+        kAppRegistered            = 0x0004, /**< The CHIPoBLE application has been registered with the Bluez layer. */
+        kAdvertisingConfigured    = 0x0008, /**< CHIPoBLE advertising has been configured in the Bluez layer. */
+        kAdvertising              = 0x0010, /**< The system is currently CHIPoBLE advertising. */
+        kControlOpInProgress      = 0x0020, /**< An async control operation has been issued to the ESP BLE layer. */
+        kAdvertisingEnabled       = 0x0040, /**< The application has enabled CHIPoBLE advertising. */
+        kFastAdvertisingEnabled   = 0x0080, /**< The application has enabled fast advertising. */
+        kUseCustomDeviceName      = 0x0100, /**< The application has configured a custom BLE device name. */
+        kAdvertisingRefreshNeeded = 0x0200, /**< The advertising configuration/state in BLE layer needs to be updated. */
     };
 
     enum
@@ -196,7 +196,7 @@ private:
     CHIPoBLEServiceMode mServiceMode;
     BLEAdvConfig mBLEAdvConfig;
     BLEScanConfig mBLEScanConfig;
-    uint16_t mFlags;
+    BitFlags<Flags> mFlags;
     char mDeviceName[kMaxDeviceNameLength + 1];
     bool mIsCentral            = false;
     BluezEndpoint * mpEndpoint = nullptr;
@@ -237,17 +237,17 @@ inline BLEManager::CHIPoBLEServiceMode BLEManagerImpl::_GetCHIPoBLEServiceMode()
 
 inline bool BLEManagerImpl::_IsAdvertisingEnabled()
 {
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
+    return mFlags.Has(Flags::kAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsFastAdvertisingEnabled()
 {
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
+    return mFlags.Has(Flags::kFastAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsAdvertising()
 {
-    return GetFlag(mFlags, kFlag_Advertising);
+    return mFlags.Has(Flags::kAdvertising);
 }
 
 } // namespace Internal
diff --git a/src/platform/Linux/CHIPBluezHelper.cpp b/src/platform/Linux/CHIPBluezHelper.cpp
deleted file mode 100644 (file)
index 8d786e7..0000000
+++ /dev/null
@@ -1,1772 +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.
- */
-
-/*
- *  Copyright (c) 2016-2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- *    @file
- *          Provides Bluez dbus implementatioon for BLE
- */
-
-#include <ble/BleUUID.h>
-#include <ble/CHIPBleServiceData.h>
-#include <platform/CHIPDeviceLayer.h>
-
-#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
-#include <errno.h>
-#include <gio/gunixfdlist.h>
-#include <limits>
-#include <stdarg.h>
-#include <strings.h>
-#include <unistd.h>
-#include <utility>
-
-#include "CHIPBluezHelper.h"
-#include <support/CodeUtils.h>
-
-using namespace ::nl;
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-static int sBluezFD[2];
-static GMainLoop * sBluezMainLoop = nullptr;
-static pthread_t sBluezThread;
-static BluezConnection * GetBluezConnectionViaDevice(BluezEndpoint * apEndpoint);
-
-static gboolean BluezAdvertisingRelease(BluezLEAdvertisement1 * aAdv, GDBusMethodInvocation * aInvocation, gpointer apClosure)
-{
-    bool isSuccess           = false;
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(aAdv != nullptr, ChipLogError(DeviceLayer, "BluezLEAdvertisement1 is NULL in %s", __func__));
-    ChipLogDetail(DeviceLayer, "Release adv object in %s", __func__);
-
-    g_dbus_object_manager_server_unexport(endpoint->mpRoot, endpoint->mpAdvPath);
-    endpoint->mIsAdvertising = false;
-    isSuccess                = true;
-exit:
-
-    return isSuccess ? TRUE : FALSE;
-}
-
-static BluezLEAdvertisement1 * BluezAdvertisingCreate(BluezEndpoint * apEndpoint)
-{
-    BluezLEAdvertisement1 * adv = nullptr;
-    BluezObjectSkeleton * object;
-    GVariant * serviceData;
-    GVariant * serviceUUID;
-    gchar * localName;
-    GVariantBuilder serviceDataBuilder;
-    GVariantBuilder serviceUUIDsBuilder;
-    char * debugStr;
-
-    VerifyOrExit(apEndpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    if (apEndpoint->mpAdvPath == nullptr)
-        apEndpoint->mpAdvPath = g_strdup_printf("%s/advertising", apEndpoint->mpRootPath);
-
-    ChipLogDetail(DeviceLayer, "Create adv object at %s", apEndpoint->mpAdvPath);
-    object = bluez_object_skeleton_new(apEndpoint->mpAdvPath);
-
-    adv = bluez_leadvertisement1_skeleton_new();
-
-    g_variant_builder_init(&serviceDataBuilder, G_VARIANT_TYPE("a{sv}"));
-    g_variant_builder_init(&serviceUUIDsBuilder, G_VARIANT_TYPE("as"));
-
-    g_variant_builder_add(&serviceDataBuilder, "{sv}", apEndpoint->mpAdvertisingUUID,
-                          g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, &apEndpoint->mDeviceIdInfo,
-                                                    sizeof(apEndpoint->mDeviceIdInfo), sizeof(uint8_t)));
-    g_variant_builder_add(&serviceUUIDsBuilder, "s", apEndpoint->mpAdvertisingUUID);
-
-    if (apEndpoint->mpAdapterName != nullptr)
-        localName = g_strdup_printf("%s", apEndpoint->mpAdapterName);
-    else
-        localName = g_strdup_printf("%s%04x", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, getpid() & 0xffff);
-
-    serviceData = g_variant_builder_end(&serviceDataBuilder);
-    serviceUUID = g_variant_builder_end(&serviceUUIDsBuilder);
-
-    debugStr = g_variant_print(serviceData, TRUE);
-    ChipLogDetail(DeviceLayer, "SET service data to %s", debugStr);
-    g_free(debugStr);
-
-    bluez_leadvertisement1_set_type_(adv, (apEndpoint->mType & BLUEZ_ADV_TYPE_CONNECTABLE) ? "peripheral" : "broadcast");
-    // empty manufacturer data
-    // empty solicit UUIDs
-    bluez_leadvertisement1_set_service_data(adv, serviceData);
-    // empty data
-
-    bluez_leadvertisement1_set_discoverable(adv, (apEndpoint->mType & BLUEZ_ADV_TYPE_SCANNABLE) ? TRUE : FALSE);
-
-    // advertising name corresponding to the PID and object path, for debug purposes
-    bluez_leadvertisement1_set_local_name(adv, localName);
-    bluez_leadvertisement1_set_service_uuids(adv, serviceUUID);
-
-    // 0xffff means no appearance
-    bluez_leadvertisement1_set_appearance(adv, 0xffff);
-
-    bluez_leadvertisement1_set_duration(adv, apEndpoint->mDuration);
-    // empty duration, we don't have a clear notion what it would mean to timeslice between toble and anyone else
-    bluez_leadvertisement1_set_timeout(adv, 0);
-    // empty secondary channel for now
-
-    bluez_object_skeleton_set_leadvertisement1(object, adv);
-    g_signal_connect(adv, "handle-release", G_CALLBACK(BluezAdvertisingRelease), apEndpoint);
-
-    g_dbus_object_manager_server_export(apEndpoint->mpRoot, G_DBUS_OBJECT_SKELETON(object));
-    g_object_unref(object);
-
-    BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(true, nullptr);
-
-exit:
-    return adv;
-}
-
-static void BluezAdvStartDone(GObject * aObject, GAsyncResult * aResult, gpointer apClosure)
-{
-    BluezLEAdvertisingManager1 * advMgr = BLUEZ_LEADVERTISING_MANAGER1(aObject);
-    GError * error                      = nullptr;
-    BluezEndpoint * endpoint            = static_cast<BluezEndpoint *>(apClosure);
-    gboolean success                    = FALSE;
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    success = bluez_leadvertising_manager1_call_register_advertisement_finish(advMgr, aResult, &error);
-    if (success == FALSE)
-    {
-        g_dbus_object_manager_server_unexport(endpoint->mpRoot, endpoint->mpAdvPath);
-    }
-    VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: RegisterAdvertisement : %s", error->message));
-
-    endpoint->mIsAdvertising = true;
-
-    ChipLogDetail(DeviceLayer, "RegisterAdvertisement complete");
-
-exit:
-    BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(success == TRUE, nullptr);
-    if (error != nullptr)
-        g_error_free(error);
-}
-
-static void BluezAdvStopDone(GObject * aObject, GAsyncResult * aResult, gpointer apClosure)
-{
-    BluezLEAdvertisingManager1 * advMgr = BLUEZ_LEADVERTISING_MANAGER1(aObject);
-    BluezEndpoint * endpoint            = static_cast<BluezEndpoint *>(apClosure);
-    GError * error                      = nullptr;
-    gboolean success                    = FALSE;
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    success = bluez_leadvertising_manager1_call_unregister_advertisement_finish(advMgr, aResult, &error);
-
-    if (success == FALSE)
-    {
-        g_dbus_object_manager_server_unexport(endpoint->mpRoot, endpoint->mpAdvPath);
-    }
-    else
-    {
-        endpoint->mIsAdvertising = false;
-    }
-
-    VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: UnregisterAdvertisement : %s", error->message));
-
-    ChipLogDetail(DeviceLayer, "UnregisterAdvertisement complete");
-
-exit:
-    BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(success == TRUE, nullptr);
-    if (error != nullptr)
-        g_error_free(error);
-}
-
-static gboolean BluezAdvSetup(void * apClosure)
-{
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    BluezLEAdvertisement1 * adv;
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(endpoint->mIsAdvertising == FALSE, ChipLogError(DeviceLayer, "FAIL: Advertising already enabled in %s", __func__));
-    VerifyOrExit(endpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__));
-
-    adv = BluezAdvertisingCreate(endpoint);
-    VerifyOrExit(adv != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adv in %s", __func__));
-
-exit:
-    return G_SOURCE_REMOVE;
-}
-
-static gboolean BluezAdvStart(void * apEndpoint)
-{
-    GDBusObject * adapter;
-    BluezLEAdvertisingManager1 * advMgr = nullptr;
-    GVariantBuilder optionsBuilder;
-    GVariant * options;
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(!endpoint->mIsAdvertising,
-                 ChipLogError(DeviceLayer, "FAIL: Advertising has already been enabled in %s", __func__));
-    VerifyOrExit(endpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__));
-
-    adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(endpoint->mpAdapter));
-    VerifyOrExit(adapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapter in %s", __func__));
-
-    advMgr = bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapter));
-    VerifyOrExit(advMgr != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL advMgr in %s", __func__));
-
-    g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE("a{sv}"));
-    options = g_variant_builder_end(&optionsBuilder);
-
-    bluez_leadvertising_manager1_call_register_advertisement(advMgr, endpoint->mpAdvPath, options, nullptr, BluezAdvStartDone,
-                                                             apEndpoint);
-
-exit:
-    return G_SOURCE_REMOVE;
-}
-
-static gboolean BluezAdvStop(void * apEndpoint)
-{
-    GDBusObject * adapter;
-    BluezEndpoint * endpoint            = static_cast<BluezEndpoint *>(apEndpoint);
-    BluezLEAdvertisingManager1 * advMgr = nullptr;
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(endpoint->mIsAdvertising,
-                 ChipLogError(DeviceLayer, "FAIL: Advertising has already been disabled in %s", __func__));
-    VerifyOrExit(endpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__));
-
-    adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(endpoint->mpAdapter));
-    VerifyOrExit(adapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapter in %s", __func__));
-
-    advMgr = bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapter));
-    VerifyOrExit(advMgr != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL advMgr in %s", __func__));
-
-    bluez_leadvertising_manager1_call_unregister_advertisement(advMgr, endpoint->mpAdvPath, nullptr, BluezAdvStopDone, apEndpoint);
-
-exit:
-    return G_SOURCE_REMOVE;
-}
-
-static gboolean BluezCharacteristicReadValue(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                             GVariant * aOptions)
-{
-    GVariant * val;
-    ChipLogDetail(DeviceLayer, "Received BluezCharacteristicReadValue");
-    val = bluez_gatt_characteristic1_get_value(aChar);
-    bluez_gatt_characteristic1_complete_read_value(aChar, aInvocation, val);
-    return TRUE;
-}
-
-#if CHIP_BLUEZ_CHAR_WRITE_VALUE
-static gboolean BluezCharacteristicWriteValue(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                              GVariant * aValue, GVariant * aOptions, gpointer apEndpoint)
-{
-    const uint8_t * tmpBuf;
-    uint8_t * buf;
-    size_t len;
-    bool isSuccess         = false;
-    BluezConnection * conn = NULL;
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-    VerifyOrExit(endpoint != NULL, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    VerifyOrExit(aValue != NULL, ChipLogError(DeviceLayer, "aValue is NULL in %s", __func__));
-
-    conn = GetBluezConnectionViaDevice(endpoint);
-    VerifyOrExit(conn != NULL,
-                 g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No CHIP Bluez connection"));
-
-    bluez_gatt_characteristic1_set_value(aChar, g_variant_ref(aValue));
-
-    tmpBuf = (uint8_t *) (g_variant_get_fixed_array(aValue, &len, sizeof(uint8_t)));
-    buf    = (uint8_t *) (g_memdup(tmpBuf, len));
-
-    BLEManagerImpl::HandleRXCharWrite(conn, buf, len);
-    bluez_gatt_characteristic1_complete_write_value(aChar, aInvocation);
-    isSuccess = true;
-
-exit:
-    return isSuccess ? TRUE : FALSE;
-}
-#endif
-
-static gboolean BluezCharacteristicWriteValueError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                                   GVariant * aValue, GVariant * aOptions, gpointer apClosure)
-{
-    ChipLogDetail(DeviceLayer, "BluezCharacteristicWriteValueError");
-    g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported",
-                                               "Write for characteristic is unsupported");
-    return TRUE;
-}
-
-static gboolean BluezCharacteristicWriteFD(GIOChannel * aChannel, GIOCondition aCond, gpointer apEndpoint)
-{
-    GVariant * newVal;
-    gchar * buf;
-    ssize_t len;
-    int fd;
-    bool isSuccess = false;
-
-    BluezConnection * conn = static_cast<BluezConnection *>(apEndpoint);
-
-    VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "No CHIP Bluez connection in %s", __func__));
-
-    VerifyOrExit(!(aCond & G_IO_HUP), ChipLogError(DeviceLayer, "INFO: socket disconnected in %s", __func__));
-    VerifyOrExit(!(aCond & (G_IO_ERR | G_IO_NVAL)), ChipLogError(DeviceLayer, "INFO: socket error in %s", __func__));
-    VerifyOrExit(aCond == G_IO_IN, ChipLogError(DeviceLayer, "FAIL: error in %s", __func__));
-
-    ChipLogDetail(DeviceLayer, "c1 %s mtu, %d", __func__, conn->mMtu);
-
-    buf = static_cast<gchar *>(g_malloc(conn->mMtu));
-    fd  = g_io_channel_unix_get_fd(aChannel);
-
-    len = read(fd, buf, conn->mMtu);
-
-    VerifyOrExit(len > 0, ChipLogError(DeviceLayer, "FAIL: short read in %s (%d)", __func__, len));
-
-    // Casting len to size_t is safe, since we ensured that it's not negative.
-    newVal = g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, buf, static_cast<size_t>(len), sizeof(uint8_t));
-
-    bluez_gatt_characteristic1_set_value(conn->mpC1, newVal);
-    BLEManagerImpl::HandleRXCharWrite(conn, reinterpret_cast<uint8_t *>(buf), static_cast<size_t>(len));
-    isSuccess = true;
-
-exit:
-    return isSuccess ? TRUE : FALSE;
-}
-
-static void Bluez_gatt_characteristic1_complete_acquire_write_with_fd(GDBusMethodInvocation * invocation, int fd, guint16 mtu)
-{
-    GUnixFDList * fd_list = g_unix_fd_list_new();
-    int index;
-
-    index = g_unix_fd_list_append(fd_list, fd, nullptr);
-
-    g_dbus_method_invocation_return_value_with_unix_fd_list(invocation, g_variant_new("(@hq)", g_variant_new_handle(index), mtu),
-                                                            fd_list);
-}
-
-static gboolean bluezCharacteristicDestroyFD(GIOChannel * aChannel, GIOCondition aCond, gpointer apClosure)
-{
-    return G_SOURCE_REMOVE;
-}
-
-static gboolean BluezCharacteristicAcquireWrite(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                                GVariant * aOptions, gpointer apEndpoint)
-{
-    int fds[2] = { -1, -1 };
-    GIOChannel * channel;
-    char * errStr;
-    GVariantDict options;
-    bool isSuccess         = false;
-    BluezConnection * conn = nullptr;
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    conn = GetBluezConnectionViaDevice(endpoint);
-    VerifyOrExit(conn != nullptr,
-                 g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection"));
-
-    ChipLogDetail(DeviceLayer, "BluezCharacteristicAcquireWrite is called, conn: %p", conn);
-
-    if (socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, fds) < 0)
-    {
-        errStr = strerror(errno);
-        ChipLogError(DeviceLayer, "FAIL: socketpair: %s in %s", errStr, __func__);
-        g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "FD creation failed");
-        SuccessOrExit(false);
-    }
-
-    g_variant_dict_init(&options, aOptions);
-    if (g_variant_dict_contains(&options, "mtu") == TRUE)
-    {
-        GVariant * v = g_variant_dict_lookup_value(&options, "mtu", G_VARIANT_TYPE_UINT16);
-        conn->mMtu   = g_variant_get_uint16(v);
-    }
-    else
-    {
-        ChipLogError(DeviceLayer, "FAIL: no MTU in options in %s", __func__);
-        g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.InvalidArguments", "MTU negotiation failed");
-        SuccessOrExit(false);
-    }
-
-    channel = g_io_channel_unix_new(fds[0]);
-    g_io_channel_set_encoding(channel, nullptr, nullptr);
-    g_io_channel_set_close_on_unref(channel, TRUE);
-    g_io_channel_set_buffered(channel, FALSE);
-
-    conn->mC1Channel.mpChannel = channel;
-    conn->mC1Channel.mWatch    = g_io_add_watch(channel, static_cast<GIOCondition>(G_IO_HUP | G_IO_IN | G_IO_ERR | G_IO_NVAL),
-                                             BluezCharacteristicWriteFD, conn);
-
-    bluez_gatt_characteristic1_set_write_acquired(aChar, TRUE);
-
-    Bluez_gatt_characteristic1_complete_acquire_write_with_fd(aInvocation, fds[1], conn->mMtu);
-    close(fds[1]);
-    isSuccess = true;
-
-exit:
-    return isSuccess ? TRUE : FALSE;
-}
-
-static gboolean BluezCharacteristicAcquireWriteError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                                     GVariant * aOptions)
-{
-    ChipLogDetail(DeviceLayer, "BluezCharacteristicAcquireWriteError is called");
-    g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported",
-                                               "AcquireWrite for characteristic is unsupported");
-    return TRUE;
-}
-
-static gboolean BluezCharacteristicAcquireNotify(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                                 GVariant * aOptions, gpointer apEndpoint)
-{
-    int fds[2] = { -1, -1 };
-    GIOChannel * channel;
-    char * errStr;
-    GVariantDict options;
-    BluezConnection * conn = nullptr;
-    bool isSuccess         = false;
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    conn = GetBluezConnectionViaDevice(endpoint);
-    VerifyOrExit(conn != nullptr,
-                 g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection"));
-
-    g_variant_dict_init(&options, aOptions);
-    if ((g_variant_dict_contains(&options, "mtu") == TRUE))
-    {
-        GVariant * v = g_variant_dict_lookup_value(&options, "mtu", G_VARIANT_TYPE_UINT16);
-        conn->mMtu   = g_variant_get_uint16(v);
-    }
-
-    if (bluez_gatt_characteristic1_get_notifying(aChar))
-    {
-        g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotPermitted", "Already notifying");
-    }
-    if (socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, fds) < 0)
-    {
-        errStr = strerror(errno);
-        ChipLogError(DeviceLayer, "FAIL: socketpair: %s in %s", errStr, __func__);
-        g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "FD creation failed");
-        SuccessOrExit(false);
-    }
-    channel = g_io_channel_unix_new(fds[0]);
-    g_io_channel_set_encoding(channel, nullptr, nullptr);
-    g_io_channel_set_close_on_unref(channel, TRUE);
-    g_io_channel_set_buffered(channel, FALSE);
-    conn->mC2Channel.mpChannel = channel;
-    conn->mC2Channel.mWatch =
-        g_io_add_watch_full(channel, G_PRIORITY_DEFAULT_IDLE, static_cast<GIOCondition>(G_IO_HUP | G_IO_ERR | G_IO_NVAL),
-                            bluezCharacteristicDestroyFD, conn, nullptr);
-
-    bluez_gatt_characteristic1_set_notify_acquired(aChar, TRUE);
-
-    // same reply as for AcquireWrite
-    Bluez_gatt_characteristic1_complete_acquire_write_with_fd(aInvocation, fds[1], conn->mMtu);
-    close(fds[1]);
-
-    conn->mIsNotify = true;
-    BLEManagerImpl::HandleTXCharCCCDWrite(conn);
-    isSuccess = true;
-
-exit:
-    return isSuccess ? TRUE : FALSE;
-}
-
-static gboolean BluezCharacteristicAcquireNotifyError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                                      GVariant * aOptions)
-{
-    ChipLogDetail(DeviceLayer, "TRACE: AcquireNotify is called");
-    g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported",
-                                               "AcquireNotify for characteristic is unsupported");
-    return TRUE;
-}
-
-static gboolean BluezCharacteristicStartNotify(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                               gpointer apEndpoint)
-{
-    bool isSuccess         = false;
-    BluezConnection * conn = nullptr;
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    conn = GetBluezConnectionViaDevice(endpoint);
-    VerifyOrExit(conn != nullptr,
-                 g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection"));
-
-    if (bluez_gatt_characteristic1_get_notifying(aChar) == TRUE)
-    {
-        g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "Characteristic is already subscribed");
-    }
-    else
-    {
-        bluez_gatt_characteristic1_complete_start_notify(aChar, aInvocation);
-        bluez_gatt_characteristic1_set_notifying(aChar, TRUE);
-        conn->mIsNotify = true;
-        BLEManagerImpl::HandleTXCharCCCDWrite(conn);
-    }
-    isSuccess = true;
-
-exit:
-    return isSuccess ? TRUE : FALSE;
-}
-
-static gboolean BluezCharacteristicStartNotifyError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation)
-{
-    g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported",
-                                               "Subscribing to characteristic is unsupported");
-    return TRUE;
-}
-
-static gboolean BluezCharacteristicStopNotify(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                              gpointer apEndpoint)
-{
-    bool isSuccess         = false;
-    BluezConnection * conn = nullptr;
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    conn = GetBluezConnectionViaDevice(endpoint);
-    VerifyOrExit(conn != nullptr,
-                 g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection"));
-
-    if (bluez_gatt_characteristic1_get_notifying(aChar) == FALSE)
-    {
-        g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "Characteristic is already unsubscribed");
-    }
-    else
-    {
-        bluez_gatt_characteristic1_complete_start_notify(aChar, aInvocation);
-        bluez_gatt_characteristic1_set_notifying(aChar, FALSE);
-    }
-    conn->mIsNotify = false;
-
-    isSuccess = true;
-
-exit:
-    return isSuccess ? TRUE : FALSE;
-}
-
-static gboolean BluezCharacteristicConfirm(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation,
-                                           gpointer apClosure)
-{
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    BluezConnection * conn   = GetBluezConnectionViaDevice(endpoint);
-
-    ChipLogDetail(Ble, "Indication confirmation, %p", conn);
-    BLEManagerImpl::HandleTXComplete(conn);
-
-    return TRUE;
-}
-
-static gboolean BluezCharacteristicStopNotifyError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation)
-{
-    g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed",
-                                               "Unsubscribing from characteristic is unsupported");
-    return TRUE;
-}
-
-static gboolean BluezCharacteristicConfirmError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation)
-{
-    g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "Confirm from characteristic is unsupported");
-    return TRUE;
-}
-
-static gboolean BluezIsDeviceOnAdapter(BluezDevice1 * aDevice, BluezAdapter1 * aAdapter)
-{
-    return strcmp(bluez_device1_get_adapter(aDevice), g_dbus_proxy_get_object_path(G_DBUS_PROXY(aAdapter))) == 0 ? TRUE : FALSE;
-}
-
-static gboolean BluezIsServiceOnDevice(BluezGattService1 * aService, BluezDevice1 * aDevice)
-{
-    return strcmp(bluez_gatt_service1_get_device(aService), g_dbus_proxy_get_object_path(G_DBUS_PROXY(aDevice))) == 0 ? TRUE
-                                                                                                                      : FALSE;
-}
-
-static gboolean BluezIsCharOnService(BluezGattCharacteristic1 * aChar, BluezGattService1 * aService)
-{
-    ChipLogDetail(DeviceLayer, "Char1 %s", bluez_gatt_characteristic1_get_service(aChar));
-    ChipLogDetail(DeviceLayer, "Char1 %s", g_dbus_proxy_get_object_path(G_DBUS_PROXY(aService)));
-    return strcmp(bluez_gatt_characteristic1_get_service(aChar), g_dbus_proxy_get_object_path(G_DBUS_PROXY(aService))) == 0 ? TRUE
-                                                                                                                            : FALSE;
-}
-
-static void BluezConnectionInit(BluezConnection * apConn)
-{
-    // populate the service and the characteristics
-    GList * objects = nullptr;
-    GList * l;
-    BluezEndpoint * endpoint = nullptr;
-
-    VerifyOrExit(apConn != nullptr, ChipLogError(DeviceLayer, "Bluez connection is NULL in %s", __func__));
-
-    endpoint = apConn->mpEndpoint;
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    if (!endpoint->mIsCentral)
-    {
-        apConn->mpService = BLUEZ_GATT_SERVICE1(g_object_ref(apConn->mpEndpoint->mpService));
-        apConn->mpC1      = BLUEZ_GATT_CHARACTERISTIC1(g_object_ref(endpoint->mpC1));
-        apConn->mpC2      = BLUEZ_GATT_CHARACTERISTIC1(g_object_ref(endpoint->mpC2));
-    }
-    else
-    {
-        objects = g_dbus_object_manager_get_objects(endpoint->mpObjMgr);
-
-        for (l = objects; l != nullptr; l = l->next)
-        {
-            BluezObject * object        = BLUEZ_OBJECT(l->data);
-            BluezGattService1 * service = bluez_object_get_gatt_service1(object);
-
-            if (service != nullptr)
-            {
-                if ((BluezIsServiceOnDevice(service, apConn->mpDevice)) == TRUE &&
-                    (strcmp(bluez_gatt_service1_get_uuid(service), CHIP_BLE_UUID_SERVICE_STRING) == 0))
-                {
-                    apConn->mpService = service;
-                    break;
-                }
-                g_object_unref(service);
-            }
-        }
-
-        VerifyOrExit(apConn->mpService != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL service in %s", __func__));
-
-        for (l = objects; l != nullptr; l = l->next)
-        {
-            BluezObject * object             = BLUEZ_OBJECT(l->data);
-            BluezGattCharacteristic1 * char1 = bluez_object_get_gatt_characteristic1(object);
-
-            if (char1 != nullptr)
-            {
-                if ((BluezIsCharOnService(char1, apConn->mpService) == TRUE) &&
-                    (strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C1_STRING) == 0))
-                {
-                    apConn->mpC1 = char1;
-                }
-                else if ((BluezIsCharOnService(char1, apConn->mpService) == TRUE) &&
-                         (strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C2_STRING) == 0))
-                {
-                    apConn->mpC2 = char1;
-                }
-                else
-                {
-                    g_object_unref(char1);
-                }
-                if ((apConn->mpC1 != nullptr) && (apConn->mpC2 != nullptr))
-                {
-                    break;
-                }
-            }
-        }
-
-        VerifyOrExit(apConn->mpC1 != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL C1 in %s", __func__));
-        VerifyOrExit(apConn->mpC2 != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL C2 in %s", __func__));
-    }
-
-exit:
-    if (objects != nullptr)
-        g_list_free_full(objects, g_object_unref);
-}
-
-static gboolean BluezConnectionInitIdle(gpointer user_data)
-{
-    BluezConnection * conn = static_cast<BluezConnection *>(user_data);
-
-    ChipLogDetail(DeviceLayer, "%s", __func__);
-
-    BluezConnectionInit(conn);
-
-    return FALSE;
-}
-
-static void BluezOTConnectionDestroy(BluezConnection * aConn)
-{
-    if (aConn)
-    {
-        if (aConn->mpDevice)
-            g_object_unref(aConn->mpDevice);
-        if (aConn->mpService)
-            g_object_unref(aConn->mpService);
-        if (aConn->mpC1)
-            g_object_unref(aConn->mpC1);
-        if (aConn->mpC2)
-            g_object_unref(aConn->mpC2);
-        if (aConn->mpPeerAddress)
-            g_free(aConn->mpPeerAddress);
-        if (aConn->mC1Channel.mWatch > 0)
-            g_source_remove(aConn->mC1Channel.mWatch);
-        if (aConn->mC1Channel.mpChannel)
-            g_io_channel_unref(aConn->mC1Channel.mpChannel);
-        if (aConn->mC2Channel.mWatch > 0)
-            g_source_remove(aConn->mC2Channel.mWatch);
-        if (aConn->mC2Channel.mpChannel)
-            g_io_channel_unref(aConn->mC2Channel.mpChannel);
-
-        g_free(aConn);
-    }
-}
-
-static BluezGattCharacteristic1 * BluezCharacteristicCreate(BluezGattService1 * aService, const char * aCharName,
-                                                            const char * aUUID, GDBusObjectManagerServer * aRoot)
-{
-    char * servicePath = g_strdup(g_dbus_object_get_object_path(g_dbus_interface_get_object(G_DBUS_INTERFACE(aService))));
-    char * charPath    = g_strdup_printf("%s/%s", servicePath, aCharName);
-    BluezObjectSkeleton * object;
-    BluezGattCharacteristic1 * characteristic;
-
-    ChipLogDetail(DeviceLayer, "Create characteristic object at %s", charPath);
-    object = bluez_object_skeleton_new(charPath);
-
-    characteristic = bluez_gatt_characteristic1_skeleton_new();
-    bluez_gatt_characteristic1_set_uuid(characteristic, aUUID);
-    bluez_gatt_characteristic1_set_service(characteristic, servicePath);
-
-    bluez_object_skeleton_set_gatt_characteristic1(object, characteristic);
-    g_dbus_object_manager_server_export(aRoot, G_DBUS_OBJECT_SKELETON(object));
-    g_object_unref(object);
-
-    return characteristic;
-}
-
-static void BluezPeripheralRegisterAppDone(GObject * aObject, GAsyncResult * aResult, gpointer apClosure)
-{
-    GError * error              = nullptr;
-    BluezGattManager1 * gattMgr = BLUEZ_GATT_MANAGER1(aObject);
-
-    gboolean success = bluez_gatt_manager1_call_register_application_finish(gattMgr, aResult, &error);
-
-    VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: RegisterApplication : %s", error->message));
-
-    BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(true, nullptr);
-    ChipLogDetail(DeviceLayer, "BluezPeripheralRegisterAppDone done");
-
-exit:
-    if (error != nullptr)
-    {
-        BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(false, nullptr);
-        g_error_free(error);
-    }
-}
-
-gboolean BluezPeripheralRegisterApp(void * apClosure)
-{
-    GDBusObject * adapter;
-    BluezGattManager1 * gattMgr;
-    GVariantBuilder optionsBuilder;
-    GVariant * options;
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    VerifyOrExit(endpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__));
-
-    adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(endpoint->mpAdapter));
-    VerifyOrExit(adapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapter in %s", __func__));
-
-    gattMgr = bluez_object_get_gatt_manager1(BLUEZ_OBJECT(adapter));
-    VerifyOrExit(gattMgr != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL gattMgr in %s", __func__));
-
-    g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE("a{sv}"));
-    options = g_variant_builder_end(&optionsBuilder);
-
-    bluez_gatt_manager1_call_register_application(gattMgr, endpoint->mpRootPath, options, nullptr, BluezPeripheralRegisterAppDone,
-                                                  nullptr);
-
-exit:
-    return G_SOURCE_REMOVE;
-}
-
-/***********************************************************************
- * GATT Characteristic object
- ***********************************************************************/
-
-static void BluezHandleAdvertisementFromDevice(BluezDevice1 * aDevice, BluezEndpoint * endpoint)
-{
-    const char * address   = bluez_device1_get_address(aDevice);
-    const char * flags     = bluez_device1_get_advertising_flags(aDevice);
-    GVariant * serviceData = bluez_device1_get_service_data(aDevice);
-
-    GVariantIter serviceIterator;
-    GVariant * serviceEntry;
-    chip::Ble::ChipBleUUID uuid;
-    chip::Ble::ChipBLEDeviceIdentificationInfo deviceInfo;
-    char * debugStr = nullptr;
-    size_t dataLen;
-
-    // service data is optional and may not be present
-    VerifyOrExit(serviceData != nullptr, );
-
-    ChipLogDetail(DeviceLayer, "TRACE: Device %s Advertising flags: %s", address, flags);
-    debugStr = g_variant_print(serviceData, TRUE);
-    ChipLogDetail(DeviceLayer, "TRACE: Device %s Service data: %s", address, debugStr);
-
-    g_variant_iter_init(&serviceIterator, serviceData);
-
-    while ((serviceEntry = g_variant_iter_next_value(&serviceIterator)) != nullptr)
-    {
-        GVariant * key     = g_variant_get_child_value(serviceEntry, 0);
-        GVariant * val     = g_variant_get_child_value(serviceEntry, 1);
-        const auto uuidStr = g_variant_get_string(key, &dataLen);
-        const void * rawData;
-
-        VerifyOrExit(chip::Ble::StringToUUID(uuidStr, uuid), ChipLogError(DeviceLayer, "TRACE: Invalid BLE UUID format"));
-
-        if (!UUIDsMatch(&uuid, &Ble::CHIP_BLE_SVC_ID))
-            continue;
-
-        rawData = g_variant_get_fixed_array(g_variant_get_variant(val), &dataLen, sizeof(uint8_t));
-        VerifyOrExit(dataLen == sizeof(deviceInfo), ChipLogError(DeviceLayer, "TRACE: Invalid BLE Device info"));
-
-        memcpy(&deviceInfo, rawData, dataLen);
-        ChipLogDetail(DeviceLayer, "TRACE: Found CHIP BLE Device: %" PRIu16, deviceInfo.GetDeviceDiscriminator());
-
-        if (endpoint->mDiscoveryRequest.mDiscriminator == deviceInfo.GetDeviceDiscriminator() &&
-            endpoint->mDiscoveryRequest.mAutoConnect)
-            ConnectDevice(aDevice);
-    }
-
-exit:
-    g_free(debugStr);
-}
-
-static void BluezSignalInterfacePropertiesChanged(GDBusObjectManagerClient * aManager, GDBusObjectProxy * aObject,
-                                                  GDBusProxy * aInterface, GVariant * aChangedProperties,
-                                                  const gchar * const * aInvalidatedProps, gpointer apClosure)
-{
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(endpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__));
-
-    if (strcmp(g_dbus_proxy_get_interface_name(aInterface), DEVICE_INTERFACE) == 0)
-    {
-        BluezDevice1 * device = BLUEZ_DEVICE1(aInterface);
-        GVariantIter iter;
-        GVariant * value;
-        char * key;
-
-        if (BluezIsDeviceOnAdapter(device, endpoint->mpAdapter))
-        {
-            BluezConnection * conn =
-                static_cast<BluezConnection *>(g_hash_table_lookup(endpoint->mpConnMap, g_dbus_proxy_get_object_path(aInterface)));
-            g_variant_iter_init(&iter, aChangedProperties);
-            while (g_variant_iter_next(&iter, "{&sv}", &key, &value))
-            {
-                if (strcmp(key, "Connected") == 0)
-                {
-                    gboolean connected;
-                    connected = g_variant_get_boolean(value);
-
-                    if (connected)
-                    {
-                        ChipLogDetail(DeviceLayer, "Bluez coonnected");
-                        // for a central, the connection has been already allocated.  For a peripheral, it has not.
-                        // todo do we need this ? we could handle all connection the same wa...
-                        if (endpoint->mIsCentral)
-                            SuccessOrExit(conn != nullptr);
-
-                        if (!endpoint->mIsCentral)
-                        {
-                            VerifyOrExit(conn == nullptr,
-                                         ChipLogError(DeviceLayer, "FAIL: connection already tracked: conn: %x device: %s", conn,
-                                                      g_dbus_proxy_get_object_path(aInterface)));
-                            conn                = g_new0(BluezConnection, 1);
-                            conn->mpPeerAddress = g_strdup(bluez_device1_get_address(device));
-                            conn->mpDevice      = static_cast<BluezDevice1 *>(g_object_ref(device));
-                            conn->mpEndpoint    = endpoint;
-                            BluezConnectionInit(conn);
-                            endpoint->mpPeerDevicePath = g_strdup(g_dbus_proxy_get_object_path(aInterface));
-                            ChipLogDetail(DeviceLayer, "Device %s (Path: %s) Connected", conn->mpPeerAddress,
-                                          endpoint->mpPeerDevicePath);
-                            g_hash_table_insert(endpoint->mpConnMap, endpoint->mpPeerDevicePath, conn);
-                        }
-                        // for central, we do not call BluezConnectionInit until the services have been resolved
-
-                        BLEManagerImpl::CHIPoBluez_NewConnection(conn);
-                    }
-                    else
-                    {
-                        ChipLogDetail(DeviceLayer, "Bluez disconnected");
-                        BLEManagerImpl::CHIPoBluez_ConnectionClosed(conn);
-                        BluezOTConnectionDestroy(conn);
-                        g_hash_table_remove(endpoint->mpConnMap, g_dbus_proxy_get_object_path(aInterface));
-                    }
-                }
-                else if (strcmp(key, "ServicesResolved") == 0)
-                {
-                    gboolean resolved;
-                    resolved = g_variant_get_boolean(value);
-
-                    if (endpoint->mIsCentral && conn != nullptr && resolved == TRUE)
-                    {
-                        /* delay to idle, this is to workaround race in handling
-                         * of interface-added and properites-changed signals
-                         * it looks like we cannot specify order of those
-                         * handlers and currently implementation assumes
-                         * that interfaces-added is called first.
-                         *
-                         * TODO figure out if we can avoid this
-                         */
-                        g_idle_add(BluezConnectionInitIdle, conn);
-                    }
-                }
-                else if (strcmp(key, "RSSI") == 0)
-                {
-                    /* when discovery starts we will get this one device is
-                     * found even if device object was already present
-                     */
-                    if (endpoint->mIsCentral)
-                    {
-                        BluezHandleAdvertisementFromDevice(device, endpoint);
-                    }
-                }
-
-                g_variant_unref(value);
-            }
-        }
-    }
-exit:
-    return;
-}
-
-static void BluezHandleNewDevice(BluezDevice1 * device, BluezEndpoint * apEndpoint)
-{
-    VerifyOrExit(apEndpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    if (apEndpoint->mIsCentral)
-    {
-        BluezHandleAdvertisementFromDevice(device, apEndpoint);
-    }
-    else
-    {
-        // We need to handle device connection both this function and BluezSignalInterfacePropertiesChanged
-        // When a device is connected for first time, this function will be triggerred.
-        // The future connections for the same device will trigger ``Connect'' property change.
-        // TODO: Factor common code in the two function.
-        BluezConnection * conn;
-        VerifyOrExit(bluez_device1_get_connected(device), ChipLogError(DeviceLayer, "FAIL: device is not connected"));
-
-        conn = static_cast<BluezConnection *>(
-            g_hash_table_lookup(apEndpoint->mpConnMap, g_dbus_proxy_get_object_path(G_DBUS_PROXY(device))));
-        VerifyOrExit(conn == nullptr,
-                     ChipLogError(DeviceLayer, "FAIL: connection already tracked: conn: %x new device: %s", conn,
-                                  g_dbus_proxy_get_object_path(G_DBUS_PROXY(device))));
-
-        conn                = g_new0(BluezConnection, 1);
-        conn->mpPeerAddress = g_strdup(bluez_device1_get_address(device));
-        conn->mpDevice      = static_cast<BluezDevice1 *>(g_object_ref(device));
-        conn->mpEndpoint    = apEndpoint;
-        BluezConnectionInit(conn);
-        apEndpoint->mpPeerDevicePath = g_strdup(g_dbus_proxy_get_object_path(G_DBUS_PROXY(device)));
-        ChipLogDetail(DeviceLayer, "Device %s (Path: %s) Connected", conn->mpPeerAddress, apEndpoint->mpPeerDevicePath);
-        g_hash_table_insert(apEndpoint->mpConnMap, g_strdup(g_dbus_proxy_get_object_path(G_DBUS_PROXY(device))), conn);
-    }
-
-exit:
-    return;
-}
-
-static void BluezSignalOnObjectAdded(GDBusObjectManager * aManager, GDBusObject * aObject, gpointer apClosure)
-{
-    // TODO: right now we do not handle addition/removal of adapters
-    // Primary focus here is to handle addition of a device
-
-    BluezObject * o          = BLUEZ_OBJECT(aObject);
-    BluezDevice1 * device    = bluez_object_get_device1(o);
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    if (device != nullptr)
-    {
-        if (BluezIsDeviceOnAdapter(device, endpoint->mpAdapter) == TRUE)
-        {
-            BluezHandleNewDevice(device, endpoint);
-        }
-
-        g_object_unref(device);
-    }
-}
-
-static void BluezSignalOnObjectRemoved(GDBusObjectManager * aManager, GDBusObject * aObject, gpointer apClosure)
-{
-    // TODO: for Device1, lookup connection, and call otPlatTobleHandleDisconnected
-    // for Adapter1: unclear, crash if this pertains to our adapter? at least null out the endpoint->mpAdapter.
-    // for Characteristic1, or GattService -- handle here via calling otPlatTobleHandleDisconnected, or ignore.
-}
-
-static BluezGattService1 * BluezServiceCreate(gpointer apClosure)
-{
-    BluezObjectSkeleton * object;
-    BluezGattService1 * service;
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-
-    endpoint->mpServicePath = g_strdup_printf("%s/service", endpoint->mpRootPath);
-    ChipLogDetail(DeviceLayer, "CREATE service object at %s", endpoint->mpServicePath);
-    object = bluez_object_skeleton_new(endpoint->mpServicePath);
-
-    service = bluez_gatt_service1_skeleton_new();
-    bluez_gatt_service1_set_uuid(service, "0xFEAF");
-    // device is only valid for remote services
-    bluez_gatt_service1_set_primary(service, TRUE);
-
-    // includes -- unclear whether required.  Might be filled in later
-    bluez_object_skeleton_set_gatt_service1(object, service);
-    g_dbus_object_manager_server_export(endpoint->mpRoot, G_DBUS_OBJECT_SKELETON(object));
-    g_object_unref(object);
-
-    return service;
-}
-
-static void bluezObjectsSetup(BluezEndpoint * apEndpoint)
-{
-    GList * objects = nullptr;
-    GList * l;
-    char * expectedPath = nullptr;
-
-    VerifyOrExit(apEndpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    expectedPath = g_strdup_printf("%s/hci%d", BLUEZ_PATH, apEndpoint->mNodeId);
-    objects      = g_dbus_object_manager_get_objects(apEndpoint->mpObjMgr);
-
-    for (l = objects; l != nullptr && apEndpoint->mpAdapter == nullptr; l = l->next)
-    {
-        BluezObject * object = BLUEZ_OBJECT(l->data);
-        GList * interfaces;
-        GList * ll;
-        interfaces = g_dbus_object_get_interfaces(G_DBUS_OBJECT(object));
-
-        for (ll = interfaces; ll != nullptr; ll = ll->next)
-        {
-            if (BLUEZ_IS_ADAPTER1(ll->data))
-            { // we found the adapter
-                BluezAdapter1 * adapter = BLUEZ_ADAPTER1(ll->data);
-                char * addr             = const_cast<char *>(bluez_adapter1_get_address(adapter));
-                if (apEndpoint->mpAdapterAddr == nullptr) // no adapter address provided, bind to the hci indicated by nodeid
-                {
-                    if (strcmp(g_dbus_proxy_get_object_path(G_DBUS_PROXY(adapter)), expectedPath) == 0)
-                    {
-                        apEndpoint->mpAdapter = static_cast<BluezAdapter1 *>(g_object_ref(adapter));
-                    }
-                }
-                else
-                {
-                    if (strcmp(apEndpoint->mpAdapterAddr, addr) == 0)
-                    {
-                        apEndpoint->mpAdapter = static_cast<BluezAdapter1 *>(g_object_ref(adapter));
-                    }
-                }
-            }
-        }
-        g_list_free_full(interfaces, g_object_unref);
-    }
-    VerifyOrExit(apEndpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL apEndpoint->mpAdapter in %s", __func__));
-    bluez_adapter1_set_powered(apEndpoint->mpAdapter, TRUE);
-
-    // with BLE we are discoverable only when advertising so this can be
-    // set once on init
-    bluez_adapter1_set_discoverable_timeout(apEndpoint->mpAdapter, 0);
-    bluez_adapter1_set_discoverable(apEndpoint->mpAdapter, TRUE);
-
-exit:
-    g_list_free_full(objects, g_object_unref);
-    g_free(expectedPath);
-}
-
-static BluezConnection * GetBluezConnectionViaDevice(BluezEndpoint * apEndpoint)
-{
-    BluezConnection * retval =
-        static_cast<BluezConnection *>(g_hash_table_lookup(apEndpoint->mpConnMap, apEndpoint->mpPeerDevicePath));
-    // ChipLogError(DeviceLayer, "acquire connection object %p in (%s)", retval, __func__);
-    return retval;
-}
-
-#if CHIP_BLUEZ_CENTRAL_SUPPORT
-static BluezConnection * BluezCharacteristicGetBluezConnection(BluezGattCharacteristic1 * aChar, GVariant * aOptions,
-                                                               BluezEndpoint * apEndpoint)
-{
-    BluezConnection * retval = NULL;
-    const gchar * path       = NULL;
-    GVariantDict options;
-    GVariant * v;
-
-    VerifyOrExit(apEndpoint != NULL, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(apEndpoint->mIsCentral, );
-
-    /* TODO Unfortunately StartNotify/StopNotify doesn't provide info about
-     * peer device in call params so we need look this up ourselves.
-     */
-    if (aOptions == NULL)
-    {
-        GList * objects;
-        GList * l;
-        GList * ll;
-
-        objects = g_dbus_object_manager_get_objects(apEndpoint->mpObjMgr);
-        for (l = objects; l != NULL; l = l->next)
-        {
-            BluezDevice1 * device = bluez_object_get_device1(BLUEZ_OBJECT(l->data));
-            if (device != NULL)
-            {
-                if (BluezIsDeviceOnAdapter(device, apEndpoint->mpAdapter))
-                {
-                    for (ll = objects; ll != NULL; ll = ll->next)
-                    {
-                        BluezGattService1 * service = bluez_object_get_gatt_service1(BLUEZ_OBJECT(ll->data));
-                        if (service != NULL)
-                        {
-                            if (BluezIsServiceOnDevice(service, device))
-                            {
-                                if (BluezIsCharOnService(aChar, service))
-                                {
-                                    retval = (BluezConnection *) g_hash_table_lookup(
-                                        apEndpoint->mpConnMap, g_dbus_proxy_get_object_path(G_DBUS_PROXY(device)));
-                                }
-                            }
-                            g_object_unref(service);
-                            if (retval != NULL)
-                                break;
-                        }
-                    }
-                }
-                g_object_unref(device);
-                if (retval != NULL)
-                    break;
-            }
-        }
-
-        g_list_free_full(objects, g_object_unref);
-    }
-    else
-    {
-        g_variant_dict_init(&options, aOptions);
-
-        v = g_variant_dict_lookup_value(&options, "device", G_VARIANT_TYPE_OBJECT_PATH);
-
-        VerifyOrExit(v != NULL, ChipLogError(DeviceLayer, "FAIL: No device option in dictionary (%s)", __func__));
-
-        path = g_variant_get_string(v, NULL);
-
-        retval = (BluezConnection *) g_hash_table_lookup(apEndpoint->mpConnMap, path);
-    }
-
-exit:
-    return retval;
-}
-#endif // CHIP_BLUEZ_CENTRAL_SUPPORT
-
-void EndpointCleanup(BluezEndpoint * apEndpoint)
-{
-    if (apEndpoint != nullptr)
-    {
-        if (apEndpoint->mpOwningName != nullptr)
-        {
-            g_free(apEndpoint->mpOwningName);
-            apEndpoint->mpOwningName = nullptr;
-        }
-        if (apEndpoint->mpAdapterName != nullptr)
-        {
-            g_free(apEndpoint->mpAdapterName);
-            apEndpoint->mpAdapterName = nullptr;
-        }
-        if (apEndpoint->mpAdapterAddr != nullptr)
-        {
-            g_free(apEndpoint->mpAdapterAddr);
-            apEndpoint->mpAdapterAddr = nullptr;
-        }
-        if (apEndpoint->mpRootPath != nullptr)
-        {
-            g_free(apEndpoint->mpRootPath);
-            apEndpoint->mpRootPath = nullptr;
-        }
-        if (apEndpoint->mpAdvPath != nullptr)
-        {
-            g_free(apEndpoint->mpAdvPath);
-            apEndpoint->mpAdvPath = nullptr;
-        }
-        if (apEndpoint->mpServicePath != nullptr)
-        {
-            g_free(apEndpoint->mpServicePath);
-            apEndpoint->mpServicePath = nullptr;
-        }
-        if (apEndpoint->mpConnMap != nullptr)
-        {
-            g_hash_table_destroy(apEndpoint->mpConnMap);
-            apEndpoint->mpConnMap = nullptr;
-        }
-        if (apEndpoint->mpAdvertisingUUID != nullptr)
-        {
-            g_free(apEndpoint->mpAdvertisingUUID);
-            apEndpoint->mpAdvertisingUUID = nullptr;
-        }
-        if (apEndpoint->mpPeerDevicePath != nullptr)
-        {
-            g_free(apEndpoint->mpPeerDevicePath);
-            apEndpoint->mpPeerDevicePath = nullptr;
-        }
-
-        g_free(apEndpoint);
-    }
-}
-
-void BluezObjectsCleanup(BluezEndpoint * apEndpoint)
-{
-    g_object_unref(apEndpoint->mpAdapter);
-    EndpointCleanup(apEndpoint);
-}
-
-static void BluezPeripheralObjectsSetup(gpointer apClosure)
-{
-
-    static const char * const c1_flags[] = { "write", nullptr };
-    static const char * const c2_flags[] = { "read", "indicate", nullptr };
-
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    endpoint->mpService = BluezServiceCreate(apClosure);
-    // C1 characteristic
-    endpoint->mpC1 =
-        BluezCharacteristicCreate(endpoint->mpService, g_strdup("c1"), g_strdup(CHIP_PLAT_BLE_UUID_C1_STRING), endpoint->mpRoot);
-    bluez_gatt_characteristic1_set_flags(endpoint->mpC1, c1_flags);
-
-    g_signal_connect(endpoint->mpC1, "handle-read-value", G_CALLBACK(BluezCharacteristicReadValue), apClosure);
-    g_signal_connect(endpoint->mpC1, "handle-write-value", G_CALLBACK(BluezCharacteristicWriteValueError), NULL);
-    g_signal_connect(endpoint->mpC1, "handle-acquire-write", G_CALLBACK(BluezCharacteristicAcquireWrite), apClosure);
-    g_signal_connect(endpoint->mpC1, "handle-acquire-notify", G_CALLBACK(BluezCharacteristicAcquireNotifyError), NULL);
-    g_signal_connect(endpoint->mpC1, "handle-start-notify", G_CALLBACK(BluezCharacteristicStartNotifyError), NULL);
-    g_signal_connect(endpoint->mpC1, "handle-stop-notify", G_CALLBACK(BluezCharacteristicStopNotifyError), NULL);
-    g_signal_connect(endpoint->mpC1, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirmError), NULL);
-
-    endpoint->mpC2 =
-        BluezCharacteristicCreate(endpoint->mpService, g_strdup("c2"), g_strdup(CHIP_PLAT_BLE_UUID_C2_STRING), endpoint->mpRoot);
-    bluez_gatt_characteristic1_set_flags(endpoint->mpC2, c2_flags);
-    g_signal_connect(endpoint->mpC2, "handle-read-value", G_CALLBACK(BluezCharacteristicReadValue), apClosure);
-    g_signal_connect(endpoint->mpC2, "handle-write-value", G_CALLBACK(BluezCharacteristicWriteValueError), NULL);
-    g_signal_connect(endpoint->mpC2, "handle-acquire-write", G_CALLBACK(BluezCharacteristicAcquireWriteError), NULL);
-    g_signal_connect(endpoint->mpC2, "handle-acquire-notify", G_CALLBACK(BluezCharacteristicAcquireNotify), apClosure);
-    g_signal_connect(endpoint->mpC2, "handle-start-notify", G_CALLBACK(BluezCharacteristicStartNotify), apClosure);
-    g_signal_connect(endpoint->mpC2, "handle-stop-notify", G_CALLBACK(BluezCharacteristicStopNotify), apClosure);
-    g_signal_connect(endpoint->mpC2, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirm), apClosure);
-
-    ChipLogDetail(DeviceLayer, "CHIP BTP C1 %s", bluez_gatt_characteristic1_get_service(endpoint->mpC1));
-    ChipLogDetail(DeviceLayer, "CHIP BTP C2 %s", bluez_gatt_characteristic1_get_service(endpoint->mpC2));
-
-exit:
-    return;
-}
-
-static void BluezOnBusAcquired(GDBusConnection * aConn, const gchar * aName, gpointer apClosure)
-{
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    ChipLogDetail(DeviceLayer, "TRACE: Bus acquired for name %s", aName);
-
-    endpoint->mpRootPath = g_strdup_printf("/chipoble/%04x", getpid() & 0xffff);
-    endpoint->mpRoot     = g_dbus_object_manager_server_new(endpoint->mpRootPath);
-    g_dbus_object_manager_server_set_connection(endpoint->mpRoot, aConn);
-    BluezPeripheralObjectsSetup(apClosure);
-
-exit:
-    return;
-}
-
-#if CHIP_BLUEZ_NAME_MONITOR
-static void BluezOnNameAcquired(GDBusConnection * aConn, const gchar * aName, gpointer apClosure)
-{
-    ChipLogDetail(DeviceLayer, "TRACE: Owning name: Acquired %s", aName);
-}
-
-static void BluezOnNameLost(GDBusConnection * aConn, const gchar * aName, gpointer apClosure)
-{
-    ChipLogDetail(DeviceLayer, "TRACE: Owning name: lost %s", aName);
-}
-#endif
-
-static void * BluezMainLoop(void * apClosure)
-{
-    GDBusObjectManager * manager;
-    GError * error           = nullptr;
-    GDBusConnection * conn   = nullptr;
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apClosure);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-
-    conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error);
-    VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "FAIL: get bus sync in %s, error: %s", __func__, error->message));
-
-    if (endpoint->mpAdapterName != nullptr)
-        endpoint->mpOwningName = g_strdup_printf("%s", endpoint->mpAdapterName);
-    else
-        endpoint->mpOwningName = g_strdup_printf("C-%04x", getpid() & 0xffff);
-
-    BluezOnBusAcquired(conn, endpoint->mpOwningName, apClosure);
-
-    manager = g_dbus_object_manager_client_new_sync(
-        conn, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/", bluez_object_manager_client_get_proxy_type,
-        nullptr /* unused user data in the Proxy Type Func */, nullptr /*destroy notify */, nullptr /* cancellable */, &error);
-
-    VerifyOrExit(manager != nullptr, ChipLogError(DeviceLayer, "FAIL: Error getting object manager client: %s", error->message));
-
-    endpoint->mpObjMgr = manager;
-
-    bluezObjectsSetup(endpoint);
-
-#if 0
-    // reenable if we want to handle the bluetoothd restart
-    g_signal_connect (manager,
-                      "notify::name-owner",
-                      G_CALLBACK (on_notify_name_owner),
-                      NULL);
-#endif
-    g_signal_connect(manager, "object-added", G_CALLBACK(BluezSignalOnObjectAdded), apClosure);
-    g_signal_connect(manager, "object-removed", G_CALLBACK(BluezSignalOnObjectRemoved), apClosure);
-    g_signal_connect(manager, "interface-proxy-properties-changed", G_CALLBACK(BluezSignalInterfacePropertiesChanged), apClosure);
-
-    ChipLogDetail(DeviceLayer, "TRACE: Bluez mainloop starting %s", __func__);
-    g_main_loop_run(sBluezMainLoop);
-    ChipLogDetail(DeviceLayer, "TRACE: Bluez mainloop stopping %s", __func__);
-
-    BluezObjectsCleanup(endpoint);
-
-exit:
-    if (error != nullptr)
-        g_error_free(error);
-    return nullptr;
-}
-
-bool BluezRunOnBluezThread(int (*aCallback)(void *), void * apClosure)
-{
-    GMainContext * context = nullptr;
-    const char * msg       = nullptr;
-
-    VerifyOrExit(sBluezMainLoop != nullptr, msg = "FAIL: NULL sBluezMainLoop");
-    VerifyOrExit(g_main_loop_is_running(sBluezMainLoop), msg = "FAIL: sBluezMainLoop not running");
-
-    context = g_main_loop_get_context(sBluezMainLoop);
-    VerifyOrExit(context != nullptr, msg = "FAIL: NULL main context");
-    g_main_context_invoke(context, aCallback, apClosure);
-
-exit:
-    if (msg != nullptr)
-    {
-        ChipLogDetail(DeviceLayer, "%s in %s", msg, __func__);
-    }
-
-    return msg == nullptr;
-}
-
-static gboolean BluezC2Indicate(void * apClosure)
-{
-    ConnectionDataBundle * closure = nullptr;
-    BluezConnection * conn         = nullptr;
-    GError * error                 = nullptr;
-    GIOStatus status;
-    const char * buf;
-    size_t len, written;
-
-    closure = static_cast<ConnectionDataBundle *>(apClosure);
-    VerifyOrExit(closure != nullptr, ChipLogError(DeviceLayer, "ConnectionDataBundle is NULL in %s", __func__));
-
-    conn = closure->mpConn;
-    VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__));
-    VerifyOrExit(conn->mpC2 != nullptr, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", "NULL C2"));
-
-    if (bluez_gatt_characteristic1_get_notify_acquired(conn->mpC2) == TRUE)
-    {
-        buf = (char *) g_variant_get_fixed_array(closure->mpVal, &len, sizeof(uint8_t));
-        VerifyOrExit(len <= static_cast<size_t>(std::numeric_limits<gssize>::max()),
-                     ChipLogError(DeviceLayer, "FAIL: buffer too large in %s", __func__));
-        status = g_io_channel_write_chars(conn->mC2Channel.mpChannel, buf, static_cast<gssize>(len), &written, &error);
-        g_variant_unref(closure->mpVal);
-        closure->mpVal = nullptr;
-
-        VerifyOrExit(status == G_IO_STATUS_NORMAL, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", error->message));
-    }
-    else
-    {
-        bluez_gatt_characteristic1_set_value(conn->mpC2, closure->mpVal);
-        closure->mpVal = nullptr;
-    }
-
-exit:
-    if (closure != nullptr)
-    {
-        if (closure->mpVal)
-        {
-            g_variant_unref(closure->mpVal);
-        }
-        g_free(closure);
-    }
-
-    if (error != nullptr)
-        g_error_free(error);
-    return G_SOURCE_REMOVE;
-}
-
-bool SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf)
-{
-    ConnectionDataBundle * closure;
-    const char * msg = nullptr;
-    bool success     = false;
-    uint8_t * buffer = nullptr;
-    size_t len       = 0;
-
-    VerifyOrExit(!apBuf.IsNull(), ChipLogError(DeviceLayer, "apBuf is NULL in %s", __func__));
-    buffer = apBuf->Start();
-    len    = apBuf->DataLength();
-
-    closure         = g_new(ConnectionDataBundle, 1);
-    closure->mpConn = static_cast<BluezConnection *>(apConn);
-
-    closure->mpVal = g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, buffer, len * sizeof(uint8_t), sizeof(uint8_t));
-
-    success = BluezRunOnBluezThread(BluezC2Indicate, closure);
-
-exit:
-    if (nullptr != msg)
-    {
-        ChipLogError(Ble, msg);
-    }
-
-    return success;
-}
-
-static gboolean BluezDisconnect(void * apClosure)
-{
-    BluezConnection * conn = static_cast<BluezConnection *>(apClosure);
-    GError * error         = nullptr;
-    gboolean success;
-
-    VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "conn is NULL in %s", __func__));
-    VerifyOrExit(conn->mpDevice != nullptr, ChipLogError(DeviceLayer, "FAIL: Disconnect: %s", "NULL Device"));
-
-    ChipLogDetail(DeviceLayer, "%s peer=%s", __func__, bluez_device1_get_address(conn->mpDevice));
-
-    success = bluez_device1_call_disconnect_sync(conn->mpDevice, nullptr, &error);
-    VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: Disconnect: %s", error->message));
-
-exit:
-    if (error != nullptr)
-        g_error_free(error);
-    return G_SOURCE_REMOVE;
-}
-
-static int CloseBleconnectionCB(void * apAppState)
-{
-    BluezDisconnect(apAppState);
-    return G_SOURCE_REMOVE;
-}
-
-bool CloseBluezConnection(BLE_CONNECTION_OBJECT apConn)
-{
-    return BluezRunOnBluezThread(CloseBleconnectionCB, apConn);
-}
-
-CHIP_ERROR StartBluezAdv(BluezEndpoint * apEndpoint)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    if (!BluezRunOnBluezThread(BluezAdvStart, apEndpoint))
-    {
-        err = CHIP_ERROR_INCORRECT_STATE;
-        ChipLogError(Ble, "Failed to schedule BluezAdvStart() on CHIPoBluez thread");
-    }
-    return err;
-}
-
-CHIP_ERROR StopBluezAdv(BluezEndpoint * apEndpoint)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    if (!BluezRunOnBluezThread(BluezAdvStop, apEndpoint))
-    {
-        err = CHIP_ERROR_INCORRECT_STATE;
-        ChipLogError(Ble, "Failed to schedule BluezAdvStop() on CHIPoBluez thread");
-    }
-    return err;
-}
-
-CHIP_ERROR BluezAdvertisementSetup(BluezEndpoint * apEndpoint)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    if (!BluezRunOnBluezThread(BluezAdvSetup, apEndpoint))
-    {
-        err = CHIP_ERROR_INCORRECT_STATE;
-        ChipLogError(Ble, "Failed to schedule BluezAdvertisementSetup() on CHIPoBluez thread");
-    }
-    return err;
-}
-
-CHIP_ERROR BluezGattsAppRegister(BluezEndpoint * apEndpoint)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    if (!BluezRunOnBluezThread(BluezPeripheralRegisterApp, apEndpoint))
-    {
-        err = CHIP_ERROR_INCORRECT_STATE;
-        ChipLogError(Ble, "Failed to schedule BluezPeripheralRegisterApp() on CHIPoBluez thread");
-    }
-    return err;
-}
-
-CHIP_ERROR ConfigureBluezAdv(BLEAdvConfig & aBleAdvConfig, BluezEndpoint * apEndpoint)
-{
-    const char * msg = nullptr;
-    CHIP_ERROR err   = CHIP_NO_ERROR;
-    VerifyOrExit(aBleAdvConfig.mpBleName != nullptr, msg = "FAIL: BLE name is NULL");
-    VerifyOrExit(aBleAdvConfig.mpAdvertisingUUID != nullptr, msg = "FAIL: BLE mpAdvertisingUUID is NULL in %s");
-
-    apEndpoint->mpAdapterName     = g_strdup(aBleAdvConfig.mpBleName);
-    apEndpoint->mpAdvertisingUUID = g_strdup(aBleAdvConfig.mpAdvertisingUUID);
-    apEndpoint->mNodeId           = aBleAdvConfig.mNodeId;
-    apEndpoint->mType             = aBleAdvConfig.mType;
-    apEndpoint->mDuration         = aBleAdvConfig.mDuration;
-    apEndpoint->mDuration         = aBleAdvConfig.mDuration;
-
-    err = ConfigurationMgr().GetBLEDeviceIdentificationInfo(apEndpoint->mDeviceIdInfo);
-    SuccessOrExit(err);
-
-exit:
-    if (nullptr != msg)
-    {
-        ChipLogDetail(DeviceLayer, "%s in %s", msg, __func__);
-        err = CHIP_ERROR_INCORRECT_STATE;
-    }
-    return err;
-}
-
-CHIP_ERROR InitBluezBleLayer(bool aIsCentral, char * apBleAddr, BLEAdvConfig & aBleAdvConfig, void *& apEndpoint)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    bool retval    = false;
-    int pthreadErr = 0;
-    int tmpErrno;
-    BluezEndpoint * endpoint = nullptr;
-
-    VerifyOrExit(pipe2(sBluezFD, O_DIRECT) == 0, ChipLogError(DeviceLayer, "FAIL: open pipe in %s", __func__));
-
-    // initialize server endpoint
-    endpoint = g_new0(BluezEndpoint, 1);
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "FAIL: memory allocation in %s", __func__));
-
-    if (apBleAddr != nullptr)
-        endpoint->mpAdapterAddr = g_strdup(apBleAddr);
-    else
-        endpoint->mpAdapterAddr = nullptr;
-
-    endpoint->mpConnMap  = g_hash_table_new(g_str_hash, g_str_equal);
-    endpoint->mIsCentral = aIsCentral;
-
-    if (!aIsCentral)
-    {
-        err = ConfigureBluezAdv(aBleAdvConfig, endpoint);
-        SuccessOrExit(err);
-    }
-
-    sBluezMainLoop = g_main_loop_new(nullptr, FALSE);
-    VerifyOrExit(sBluezMainLoop != nullptr, ChipLogError(DeviceLayer, "FAIL: memory alloc in %s", __func__));
-
-    pthreadErr = pthread_create(&sBluezThread, nullptr, BluezMainLoop, endpoint);
-    tmpErrno   = errno;
-    VerifyOrExit(pthreadErr == 0, ChipLogError(DeviceLayer, "FAIL: pthread_create (%s) in %s", strerror(tmpErrno), __func__));
-    sleep(1);
-
-    retval = TRUE;
-
-exit:
-    if (retval)
-    {
-        apEndpoint = endpoint;
-        ChipLogDetail(DeviceLayer, "PlatformBlueZInit init success");
-    }
-    else
-    {
-        EndpointCleanup(endpoint);
-    }
-
-    return err;
-}
-
-// StartDiscovery callbacks
-
-using DiscoveryTaskArg = std::pair<BluezEndpoint *, BluezDiscoveryRequest>;
-
-void StartDiscoveryDone(GObject * aObject, GAsyncResult * aResult, gpointer apEndpoint)
-{
-    BluezAdapter1 * adapter = BLUEZ_ADAPTER1(aObject);
-    GError * error          = nullptr;
-    gboolean success        = bluez_adapter1_call_start_discovery_finish(adapter, aResult, &error);
-
-    VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: StartDiscovery : %s", error->message));
-    ChipLogDetail(DeviceLayer, "StartDiscovery complete");
-
-exit:
-    if (error != nullptr)
-        g_error_free(error);
-}
-
-static gboolean StartDiscoveryImpl(void * apDiscoveryTaskArg)
-{
-    DiscoveryTaskArg * taskArg = static_cast<DiscoveryTaskArg *>(apDiscoveryTaskArg);
-    BluezEndpoint * endpoint;
-
-    VerifyOrExit(taskArg != nullptr, ChipLogError(DeviceLayer, "taskArg is NULL in %s", __func__));
-    endpoint = taskArg->first;
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(endpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "mpAdapter is NULL in %s", __func__));
-
-    endpoint->mDiscoveryRequest = taskArg->second;
-    bluez_adapter1_call_start_discovery(endpoint->mpAdapter, nullptr, StartDiscoveryDone, endpoint);
-
-exit:
-    if (taskArg)
-        delete taskArg;
-    return G_SOURCE_REMOVE;
-}
-
-CHIP_ERROR StartDiscovery(BluezEndpoint * apEndpoint, const BluezDiscoveryRequest aRequest)
-{
-    DiscoveryTaskArg * const taskArg = new DiscoveryTaskArg(apEndpoint, aRequest);
-    CHIP_ERROR error                 = CHIP_NO_ERROR;
-
-    if (!BluezRunOnBluezThread(StartDiscoveryImpl, taskArg))
-    {
-        ChipLogError(Ble, "Failed to schedule StartDiscoveryImpl() on CHIPoBluez thread");
-        delete taskArg;
-        error = CHIP_ERROR_INCORRECT_STATE;
-    }
-
-    return error;
-}
-
-// StopDiscovery callbacks
-
-static void StopDiscoveryDone(GObject * aObject, GAsyncResult * aResult, gpointer apEndpoint)
-{
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-    BluezAdapter1 * adapter  = BLUEZ_ADAPTER1(aObject);
-    GError * error           = nullptr;
-    gboolean success         = bluez_adapter1_call_stop_discovery_finish(adapter, aResult, &error);
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    endpoint->mDiscoveryRequest = {};
-
-    VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: StopDiscovery : %s", error->message));
-    ChipLogDetail(DeviceLayer, "StopDiscovery complete");
-
-exit:
-    if (error != nullptr)
-        g_error_free(error);
-}
-
-static gboolean StopDiscoveryImpl(void * apEndpoint)
-{
-    BluezEndpoint * endpoint = static_cast<BluezEndpoint *>(apEndpoint);
-
-    VerifyOrExit(endpoint != nullptr, ChipLogError(DeviceLayer, "endpoint is NULL in %s", __func__));
-    VerifyOrExit(endpoint->mpAdapter != nullptr, ChipLogError(DeviceLayer, "mpAdapter is NULL in %s", __func__));
-
-    bluez_adapter1_call_stop_discovery(endpoint->mpAdapter, nullptr, StopDiscoveryDone, apEndpoint);
-
-exit:
-    return G_SOURCE_REMOVE;
-}
-
-CHIP_ERROR StopDiscovery(BluezEndpoint * apEndpoint)
-{
-    CHIP_ERROR error = CHIP_NO_ERROR;
-
-    if (!BluezRunOnBluezThread(StopDiscoveryImpl, apEndpoint))
-    {
-        ChipLogError(Ble, "Failed to schedule StopDiscoveryImpl() on CHIPoBluez thread");
-        error = CHIP_ERROR_INCORRECT_STATE;
-    }
-
-    return error;
-}
-
-// ConnectDevice callbacks
-
-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));
-    ChipLogDetail(DeviceLayer, "ConnectDevice complete");
-
-exit:
-    if (error != nullptr)
-        g_error_free(error);
-}
-
-static gboolean ConnectDeviceImpl(void * apDevice)
-{
-    BluezDevice1 * device = static_cast<BluezDevice1 *>(apDevice);
-
-    VerifyOrExit(device != nullptr, ChipLogError(DeviceLayer, "device is NULL in %s", __func__));
-
-    bluez_device1_call_connect(device, nullptr, ConnectDeviceDone, nullptr);
-
-exit:
-    return G_SOURCE_REMOVE;
-}
-
-CHIP_ERROR ConnectDevice(BluezDevice1 * apDevice)
-{
-    CHIP_ERROR error = CHIP_NO_ERROR;
-
-    if (!BluezRunOnBluezThread(ConnectDeviceImpl, apDevice))
-    {
-        ChipLogError(Ble, "Failed to schedule ConnectDeviceImpl() on CHIPoBluez thread");
-        error = CHIP_ERROR_INCORRECT_STATE;
-    }
-
-    return error;
-}
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
-#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
diff --git a/src/platform/Linux/CHIPBluezHelper.h b/src/platform/Linux/CHIPBluezHelper.h
deleted file mode 100644 (file)
index 03ab1b2..0000000
+++ /dev/null
@@ -1,219 +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.
- */
-
-/*
- *  Copyright (c) 2016-2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- *    @file
- *          Provides Bluez dbus implementation for BLE
- */
-
-#pragma once
-
-#include "BLEManagerImpl.h"
-#include <stdbool.h>
-#include <stdint.h>
-#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
-
-#include "ble/CHIPBleServiceData.h"
-#include "platform/Linux/dbus/bluez/DbusBluez.h"
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-#define BLUEZ_ADDRESS_SIZE 6 ///< BLE address size (in bytes)
-#define BLUEZ_PATH "/org/bluez"
-#define BLUEZ_INTERFACE "org.bluez"
-#define ADAPTER_INTERFACE BLUEZ_INTERFACE ".Adapter1"
-#define PROFILE_INTERFACE BLUEZ_INTERFACE ".GattManager1"
-#define ADVERTISING_MANAGER_INTERFACE BLUEZ_INTERFACE ".LEAdvertisingManager1"
-#define SERVICE_INTERFACE BLUEZ_INTERFACE ".GattService1"
-#define CHARACTERISTIC_INTERFACE BLUEZ_INTERFACE ".GattCharacteristic1"
-#define ADVERTISING_INTERFACE BLUEZ_INTERFACE ".LEAdvertisement1"
-#define DEVICE_INTERFACE BLUEZ_INTERFACE ".Device1"
-
-#define CHIP_PLAT_BLE_UUID_C1_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d11"
-#define CHIP_PLAT_BLE_UUID_C2_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d12"
-
-#define CHIP_BLE_BASE_SERVICE_UUID_STRING "-0000-1000-8000-00805f9b34fb"
-#define CHIP_BLE_SERVICE_PREFIX_LENGTH 8
-#define CHIP_BLE_BASE_SERVICE_PREFIX "0000"
-#define CHIP_BLE_UUID_SERVICE_SHORT_STRING "fffb"
-
-#define CHIP_BLE_UUID_SERVICE_STRING                                                                                               \
-    CHIP_BLE_BASE_SERVICE_PREFIX CHIP_BLE_UUID_SERVICE_SHORT_STRING CHIP_BLE_BASE_SERVICE_UUID_STRING
-
-#define BLUEZ_ADV_TYPE_FLAGS 0x01
-#define BLUEZ_ADV_TYPE_SERVICE_DATA 0x16
-
-#define BLUEZ_ADV_FLAGS_LE_LIMITED (1 << 0)
-#define BLUEZ_ADV_FLAGS_LE_DISCOVERABLE (1 << 1)
-#define BLUEZ_ADV_FLAGS_EDR_UNSUPPORTED (1 << 2)
-#define BLUEZ_ADV_FLAGS_LE_EDR_CONTROLLER (1 << 3)
-#define BLUEZ_ADV_FLAGS_LE_EDR_HOST (1 << 4)
-
-#define CHAR_TO_BLUEZ(c) (static_cast<uint8_t>(((c) <= '9') ? (c) - '0' : tolower((c)) - 'a' + 10))
-
-enum BluezAddressType
-{
-    BLUEZ_ADDRESS_TYPE_PUBLIC                        = 0, ///< Bluetooth public device address.
-    BLUEZ_ADDRESS_TYPE_RANDOM_STATIC                 = 1, ///< Bluetooth random static address.
-    BLUEZ_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE     = 2, ///< Bluetooth random private resolvable address.
-    BLUEZ_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE = 3, ///< Bluetooth random private non-resolvable address.
-};
-
-struct BluezAddress
-{
-    BluezAddressType mType;               ///< Bluetooth device address type.
-    uint8_t mAddress[BLUEZ_ADDRESS_SIZE]; ///< A 48-bit address of Bluetooth device in LSB format.
-};
-
-struct IOChannel
-{
-    GIOChannel * mpChannel;
-    guint mWatch;
-};
-
-struct CHIPIdInfo
-{
-    uint8_t mMajor;
-    uint8_t mMinor;
-    uint16_t mVendorId;
-    uint16_t mProductId;
-    uint64_t mDeviceId;
-    uint8_t mPairingStatus;
-} __attribute__((packed));
-
-struct CHIPServiceData
-{
-    uint8_t mDataBlock0Len;
-    uint8_t mDataBlock0Type;
-    CHIPIdInfo mIdInfo;
-} __attribute__((packed));
-
-struct BluezDiscoveryRequest
-{
-    uint16_t mDiscriminator;
-    bool mAutoConnect;
-};
-
-struct BluezEndpoint
-{
-    char * mpOwningName; // Bus owning name
-
-    // Adapter properties
-    char * mpAdapterName;
-    char * mpAdapterAddr;
-
-    // Paths for objects published by this service
-    char * mpRootPath;
-    char * mpAdvPath;
-    char * mpServicePath;
-
-    // Objects (interfaces) subscibed to by this service
-    GDBusObjectManager * mpObjMgr;
-    BluezAdapter1 * mpAdapter;
-    BluezDevice1 * mpDevice;
-
-    // Objects (interfaces) published by this service
-    GDBusObjectManagerServer * mpRoot;
-    BluezGattService1 * mpService;
-    BluezGattCharacteristic1 * mpC1;
-    BluezGattCharacteristic1 * mpC2;
-
-    // map device path to the connection
-    GHashTable * mpConnMap;
-    uint32_t mNodeId;
-    bool mIsNotify;
-    bool mIsCentral;
-    char * mpAdvertisingUUID;
-    chip::Ble::ChipBLEDeviceIdentificationInfo mDeviceIdInfo;
-    ChipAdvType mType;  ///< Advertisement type.
-    uint16_t mDuration; ///< Advertisement interval (in ms).
-    bool mIsAdvertising;
-    char * mpPeerDevicePath;
-
-    // Discovery settings
-    BluezDiscoveryRequest mDiscoveryRequest = {};
-};
-
-struct BluezConnection
-{
-    char * mpPeerAddress;
-    BluezDevice1 * mpDevice;
-    BluezGattService1 * mpService;
-    BluezGattCharacteristic1 * mpC1;
-    BluezGattCharacteristic1 * mpC2;
-    bool mIsNotify;
-    uint16_t mMtu;
-    struct IOChannel mC1Channel;
-    struct IOChannel mC2Channel;
-    BluezEndpoint * mpEndpoint;
-};
-
-struct ConnectionDataBundle
-{
-    BluezConnection * mpConn;
-    GVariant * mpVal;
-};
-
-CHIP_ERROR InitBluezBleLayer(bool aIsCentral, char * apBleAddr, BLEAdvConfig & aBleAdvConfig, void *& apEndpoint);
-bool BluezRunOnBluezThread(int (*aCallback)(void *), void * apClosure);
-bool SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf);
-bool CloseBluezConnection(BLE_CONNECTION_OBJECT apConn);
-CHIP_ERROR StartBluezAdv(BluezEndpoint * apEndpoint);
-CHIP_ERROR StopBluezAdv(BluezEndpoint * apEndpoint);
-CHIP_ERROR BluezGattsAppRegister(BluezEndpoint * apEndpoint);
-CHIP_ERROR BluezAdvertisementSetup(BluezEndpoint * apEndpoint);
-
-CHIP_ERROR StartDiscovery(BluezEndpoint * apEndpoint, BluezDiscoveryRequest aRequest = {});
-CHIP_ERROR StopDiscovery(BluezEndpoint * apEndpoint);
-
-CHIP_ERROR ConnectDevice(BluezDevice1 * apDevice);
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
-
-#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
index 8426e65..f73e0dc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2019 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -256,17 +256,18 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
 
 #if CHIP_DEVICE_CONFIG_ENABLE_WPA
 
-uint16_t ConnectivityManagerImpl::mConnectivityFlag;
+BitFlags<Internal::GenericConnectivityManagerImpl_WiFi<ConnectivityManagerImpl>::ConnectivityFlags>
+    ConnectivityManagerImpl::mConnectivityFlag;
 struct GDBusWpaSupplicant ConnectivityManagerImpl::mWpaSupplicant;
 
 bool ConnectivityManagerImpl::_HaveIPv4InternetConnectivity()
 {
-    return ((mConnectivityFlag & kFlag_HaveIPv4InternetConnectivity) != 0);
+    return mConnectivityFlag.Has(ConnectivityFlags::kHaveIPv4InternetConnectivity);
 }
 
 bool ConnectivityManagerImpl::_HaveIPv6InternetConnectivity()
 {
-    return ((mConnectivityFlag & kFlag_HaveIPv6InternetConnectivity) != 0);
+    return mConnectivityFlag.Has(ConnectivityFlags::kHaveIPv6InternetConnectivity);
 }
 
 ConnectivityManager::WiFiStationMode ConnectivityManagerImpl::_GetWiFiStationMode()
@@ -327,8 +328,8 @@ bool ConnectivityManagerImpl::_IsWiFiStationConnected()
     state = wpa_fi_w1_wpa_supplicant1_interface_get_state(mWpaSupplicant.iface);
     if (g_strcmp0(state, "completed") == 0)
     {
-        SetFlag(mConnectivityFlag, kFlag_HaveIPv4InternetConnectivity, true);
-        SetFlag(mConnectivityFlag, kFlag_HaveIPv6InternetConnectivity, true);
+        mConnectivityFlag.Set(ConnectivityFlags::kHaveIPv4InternetConnectivity)
+            .Set(ConnectivityFlags::kHaveIPv6InternetConnectivity);
         ret = true;
     }
 
@@ -620,7 +621,7 @@ void ConnectivityManagerImpl::_OnWpaProxyReady(GObject * source_object, GAsyncRe
 
 void ConnectivityManagerImpl::StartWiFiManagement()
 {
-    mConnectivityFlag            = 0;
+    mConnectivityFlag.ClearAll();
     mWpaSupplicant.state         = GDBusWpaSupplicant::INIT;
     mWpaSupplicant.scanState     = GDBusWpaSupplicant::WIFI_SCANNING_IDLE;
     mWpaSupplicant.proxy         = nullptr;
index fbcd9e0..f381470 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2018 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -148,7 +148,7 @@ private:
     static void _OnWpaInterfaceReady(GObject * source_object, GAsyncResult * res, gpointer user_data);
     static void _OnWpaInterfaceProxyReady(GObject * source_object, GAsyncResult * res, gpointer user_data);
 
-    static uint16_t mConnectivityFlag;
+    static BitFlags<ConnectivityFlags> mConnectivityFlag;
     static struct GDBusWpaSupplicant mWpaSupplicant;
 #endif
 
index f2bea4a..b4f755f 100644 (file)
@@ -441,6 +441,11 @@ exit:
     return OTBR_TO_CHIP_ERROR(error);
 }
 
+CHIP_ERROR ThreadStackManagerImpl::_GetFactoryAssignedEUI64(uint8_t (&buf)[8])
+{
+    return CHIP_ERROR_NOT_IMPLEMENTED;
+}
+
 CHIP_ERROR ThreadStackManagerImpl::_GetExternalIPv6Address(chip::Inet::IPAddress & addr)
 {
     return CHIP_ERROR_NOT_IMPLEMENTED;
index 2d7bdad..0f286c3 100644 (file)
@@ -86,6 +86,8 @@ public:
 
     CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf);
 
+    CHIP_ERROR _GetFactoryAssignedEUI64(uint8_t (&buf)[8]);
+
     CHIP_ERROR _GetExternalIPv6Address(chip::Inet::IPAddress & addr);
 
     CHIP_ERROR _JoinerStart();
index 701feea..0f452ec 100644 (file)
@@ -1192,7 +1192,7 @@ static void UpdateAdditionalDataCharacteristic(BluezGattCharacteristic1 * charac
     char serialNumber[ConfigurationManager::kMaxSerialNumberLength + 1];
     size_t serialNumberSize  = 0;
     uint16_t lifetimeCounter = 0;
-    BitFlags<uint8_t, AdditionalDataFields> additionalDataFields;
+    BitFlags<AdditionalDataFields> additionalDataFields;
 
 #if CHIP_ENABLE_ROTATING_DEVICE_ID
     err = ConfigurationMgr().GetSerialNumber(serialNumber, sizeof(serialNumber), serialNumberSize);
index f51f76a..cd92004 100644 (file)
@@ -80,6 +80,19 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::OnOpenThreadStateChang
     event.ThreadStateChange.NetDataChanged    = (flags & OT_CHANGED_THREAD_NETDATA) != 0;
     event.ThreadStateChange.ChildNodesChanged = (flags & (OT_CHANGED_THREAD_CHILD_ADDED | OT_CHANGED_THREAD_CHILD_REMOVED)) != 0;
     event.ThreadStateChange.OpenThread.Flags  = flags;
+
+#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
+    if (event.ThreadStateChange.AddressChanged)
+    {
+        const otSrpClientHostInfo * hostInfo =
+            otSrpClientGetHostInfo(static_cast<GenericThreadStackManagerImpl_OpenThread *>(context)->Impl()->OTInstance());
+        if (hostInfo && hostInfo->mName)
+        {
+            static_cast<GenericThreadStackManagerImpl_OpenThread *>(context)->Impl()->_SetupSrpHost(hostInfo->mName);
+        }
+    }
+#endif
+
     PlatformMgr().PostEvent(&event);
 }
 
@@ -818,6 +831,15 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_GetPrimary80215
 };
 
 template <class ImplClass>
+CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_GetFactoryAssignedEUI64(uint8_t (&buf)[8])
+{
+    otExtAddress extendedAddr;
+    otLinkGetFactoryAssignedIeeeEui64(mOTInst, &extendedAddr);
+    memcpy(buf, extendedAddr.m8, sizeof(extendedAddr.m8));
+    return CHIP_NO_ERROR;
+};
+
+template <class ImplClass>
 CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_GetExternalIPv6Address(chip::Inet::IPAddress & addr)
 {
     const otNetifAddress * otAddresses = otIp6GetUnicastAddresses(mOTInst);
@@ -875,7 +897,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstanc
     // state change occurs.  Note that we reference the OnOpenThreadStateChange method
     // on the concrete implementation class so that that class can override the default
     // method implementation if it chooses to.
-    otErr = otSetStateChangedCallback(otInst, ImplClass::OnOpenThreadStateChange, NULL);
+    otErr = otSetStateChangedCallback(otInst, ImplClass::OnOpenThreadStateChange, this);
     VerifyOrExit(otErr == OT_ERROR_NONE, err = MapOpenThreadError(otErr));
 
     // Enable automatic assignment of Thread advertised addresses.
@@ -1116,7 +1138,8 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::OnSrpClientStateChange
 
 template <class ImplClass>
 CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_AddSrpService(const char * aInstanceName, const char * aName,
-                                                                               uint16_t aPort, uint32_t aLeaseInterval,
+                                                                               uint16_t aPort, chip::Mdns::TextEntry * aTxtEntries,
+                                                                               size_t aTxtEntiresSize, uint32_t aLeaseInterval,
                                                                                uint32_t aKeyLeaseInterval)
 {
     CHIP_ERROR error                         = CHIP_NO_ERROR;
@@ -1158,6 +1181,29 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_AddSrpService(c
 
     srpService->mService.mPort = aPort;
 
+    // Check if there are some optional text entries to add.
+    if (aTxtEntries && aTxtEntiresSize != 0)
+    {
+        VerifyOrExit(aTxtEntiresSize <= SrpClient::kMaxTxtEntriesNumber, error = CHIP_ERROR_INVALID_LIST_LENGTH);
+
+        srpService->mService.mNumTxtEntries = static_cast<uint8_t>(aTxtEntiresSize);
+
+        for (uint8_t entryId = 0; entryId < aTxtEntiresSize; entryId++)
+        {
+            VerifyOrExit(aTxtEntries[entryId].mDataSize <= SrpClient::kMaxTxtValueSize, error = CHIP_ERROR_BUFFER_TOO_SMALL);
+            VerifyOrExit((strlen(aTxtEntries[entryId].mKey) + 1) <= SrpClient::kMaxTxtKeySize, error = CHIP_ERROR_BUFFER_TOO_SMALL);
+
+            srpService->mTxtEntries[entryId].mValueLength = static_cast<uint8_t>(aTxtEntries[entryId].mDataSize);
+            memcpy(&(srpService->mTxtValueBuffers[entryId][0]), aTxtEntries[entryId].mData, aTxtEntries[entryId].mDataSize);
+            srpService->mTxtEntries[entryId].mValue = &(srpService->mTxtValueBuffers[entryId][0]);
+
+            memcpy(&(srpService->mTxtKeyBuffers[entryId][0]), aTxtEntries[entryId].mKey, strlen(aTxtEntries[entryId].mKey) + 1);
+            srpService->mTxtEntries[entryId].mKey = &(srpService->mTxtKeyBuffers[entryId][0]);
+        }
+
+        srpService->mService.mTxtEntries = srpService->mTxtEntries;
+    }
+
     error = MapOpenThreadError(otSrpClientAddService(mOTInst, &(srpService->mService)));
 
 exit:
@@ -1214,11 +1260,13 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_SetupSrpHost(co
     error = MapOpenThreadError(otSrpClientSetHostName(mOTInst, aHostName));
     SuccessOrExit(error);
 
-    error = ThreadStackMgr().GetExternalIPv6Address(hostAddress);
-    SuccessOrExit(error);
-
-    memcpy(&mSrpClient.mHostAddress.mFields.m32, hostAddress.Addr, sizeof(hostAddress.Addr));
-    error = MapOpenThreadError(otSrpClientSetHostAddresses(mOTInst, &mSrpClient.mHostAddress, 1));
+    // Check if device has any external IPv6 assigned. If not, host will be set without IPv6 addresses
+    // and updated later on.
+    if (ThreadStackMgr().GetExternalIPv6Address(hostAddress) == CHIP_NO_ERROR)
+    {
+        memcpy(&mSrpClient.mHostAddress.mFields.m32, hostAddress.Addr, sizeof(hostAddress.Addr));
+        error = MapOpenThreadError(otSrpClientSetHostAddresses(mOTInst, &mSrpClient.mHostAddress, 1));
+    }
 
 exit:
     Impl()->UnlockThreadStack();
index b6b7972..e536141 100644 (file)
@@ -32,6 +32,8 @@
 #include <openthread/srp_client.h>
 #endif
 
+#include <lib/mdns/platform/Mdns.h>
+
 namespace chip {
 namespace DeviceLayer {
 
@@ -87,13 +89,14 @@ protected:
     CHIP_ERROR _GetAndLogThreadTopologyMinimal(void);
     CHIP_ERROR _GetAndLogThreadTopologyFull(void);
     CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf);
+    CHIP_ERROR _GetFactoryAssignedEUI64(uint8_t (&buf)[8]);
     CHIP_ERROR _GetExternalIPv6Address(chip::Inet::IPAddress & addr);
     void _OnWoBLEAdvertisingStart(void);
     void _OnWoBLEAdvertisingStop(void);
 
 #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
-    CHIP_ERROR _AddSrpService(const char * aInstanceName, const char * aName, uint16_t aPort, uint32_t aLeaseInterval,
-                              uint32_t aKeyLeaseInterval);
+    CHIP_ERROR _AddSrpService(const char * aInstanceName, const char * aName, uint16_t aPort, chip::Mdns::TextEntry * aTxtEntries,
+                              size_t aTxtEntiresSize, uint32_t aLeaseInterval, uint32_t aKeyLeaseInterval);
     CHIP_ERROR _RemoveSrpService(const char * aInstanceName, const char * aName);
     CHIP_ERROR _SetupSrpHost(const char * aHostName);
 #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
@@ -122,12 +125,18 @@ private:
         static constexpr uint8_t kMaxInstanceNameSize = 64;
         static constexpr uint8_t kMaxNameSize         = 16;
         static constexpr uint8_t kMaxHostNameSize     = 32;
+        static constexpr uint8_t kMaxTxtEntriesNumber = 4;
+        static constexpr uint8_t kMaxTxtValueSize     = 255;
+        static constexpr uint8_t kMaxTxtKeySize       = 16;
 
         struct Service
         {
             otSrpClientService mService;
             char mInstanceName[kMaxInstanceNameSize];
             char mName[kMaxNameSize];
+            otDnsTxtEntry mTxtEntries[kMaxTxtEntriesNumber];
+            uint8_t mTxtValueBuffers[kMaxTxtEntriesNumber][kMaxTxtValueSize];
+            char mTxtKeyBuffers[kMaxTxtEntriesNumber][kMaxTxtKeySize];
         };
 
         char mHostName[kMaxHostNameSize];
diff --git a/src/platform/OpenThread/MdnsImpl.cpp b/src/platform/OpenThread/MdnsImpl.cpp
new file mode 100644 (file)
index 0000000..4652512
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ *
+ *    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 "lib/mdns/platform/Mdns.h"
+
+#include <platform/CHIPDeviceLayer.h>
+
+using namespace ::chip::DeviceLayer;
+
+namespace chip {
+namespace Mdns {
+
+CHIP_ERROR ChipMdnsInit(MdnsAsyncReturnCallback initCallback, MdnsAsyncReturnCallback errorCallback, void * context)
+{
+    // Intentionally empty
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR ChipMdnsSetHostname(const char * hostname)
+{
+    return ThreadStackMgr().SetupSrpHost(hostname);
+}
+
+const char * GetProtocolString(MdnsServiceProtocol protocol)
+{
+    return protocol == MdnsServiceProtocol::kMdnsProtocolUdp ? "_udp" : "_tcp";
+}
+
+CHIP_ERROR ChipMdnsPublishService(const MdnsService * service)
+{
+    char serviceType[kMdnsTypeMaxSize + kMdnsProtocolTextMaxSize + 1];
+    snprintf(serviceType, sizeof(serviceType), "%s.%s", service->mType, GetProtocolString(service->mProtocol));
+
+    return ThreadStackMgr().AddSrpService(service->mName, serviceType, service->mPort, service->mTextEntries,
+                                          service->mTextEntrySize);
+}
+
+CHIP_ERROR ChipMdnsStopPublish()
+{
+    return CHIP_ERROR_NOT_IMPLEMENTED;
+}
+
+CHIP_ERROR ChipMdnsBrowse(const char * type, MdnsServiceProtocol protocol, Inet::IPAddressType addressType,
+                          Inet::InterfaceId interface, MdnsBrowseCallback callback, void * context)
+{
+    return CHIP_ERROR_NOT_IMPLEMENTED;
+}
+
+CHIP_ERROR ChipMdnsResolve(MdnsService * browseResult, Inet::InterfaceId interface, MdnsResolveCallback callback, void * context)
+{
+    return CHIP_ERROR_NOT_IMPLEMENTED;
+}
+
+} // namespace Mdns
+} // namespace chip
index 7396d48..e1845a7 100644 (file)
@@ -92,8 +92,8 @@ CHIP_ERROR BLEManagerImpl::_Init()
     CHIP_ERROR err;
 
     mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
-    mFlags       = CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? kFlag_AdvertisingEnabled : 0;
-    mGAPConns    = 0;
+    mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
+    mGAPConns = 0;
 
     memset(mSubscribedConns, 0, sizeof(mSubscribedConns));
 
@@ -128,16 +128,16 @@ void BLEManagerImpl::DriveBLEState()
     ChipLogDetail(DeviceLayer, "In DriveBLEState");
 
     // Perform any initialization actions that must occur after the CHIP task is running.
-    if (!GetFlag(mFlags, kFlag_AsyncInitCompleted))
+    if (!mFlags.Has(Flags::kAsyncInitCompleted))
     {
-        SetFlag(mFlags, kFlag_AsyncInitCompleted);
+        mFlags.Set(Flags::kAsyncInitCompleted);
 
         // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled,
         // disable CHIPoBLE advertising if the device is fully provisioned.
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
@@ -145,7 +145,7 @@ void BLEManagerImpl::DriveBLEState()
 
     // If the application has enabled CHIPoBLE and BLE advertising...
     if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled &&
-        GetFlag(mFlags, kFlag_AdvertisingEnabled)
+        mFlags.Has(Flags::kAdvertisingEnabled)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION
         // and no connections are active...
         && (NumConnections() == 0)
@@ -154,7 +154,7 @@ void BLEManagerImpl::DriveBLEState()
     {
         // Start/re-start advertising if not already advertising, or if the
         // advertising state needs to be refreshed.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_AdvertisingRefreshNeeded))
+        if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kAdvertisingRefreshNeeded))
         {
             err = StartAdvertising();
             SuccessOrExit(err);
@@ -186,7 +186,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     CHIP_ERROR err;
 
     const char * deviceName   = bt_get_name();
-    const uint8_t advFlags    = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR;
+    const uint8_t advFlags    = BT_LE_AD_LIMITED | BT_LE_AD_NO_BREDR;
     bt_le_adv_param advParams = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, GetAdvertisingInterval(),
                                                      CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL, nullptr);
 
@@ -204,7 +204,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
 
     // If necessary, inform the ThreadStackManager that CHIPoBLE advertising is about to start.
 #if CHIP_DEVICE_CONFIG_ENABLE_THREAD
-    if (!GetFlag(mFlags, kFlag_Advertising))
+    if (!mFlags.Has(Flags::kAdvertising))
     {
         ThreadStackMgr().OnCHIPoBLEAdvertisingStart();
     }
@@ -225,11 +225,11 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err));
 
     // Transition to the Advertising state...
-    if (!GetFlag(mFlags, kFlag_Advertising))
+    if (!mFlags.Has(Flags::kAdvertising))
     {
         ChipLogProgress(DeviceLayer, "CHIPoBLE advertising started");
 
-        SetFlag(mFlags, kFlag_Advertising);
+        mFlags.Set(Flags::kAdvertising);
 
         // Post a CHIPoBLEAdvertisingChange(Started) event.
         {
@@ -255,9 +255,9 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
     VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err));
 
     // Transition to the not Advertising state...
-    if (GetFlag(mFlags, kFlag_Advertising))
+    if (mFlags.Has(Flags::kAdvertising))
     {
-        ClearFlag(mFlags, kFlag_Advertising);
+        mFlags.Clear(Flags::kAdvertising);
 
         ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");
 
@@ -305,11 +305,11 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kAdvertisingEnabled) != val)
     {
         ChipLogDetail(DeviceLayer, "SetAdvertisingEnabled(%s)", val ? "true" : "false");
 
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+        mFlags.Set(Flags::kAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -323,11 +323,11 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kFastAdvertisingEnabled) != val)
     {
         ChipLogDetail(DeviceLayer, "SetFastAdvertisingEnabled(%s)", val ? "true" : "false");
 
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -372,7 +372,7 @@ CHIP_ERROR BLEManagerImpl::HandleGAPConnect(const ChipDeviceEvent * event)
 
     ChipLogProgress(DeviceLayer, "Current number of connections: %" PRIu16 "/%" PRIu16, NumConnections(), CONFIG_BT_MAX_CONN);
 
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+    mFlags.Set(Flags::kAdvertisingRefreshNeeded);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 
     bt_conn_unref(connEvent->BtConn);
@@ -418,7 +418,7 @@ exit:
 
     // Force a reconfiguration of advertising in case we switched to non-connectable mode when
     // the BLE connection was established.
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+    mFlags.Set(Flags::kAdvertisingRefreshNeeded);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
 
     return CHIP_NO_ERROR;
@@ -530,13 +530,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
 
         // Force the advertising state to be refreshed to reflect new provisioning state.
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
 
         DriveBLEState();
 
@@ -674,7 +674,7 @@ bool BLEManagerImpl::UnsetSubscribed(bt_conn * conn)
 
 uint32_t BLEManagerImpl::GetAdvertisingInterval()
 {
-    return (NumConnections() == 0 && !ConfigurationMgr().IsFullyProvisioned()) || GetFlag(mFlags, kFlag_FastAdvertisingEnabled)
+    return (NumConnections() == 0 && !ConfigurationMgr().IsFullyProvisioned()) || mFlags.Has(Flags::kFastAdvertisingEnabled)
         ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
         : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL;
 }
index d7fe37f..9576137 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -93,19 +93,19 @@ private:
 
     // ===== Private members reserved for use by this class only.
 
-    enum
+    enum class Flags : uint8_t
     {
-        kFlag_AsyncInitCompleted     = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
-        kFlag_AdvertisingEnabled     = 0x0002, /**< The application has enabled CHIPoBLE advertising. */
-        kFlag_FastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */
-        kFlag_Advertising            = 0x0008, /**< The system is currently CHIPoBLE advertising. */
-        kFlag_AdvertisingRefreshNeeded =
+        kAsyncInitCompleted     = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
+        kAdvertisingEnabled     = 0x0002, /**< The application has enabled CHIPoBLE advertising. */
+        kFastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */
+        kAdvertising            = 0x0008, /**< The system is currently CHIPoBLE advertising. */
+        kAdvertisingRefreshNeeded =
             0x0010, /**< The advertising state/configuration has changed, but the SoftDevice has yet to be updated. */
     };
 
     struct ServiceData;
 
-    uint16_t mFlags;
+    BitFlags<Flags> mFlags;
     uint16_t mGAPConns;
     CHIPoBLEServiceMode mServiceMode;
     bool mSubscribedConns[CONFIG_BT_MAX_CONN];
@@ -182,17 +182,17 @@ inline BLEManager::CHIPoBLEServiceMode BLEManagerImpl::_GetCHIPoBLEServiceMode(v
 
 inline bool BLEManagerImpl::_IsAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
+    return mFlags.Has(Flags::kAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsFastAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
+    return mFlags.Has(Flags::kFastAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsAdvertising(void)
 {
-    return GetFlag(mFlags, kFlag_Advertising);
+    return mFlags.Has(Flags::kAdvertising);
 }
 
 } // namespace Internal
diff --git a/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp b/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp
deleted file mode 100644 (file)
index eb515eb..0000000
+++ /dev/null
@@ -1,817 +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.
- */
-
-/**
- *    @file
- *          Provides an implementation of the BLEManager singleton object
- *          for Zephyr platforms.
- */
-
-#ifndef GENERIC_BLE_MANAGER_IMPL_ZEPHYR_IPP
-#define GENERIC_BLE_MANAGER_IMPL_ZEPHYR_IPP
-
-#include <platform/Zephyr/GenericBLEManagerImpl_Zephyr.h>
-
-#include <ble/CHIPBleServiceData.h>
-#include <platform/internal/BLEManager.h>
-#include <support/CodeUtils.h>
-#include <support/logging/CHIPLogging.h>
-
-#include <logging/log.h>
-#include <sys/byteorder.h>
-#include <sys/util.h>
-
-LOG_MODULE_DECLARE(chip);
-
-using namespace ::chip;
-using namespace ::chip::Ble;
-using namespace ::chip::System;
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
-template class GenericBLEManagerImpl_Zephyr<BLEManagerImpl>;
-
-namespace {
-
-const bt_uuid_128 UUID128_CHIPoBLEChar_RX =
-    BT_UUID_INIT_128(0x11, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18);
-const bt_uuid_128 UUID128_CHIPoBLEChar_TX =
-    BT_UUID_INIT_128(0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18);
-bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFEAF);
-
-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 } };
-
-_bt_gatt_ccc CHIPoBLEChar_TX_CCC =
-    BT_GATT_CCC_INITIALIZER(nullptr, GenericBLEManagerImpl_Zephyr<BLEManagerImpl>::HandleTXCCCWrite, nullptr);
-
-// clang-format off
-
-BT_GATT_SERVICE_DEFINE(CHIPoBLE_Service,
-    BT_GATT_PRIMARY_SERVICE(&UUID16_CHIPoBLEService.uuid),
-        BT_GATT_CHARACTERISTIC(&UUID128_CHIPoBLEChar_RX.uuid,
-                               BT_GATT_CHRC_WRITE | BT_GATT_CHRC_WRITE_WITHOUT_RESP,
-                               BT_GATT_PERM_READ | BT_GATT_PERM_WRITE,
-                               nullptr, GenericBLEManagerImpl_Zephyr<BLEManagerImpl>::HandleRXWrite, nullptr),
-        BT_GATT_CHARACTERISTIC(&UUID128_CHIPoBLEChar_TX.uuid,
-                               BT_GATT_CHRC_INDICATE,
-                               BT_GATT_PERM_NONE,
-                               nullptr, nullptr, nullptr),
-        BT_GATT_CCC_MANAGED(&CHIPoBLEChar_TX_CCC, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE)
-);
-
-// clang-format on
-
-// Index of the CCC descriptor in the CHIPoBLE_Service array of attributes.
-// This value should be adjusted accordingly if the service declaration changes.
-constexpr int kCHIPoBLE_CCC_AttributeIndex = 3;
-
-} // unnamed namespace
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::_Init()
-{
-    CHIP_ERROR err;
-
-    mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
-    mFlags       = CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? kFlag_AdvertisingEnabled : 0;
-    mGAPConns    = 0;
-
-    memset(mSubscribedConns, 0, sizeof(mSubscribedConns));
-
-    err = bt_enable(NULL);
-    VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err));
-
-    memset(&mConnCallbacks, 0, sizeof(mConnCallbacks));
-    mConnCallbacks.connected    = HandleConnect;
-    mConnCallbacks.disconnected = HandleDisconnect;
-
-    bt_conn_cb_register(&mConnCallbacks);
-
-    // Initialize the CHIP BleLayer.
-    err = BleLayer::Init(this, this, &SystemLayer);
-    SuccessOrExit(err);
-
-    PlatformMgr().ScheduleWork(DriveBLEState, 0);
-
-exit:
-    return err;
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::DriveBLEState(intptr_t arg)
-{
-    BLEMgrImpl().DriveBLEState();
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::DriveBLEState()
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    ChipLogDetail(DeviceLayer, "In DriveBLEState");
-
-    // Perform any initialization actions that must occur after the CHIP task is running.
-    if (!GetFlag(mFlags, kFlag_AsyncInitCompleted))
-    {
-        SetFlag(mFlags, kFlag_AsyncInitCompleted);
-
-        // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled,
-        // disable CHIPoBLE advertising if the device is fully provisioned.
-#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
-        if (ConfigurationMgr().IsFullyProvisioned())
-        {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
-            ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
-        }
-#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
-    }
-
-    // If the application has enabled CHIPoBLE and BLE advertising...
-    if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled &&
-        GetFlag(mFlags, kFlag_AdvertisingEnabled)
-#if CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION
-        // and no connections are active...
-        && (NumConnections() == 0)
-#endif
-    )
-    {
-        // Start/re-start advertising if not already advertising, or if the
-        // advertising state needs to be refreshed.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_AdvertisingRefreshNeeded))
-        {
-            err = StartAdvertising();
-            SuccessOrExit(err);
-        }
-    }
-    // Otherwise, stop advertising if currently active.
-    else
-    {
-        err = StopAdvertising();
-        SuccessOrExit(err);
-    }
-
-exit:
-    if (err != CHIP_NO_ERROR)
-    {
-        ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err));
-        mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled;
-    }
-}
-
-template <class ImplClass>
-struct GenericBLEManagerImpl_Zephyr<ImplClass>::ServiceData
-{
-    uint8_t uuid[2];
-    ChipBLEDeviceIdentificationInfo deviceIdInfo;
-} __attribute__((packed));
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::StartAdvertising(void)
-{
-    CHIP_ERROR err;
-
-    const char * deviceName   = bt_get_name();
-    const uint8_t advFlags    = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR;
-    bt_le_adv_param advParams = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, GetAdvertisingInterval(),
-                                                     CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL, nullptr);
-
-    // Define advertising data
-    ServiceData serviceData;
-    bt_data ad[] = { BT_DATA(BT_DATA_FLAGS, &advFlags, sizeof(advFlags)),
-                     BT_DATA(BT_DATA_SVC_DATA16, &serviceData, sizeof(serviceData)),
-                     BT_DATA(BT_DATA_NAME_COMPLETE, deviceName, static_cast<uint8_t>(strlen(deviceName))) };
-
-    // Initialize service data
-    static_assert(sizeof(serviceData) == 9, "Size of BLE advertisement data changed! Was that intentional?");
-    chip::Encoding::LittleEndian::Put16(serviceData.uuid, UUID16_CHIPoBLEService.val);
-    err = ConfigurationMgr().GetBLEDeviceIdentificationInfo(serviceData.deviceIdInfo);
-    SuccessOrExit(err);
-
-    // If necessary, inform the ThreadStackManager that CHIPoBLE advertising is about to start.
-#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
-    if (!GetFlag(mFlags, kFlag_Advertising))
-    {
-        ThreadStackMgr().OnCHIPoBLEAdvertisingStart();
-    }
-#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD
-
-    // Restart advertising
-    err = bt_le_adv_stop();
-    VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err));
-
-    err = bt_le_adv_start(&advParams, ad, ARRAY_SIZE(ad), nullptr, 0u);
-    if (err == -ENOMEM)
-    {
-        // No free connection objects for connectable advertiser. Advertise as non-connectable instead.
-        advParams.options &= ~BT_LE_ADV_OPT_CONNECTABLE;
-        err = bt_le_adv_start(&advParams, ad, ARRAY_SIZE(ad), nullptr, 0u);
-    }
-
-    VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err));
-
-    // Transition to the Advertising state...
-    if (!GetFlag(mFlags, kFlag_Advertising))
-    {
-        ChipLogProgress(DeviceLayer, "CHIPoBLE advertising started");
-
-        SetFlag(mFlags, kFlag_Advertising);
-
-        // Post a CHIPoBLEAdvertisingChange(Started) event.
-        {
-            ChipDeviceEvent advChange;
-            advChange.Type                             = DeviceEventType::kCHIPoBLEAdvertisingChange;
-            advChange.CHIPoBLEAdvertisingChange.Result = kActivity_Started;
-            PlatformMgr().PostEvent(&advChange);
-        }
-
-        // Start timer to disable CHIPoBLE advertisement after timeout expiration
-        SystemLayer.StartTimer(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT, HandleBLEAdvertisementTimeout, this);
-    }
-
-exit:
-    return err;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::StopAdvertising(void)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    err = bt_le_adv_stop();
-    VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err));
-
-    // Transition to the not Advertising state...
-    if (GetFlag(mFlags, kFlag_Advertising))
-    {
-        ClearFlag(mFlags, kFlag_Advertising);
-
-        ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");
-
-#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
-        // Directly inform the ThreadStackManager that CHIPoBLE advertising has stopped.
-        ThreadStackMgr().OnCHIPoBLEAdvertisingStop();
-#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD
-
-        // Post a CHIPoBLEAdvertisingChange(Stopped) event.
-        {
-            ChipDeviceEvent advChange;
-            advChange.Type                             = DeviceEventType::kCHIPoBLEAdvertisingChange;
-            advChange.CHIPoBLEAdvertisingChange.Result = kActivity_Stopped;
-            PlatformMgr().PostEvent(&advChange);
-        }
-
-        // Cancel timer event disabling CHIPoBLE advertisement after timeout expiration
-        SystemLayer.CancelTimer(HandleBLEAdvertisementTimeout, this);
-    }
-
-exit:
-    return err;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::_SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    VerifyOrExit(val != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
-
-    if (val != mServiceMode)
-    {
-        mServiceMode = val;
-        PlatformMgr().ScheduleWork(DriveBLEState, 0);
-    }
-
-exit:
-    return err;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::_SetAdvertisingEnabled(bool val)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
-
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
-    {
-        ChipLogDetail(DeviceLayer, "SetAdvertisingEnabled(%s)", val ? "true" : "false");
-
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
-        PlatformMgr().ScheduleWork(DriveBLEState, 0);
-    }
-
-exit:
-    return err;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::_SetFastAdvertisingEnabled(bool val)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
-
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
-    {
-        ChipLogDetail(DeviceLayer, "SetFastAdvertisingEnabled(%s)", val ? "true" : "false");
-
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
-        PlatformMgr().ScheduleWork(DriveBLEState, 0);
-    }
-
-exit:
-    return err;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::_GetDeviceName(char * buf, size_t bufSize)
-{
-    size_t len = bufSize - 1;
-
-    strncpy(buf, bt_get_name(), len);
-    buf[len] = 0;
-
-    return CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::_SetDeviceName(const char * deviceName)
-{
-    if (mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported)
-    {
-        return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
-    }
-
-    ChipLogDetail(DeviceLayer, "Device name set to: %s", deviceName);
-    return MapErrorZephyr(bt_set_name(deviceName));
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::HandleGAPConnect(const ChipDeviceEvent * event)
-{
-    const BleConnEventType * connEvent = &event->Platform.BleConnEvent;
-
-    if (connEvent->HciResult == BT_HCI_ERR_SUCCESS)
-    {
-        ChipLogProgress(DeviceLayer, "BLE connection established (ConnId: 0x%02" PRIx16 ")", bt_conn_index(connEvent->BtConn));
-        mGAPConns++;
-    }
-    else
-    {
-        ChipLogProgress(DeviceLayer, "BLE connection failed (reason: 0x%02" PRIx16 ")", connEvent->HciResult);
-    }
-
-    ChipLogProgress(DeviceLayer, "Current number of connections: %" PRIu16 "/%" PRIu16, NumConnections(), CONFIG_BT_MAX_CONN);
-
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-    PlatformMgr().ScheduleWork(DriveBLEState, 0);
-
-    bt_conn_unref(connEvent->BtConn);
-
-    return CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::HandleGAPDisconnect(const ChipDeviceEvent * event)
-{
-    const BleConnEventType * connEvent = &event->Platform.BleConnEvent;
-
-    ChipLogProgress(DeviceLayer, "BLE GAP connection terminated (reason 0x%02" PRIx16 ")", connEvent->HciResult);
-
-    mGAPConns--;
-
-    // If indications were enabled for this connection, record that they are now disabled and
-    // notify the BLE Layer of a disconnect.
-    if (UnsetSubscribed(connEvent->BtConn))
-    {
-        CHIP_ERROR disconReason;
-        switch (connEvent->HciResult)
-        {
-        case BT_HCI_ERR_REMOTE_USER_TERM_CONN:
-            disconReason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED;
-            break;
-        case BT_HCI_ERR_LOCALHOST_TERM_CONN:
-            disconReason = BLE_ERROR_APP_CLOSED_CONNECTION;
-            break;
-        default:
-            disconReason = BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT;
-            break;
-        }
-        HandleConnectionError(connEvent->BtConn, disconReason);
-    }
-
-    // Unref bt_conn before scheduling DriveBLEState.
-    bt_conn_unref(connEvent->BtConn);
-
-    ChipLogProgress(DeviceLayer, "Current number of connections: %" PRIu16 "/%" PRIu16, NumConnections(), CONFIG_BT_MAX_CONN);
-
-    // Force a reconfiguration of advertising in case we switched to non-connectable mode when
-    // the BLE connection was established.
-    SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-    PlatformMgr().ScheduleWork(DriveBLEState, 0);
-
-    return CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::HandleTXCharCCCDWrite(const ChipDeviceEvent * event)
-{
-    const BleCCCWriteEventType * writeEvent = &event->Platform.BleCCCWriteEvent;
-
-    ChipLogDetail(DeviceLayer, "ConnId: 0x%02" PRIx16 ", New CCCD value: 0x%04" PRIx16, bt_conn_index(writeEvent->BtConn),
-                  writeEvent->Value);
-
-    // If the client has requested to enabled indications and if it is not yet subscribed
-    if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn))
-    {
-        // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter.
-        HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX);
-
-        ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02" PRIx16 ", GATT MTU: %" PRIu16 ")",
-                        bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn));
-
-        // Post a CHIPoBLEConnectionEstablished event to the DeviceLayer and the application.
-        {
-            ChipDeviceEvent conEstEvent;
-            conEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished;
-            PlatformMgr().PostEvent(&conEstEvent);
-        }
-    }
-    else
-    {
-        if (UnsetSubscribed(writeEvent->BtConn))
-        {
-            HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX);
-        }
-    }
-
-    bt_conn_unref(writeEvent->BtConn);
-
-    return CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::HandleRXCharWrite(const ChipDeviceEvent * event)
-{
-    const BleC1WriteEventType * c1WriteEvent = &event->Platform.BleC1WriteEvent;
-
-    ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02" PRIx16 ")",
-                  bt_conn_index(c1WriteEvent->BtConn));
-
-    PacketBufferHandle data_ForNow;
-    data_ForNow.Adopt(c1WriteEvent->Data);
-    HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, std::move(data_ForNow));
-    bt_conn_unref(c1WriteEvent->BtConn);
-
-    return CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericBLEManagerImpl_Zephyr<ImplClass>::HandleTXComplete(const ChipDeviceEvent * event)
-{
-    const BleC2IndDoneEventType * c2IndDoneEvent = &event->Platform.BleC2IndDoneEvent;
-
-    ChipLogDetail(DeviceLayer, "Indication for CHIPoBLE TX characteristic done (ConnId 0x%02" PRIx16 ", result 0x%02" PRIx16 ")",
-                  bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result);
-
-    // Signal the BLE Layer that the outstanding indication is complete.
-    HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX);
-    bt_conn_unref(c2IndDoneEvent->BtConn);
-
-    return CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::HandleBLEAdvertisementTimeout(System::Layer * layer, void * param,
-                                                                            System::Error error)
-{
-    BLEMgr().SetAdvertisingEnabled(false);
-    ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because of timeout expired");
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::_OnPlatformEvent(const ChipDeviceEvent * event)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    switch (event->Type)
-    {
-    case DeviceEventType::kPlatformZephyrBleConnected:
-        err = HandleGAPConnect(event);
-        break;
-
-    case DeviceEventType::kPlatformZephyrBleDisconnected:
-        err = HandleGAPDisconnect(event);
-        break;
-
-    case DeviceEventType::kPlatformZephyrBleCCCWrite:
-        err = HandleTXCharCCCDWrite(event);
-        break;
-
-    case DeviceEventType::kPlatformZephyrBleC1WriteEvent:
-        err = HandleRXCharWrite(event);
-        break;
-
-    case DeviceEventType::kPlatformZephyrBleC2IndDoneEvent:
-        err = HandleTXComplete(event);
-        break;
-
-    case DeviceEventType::kFabricMembershipChange:
-    case DeviceEventType::kServiceProvisioningChange:
-    case DeviceEventType::kAccountPairingChange:
-
-        // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the
-        // device's provisioning state, then automatically disable CHIPoBLE advertising if the device
-        // is now fully provisioned.
-#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
-        if (ConfigurationMgr().IsFullyProvisioned())
-        {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
-            ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
-        }
-#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
-
-        // Force the advertising state to be refreshed to reflect new provisioning state.
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
-
-        DriveBLEState();
-
-        break;
-
-    default:
-        break;
-    }
-
-    if (err != CHIP_NO_ERROR)
-    {
-        ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err));
-        mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled;
-        PlatformMgr().ScheduleWork(DriveBLEState, 0);
-    }
-}
-
-template <class ImplClass>
-uint16_t GenericBLEManagerImpl_Zephyr<ImplClass>::_NumConnections(void)
-{
-    return mGAPConns;
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::CloseConnection(BLE_CONNECTION_OBJECT conId)
-{
-    ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (ConnId %02" PRIx16 ")", bt_conn_index(conId));
-    return bt_conn_disconnect(conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN) == CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-uint16_t GenericBLEManagerImpl_Zephyr<ImplClass>::GetMTU(BLE_CONNECTION_OBJECT conId) const
-{
-    return bt_gatt_get_mtu(conId);
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId,
-                                                                      const ChipBleUUID * charId)
-{
-    ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__);
-    return true;
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId,
-                                                                        const ChipBleUUID * charId)
-{
-    ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__);
-    return true;
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId,
-                                                             const ChipBleUUID * charId, PacketBufferHandle pBuf)
-{
-    CHIP_ERROR err                   = CHIP_NO_ERROR;
-    uint8_t index                    = bt_conn_index(conId);
-    bt_gatt_indicate_params * params = &mIndicateParams[index];
-
-    VerifyOrExit(IsSubscribed(conId) == true, err = CHIP_ERROR_INVALID_ARGUMENT);
-
-    ChipLogDetail(DeviceLayer, "Sending indication for CHIPoBLE TX characteristic (ConnId %u, len %u)", index, pBuf->DataLength());
-
-    params->uuid = nullptr;
-    params->attr = &CHIPoBLE_Service.attrs[kCHIPoBLE_CCC_AttributeIndex];
-    params->func = HandleTXIndicated;
-    params->data = pBuf->Start();
-    params->len  = pBuf->DataLength();
-
-    err = bt_gatt_indicate(conId, params);
-    VerifyOrExit(err == CHIP_NO_ERROR, err = MapErrorZephyr(err));
-
-exit:
-    if (err != CHIP_NO_ERROR)
-    {
-        ChipLogError(DeviceLayer, "GenericBLEManagerImpl_Zephyr<ImplClass>::SendIndication() failed: %s", ErrorStr(err));
-    }
-
-    return err == CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId,
-                                                               const ChipBleUUID * charId, PacketBufferHandle pBuf)
-{
-    ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__);
-    return true;
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::SendReadRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId,
-                                                              const ChipBleUUID * charId, PacketBufferHandle pBuf)
-{
-    ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__);
-    return true;
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::SendReadResponse(BLE_CONNECTION_OBJECT conId, BLE_READ_REQUEST_CONTEXT requestContext,
-                                                               const ChipBleUUID * svcId, const ChipBleUUID * charId)
-{
-    ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__);
-    return true;
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId)
-{
-    // Intentionally empty.
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::IsSubscribed(bt_conn * conn)
-{
-    return mSubscribedConns[bt_conn_index(conn)];
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::SetSubscribed(bt_conn * conn)
-{
-    uint8_t index           = bt_conn_index(conn);
-    bool isSubscribed       = mSubscribedConns[index];
-    mSubscribedConns[index] = true;
-
-    // If we were not subscribed previously, increment the reference counter of the connection.
-    if (!isSubscribed)
-    {
-        bt_conn_ref(conn);
-    }
-
-    return !isSubscribed;
-}
-
-template <class ImplClass>
-bool GenericBLEManagerImpl_Zephyr<ImplClass>::UnsetSubscribed(bt_conn * conn)
-{
-    uint8_t index           = bt_conn_index(conn);
-    bool isSubscribed       = mSubscribedConns[index];
-    mSubscribedConns[index] = false;
-
-    // If we were subscribed previously, decrement the reference counter of the connection.
-    if (isSubscribed)
-    {
-        bt_conn_unref(conn);
-    }
-
-    return isSubscribed;
-}
-
-template <class ImplClass>
-uint32_t GenericBLEManagerImpl_Zephyr<ImplClass>::GetAdvertisingInterval()
-{
-    return (NumConnections() == 0 && !ConfigurationMgr().IsFullyProvisioned()) || GetFlag(mFlags, kFlag_FastAdvertisingEnabled)
-        ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
-        : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL;
-}
-
-template <class ImplClass>
-ssize_t GenericBLEManagerImpl_Zephyr<ImplClass>::HandleRXWrite(struct bt_conn * conId, const struct bt_gatt_attr * attr,
-                                                               const void * buf, uint16_t len, uint16_t offset, uint8_t flags)
-{
-    ChipDeviceEvent event;
-    PacketBufferHandle packetBuf = PacketBuffer::NewWithAvailableSize(len);
-
-    // Unfortunately the Zephyr logging macros end up assigning uint16_t
-    // variables to uint16_t:10 fields, which triggers integer conversion
-    // warnings.  And treating the Zephyr headers as system headers does not
-    // help, apparently.  Just turn off that warning around this log call.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-    LOG_HEXDUMP_DBG(buf, len, "Rx char write");
-#pragma GCC diagnostic pop
-
-    // If successful...
-    if (!packetBuf.IsNull())
-    {
-        // Copy the characteristic value into the packet buffer.
-        memcpy(packetBuf->Start(), buf, len);
-        packetBuf->SetDataLength(len);
-
-        // Arrange to post a CHIPoBLERXWriteEvent event to the CHIP queue.
-        event.Type                            = DeviceEventType::kPlatformZephyrBleC1WriteEvent;
-        event.Platform.BleC1WriteEvent.BtConn = bt_conn_ref(conId);
-        event.Platform.BleC1WriteEvent.Data   = packetBuf.Release_ForNow();
-    }
-
-    // If we failed to allocate a buffer, post a kPlatformZephyrBleOutOfBuffersEvent event.
-    else
-    {
-        event.Type = DeviceEventType::kPlatformZephyrBleOutOfBuffersEvent;
-    }
-
-    PlatformMgr().PostEvent(&event);
-
-    return len;
-}
-
-template <class ImplClass>
-ssize_t GenericBLEManagerImpl_Zephyr<ImplClass>::HandleTXCCCWrite(struct bt_conn * conId, const struct bt_gatt_attr * attr,
-                                                                  uint16_t value)
-{
-    ChipDeviceEvent event;
-
-    if (value != BT_GATT_CCC_INDICATE && value != 0)
-    {
-        return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED);
-    }
-
-    event.Type                             = DeviceEventType::kPlatformZephyrBleCCCWrite;
-    event.Platform.BleCCCWriteEvent.BtConn = bt_conn_ref(conId);
-    event.Platform.BleCCCWriteEvent.Value  = value;
-
-    PlatformMgr().PostEvent(&event);
-
-    return sizeof(value);
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::HandleTXIndicated(struct bt_conn * conId, const struct bt_gatt_attr * attr,
-                                                                uint8_t err)
-{
-    ChipDeviceEvent event;
-
-    event.Type                              = DeviceEventType::kPlatformZephyrBleC2IndDoneEvent;
-    event.Platform.BleC2IndDoneEvent.BtConn = bt_conn_ref(conId);
-    event.Platform.BleC2IndDoneEvent.Result = err;
-
-    PlatformMgr().PostEvent(&event);
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::HandleConnect(struct bt_conn * conId, uint8_t err)
-{
-    ChipDeviceEvent event;
-
-    event.Type                            = DeviceEventType::kPlatformZephyrBleConnected;
-    event.Platform.BleConnEvent.BtConn    = bt_conn_ref(conId);
-    event.Platform.BleConnEvent.HciResult = err;
-
-    PlatformMgr().PostEvent(&event);
-}
-
-template <class ImplClass>
-void GenericBLEManagerImpl_Zephyr<ImplClass>::HandleDisconnect(struct bt_conn * conId, uint8_t reason)
-{
-    ChipDeviceEvent event;
-
-    event.Type                            = DeviceEventType::kPlatformZephyrBleDisconnected;
-    event.Platform.BleConnEvent.BtConn    = bt_conn_ref(conId);
-    event.Platform.BleConnEvent.HciResult = reason;
-
-    PlatformMgr().PostEvent(&event);
-}
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
-
-#endif // GENERIC_BLE_MANAGER_IMPL_ZEPHYR_IPP
diff --git a/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.h b/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.h
deleted file mode 100644 (file)
index a3cb16f..0000000
+++ /dev/null
@@ -1,169 +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.
- */
-
-/**
- *    @file
- *          Provides an implementation of the BLEManager singleton object
- *          for the Zephyr platforms.
- */
-
-#pragma once
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/conn.h>
-#include <bluetooth/gatt.h>
-
-#include <support/logging/CHIPLogging.h>
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-using namespace chip::Ble;
-
-/**
- * Template implementation of the GenericBLEManagerImpl_Zephyr singleton object for the Zephyr platforms.
- */
-template <class ImplClass>
-class GenericBLEManagerImpl_Zephyr : public BLEManager,
-                                     private BleLayer,
-                                     private BlePlatformDelegate,
-                                     private BleApplicationDelegate
-{
-    // Allow the BLEManager interface class to delegate method calls to
-    // the implementation methods provided by this class.
-    friend BLEManager;
-
-private:
-    // ===== Members that implement the BLEManager internal interface.
-
-    CHIP_ERROR _Init(void);
-    CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
-    CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
-    bool _IsAdvertisingEnabled(void);
-    CHIP_ERROR _SetAdvertisingEnabled(bool val);
-    bool _IsFastAdvertisingEnabled(void);
-    CHIP_ERROR _SetFastAdvertisingEnabled(bool val);
-    bool _IsAdvertising(void);
-    CHIP_ERROR _GetDeviceName(char * buf, size_t bufSize);
-    CHIP_ERROR _SetDeviceName(const char * deviceName);
-    uint16_t _NumConnections(void);
-    void _OnPlatformEvent(const ChipDeviceEvent * event);
-    BleLayer * _GetBleLayer(void);
-
-    // ===== Members that implement virtual methods on BlePlatformDelegate.
-
-    bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId);
-    bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId);
-    bool CloseConnection(BLE_CONNECTION_OBJECT conId);
-    uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const;
-    bool SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId,
-                        PacketBufferHandle pBuf);
-    bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId,
-                          PacketBufferHandle pBuf);
-    bool SendReadRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId,
-                         PacketBufferHandle pBuf);
-    bool SendReadResponse(BLE_CONNECTION_OBJECT conId, BLE_READ_REQUEST_CONTEXT requestContext, const ChipBleUUID * svcId,
-                          const ChipBleUUID * charId);
-
-    // ===== Members that implement virtual methods on BleApplicationDelegate.
-
-    void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId);
-
-    // ===== Private members reserved for use by this class only.
-
-    enum
-    {
-        kFlag_AsyncInitCompleted     = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
-        kFlag_AdvertisingEnabled     = 0x0002, /**< The application has enabled CHIPoBLE advertising. */
-        kFlag_FastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */
-        kFlag_Advertising            = 0x0008, /**< The system is currently CHIPoBLE advertising. */
-        kFlag_AdvertisingRefreshNeeded =
-            0x0010, /**< The advertising state/configuration has changed, but the SoftDevice has yet to be updated. */
-    };
-
-    struct ServiceData;
-
-    uint16_t mFlags;
-    uint16_t mGAPConns;
-    CHIPoBLEServiceMode mServiceMode;
-    bool mSubscribedConns[CONFIG_BT_MAX_CONN];
-    bt_gatt_indicate_params mIndicateParams[CONFIG_BT_MAX_CONN];
-    bt_conn_cb mConnCallbacks;
-
-    void DriveBLEState(void);
-    CHIP_ERROR ConfigureAdvertising(void);
-    CHIP_ERROR StartAdvertising(void);
-    CHIP_ERROR StopAdvertising(void);
-    CHIP_ERROR HandleGAPConnect(const ChipDeviceEvent * event);
-    CHIP_ERROR HandleGAPDisconnect(const ChipDeviceEvent * event);
-    CHIP_ERROR HandleRXCharWrite(const ChipDeviceEvent * event);
-    CHIP_ERROR HandleTXCharCCCDWrite(const ChipDeviceEvent * event);
-    CHIP_ERROR HandleTXComplete(const ChipDeviceEvent * event);
-    bool IsSubscribed(bt_conn * conn);
-    bool SetSubscribed(bt_conn * conn);
-    bool UnsetSubscribed(bt_conn * conn);
-    uint32_t GetAdvertisingInterval();
-
-    static void DriveBLEState(intptr_t arg);
-
-    // Below callbacks run from the system workqueue context and have a limited stack capacity.
-    static void HandleTXIndicated(bt_conn * conn, const bt_gatt_attr * attr, uint8_t err);
-    static void HandleConnect(bt_conn * conn, uint8_t err);
-    static void HandleDisconnect(bt_conn * conn, uint8_t reason);
-    static void HandleBLEAdvertisementTimeout(System::Layer * layer, void * param, System::Error error);
-
-public:
-    // Below callbacks are public in order to be visible from the global scope.
-    static ssize_t HandleRXWrite(bt_conn * conn, const bt_gatt_attr * attr, const void * buf, uint16_t len, uint16_t offset,
-                                 uint8_t flags);
-    static ssize_t HandleTXCCCWrite(bt_conn * conn, const bt_gatt_attr * attr, uint16_t value);
-};
-
-template <class ImplClass>
-inline BleLayer * GenericBLEManagerImpl_Zephyr<ImplClass>::_GetBleLayer()
-{
-    return this;
-}
-
-template <class ImplClass>
-inline BLEManager::CHIPoBLEServiceMode GenericBLEManagerImpl_Zephyr<ImplClass>::_GetCHIPoBLEServiceMode(void)
-{
-    return mServiceMode;
-}
-
-template <class ImplClass>
-inline bool GenericBLEManagerImpl_Zephyr<ImplClass>::_IsAdvertisingEnabled(void)
-{
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
-}
-
-template <class ImplClass>
-inline bool GenericBLEManagerImpl_Zephyr<ImplClass>::_IsFastAdvertisingEnabled(void)
-{
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
-}
-
-template <class ImplClass>
-inline bool GenericBLEManagerImpl_Zephyr<ImplClass>::_IsAdvertising(void)
-{
-    return GetFlag(mFlags, kFlag_Advertising);
-}
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
diff --git a/src/platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.cpp b/src/platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.cpp
deleted file mode 100644 (file)
index d660c38..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *          Contains non-inline method definitions for the
- *          GenericThreadStackManagerImpl_Zephyr<> template.
- */
-
-#ifndef GENERIC_THREAD_STACK_MANAGER_IMPL_ZEPHYR_IPP
-#define GENERIC_THREAD_STACK_MANAGER_IMPL_ZEPHYR_IPP
-
-#include <platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp>
-#include <platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.h>
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
-template class GenericThreadStackManagerImpl_Zephyr<ThreadStackManagerImpl>;
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
-
-#endif // GENERIC_THREAD_STACK_MANAGER_IMPL_ZEPHYR_IPP
diff --git a/src/platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.h b/src/platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.h
deleted file mode 100644 (file)
index b901299..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *          Provides an generic implementation of ThreadStackManager features
- *          for use on Zephyr platforms.
- */
-
-#pragma once
-
-#include <net/openthread.h>
-#include <zephyr.h>
-
-#include <support/logging/CHIPLogging.h>
-
-namespace chip {
-namespace DeviceLayer {
-
-class ThreadStackManagerImpl;
-
-namespace Internal {
-
-/**
- * Provides a generic implementation of ThreadStackManager features that works on Zephyr platforms.
- *
- * This template contains implementations of select features from the ThreadStackManager abstract
- * interface that are suitable for use on Zephyr-based platforms.  It is intended to be
- * inherited, directly or indirectly, by the ThreadStackManagerImpl class, which also appears as
- * the template's ImplClass parameter.
- *
- * Any task using this class must have cooperative scheduling priority.
- */
-template <class ImplClass>
-class GenericThreadStackManagerImpl_Zephyr : public GenericThreadStackManagerImpl_OpenThread<ImplClass>
-{
-public:
-    // ===== Methods that implement the ThreadStackManager abstract interface.
-    CHIP_ERROR _InitThreadStack();
-
-protected:
-    // ===== Methods that implement the ThreadStackManager abstract interface.
-
-    CHIP_ERROR _StartThreadTask();
-    void _LockThreadStack();
-    bool _TryLockThreadStack();
-    void _UnlockThreadStack();
-
-    // ===== Methods that override the GenericThreadStackManagerImpl_OpenThread abstract interface.
-
-    void _ProcessThreadActivity();
-    void _OnCHIPoBLEAdvertisingStart();
-    void _OnCHIPoBLEAdvertisingStop();
-
-private:
-    // ===== Private members for use by this class only.
-
-    inline ImplClass * Impl() { return static_cast<ImplClass *>(this); }
-};
-
-// Instruct the compiler to instantiate the template only when explicitly told to do so.
-extern template class GenericThreadStackManagerImpl_Zephyr<ThreadStackManagerImpl>;
-
-template <class ImplClass>
-CHIP_ERROR GenericThreadStackManagerImpl_Zephyr<ImplClass>::_InitThreadStack()
-{
-    return GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(openthread_get_default_instance());
-}
-
-template <class ImplClass>
-CHIP_ERROR GenericThreadStackManagerImpl_Zephyr<ImplClass>::_StartThreadTask()
-{
-    // Intentionally empty.
-    return CHIP_NO_ERROR;
-}
-
-template <class ImplClass>
-void GenericThreadStackManagerImpl_Zephyr<ImplClass>::_LockThreadStack()
-{
-    openthread_api_mutex_lock(openthread_get_default_context());
-}
-
-template <class ImplClass>
-bool GenericThreadStackManagerImpl_Zephyr<ImplClass>::_TryLockThreadStack()
-{
-    // There's no openthread_api_mutex_try_lock() in Zephyr, so until it's contributed we must use the low-level API
-    return k_mutex_lock(&openthread_get_default_context()->api_lock, K_NO_WAIT) == 0;
-}
-
-template <class ImplClass>
-void GenericThreadStackManagerImpl_Zephyr<ImplClass>::_UnlockThreadStack()
-{
-    openthread_api_mutex_unlock(openthread_get_default_context());
-}
-
-template <class ImplClass>
-void GenericThreadStackManagerImpl_Zephyr<ImplClass>::_ProcessThreadActivity()
-{
-    // Intentionally empty.
-}
-
-template <class ImplClass>
-void GenericThreadStackManagerImpl_Zephyr<ImplClass>::_OnCHIPoBLEAdvertisingStart()
-{
-    ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__);
-}
-
-template <class ImplClass>
-void GenericThreadStackManagerImpl_Zephyr<ImplClass>::_OnCHIPoBLEAdvertisingStop()
-{
-    ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__);
-}
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
index a5476ac..d844c9a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-2021 Project CHIP Authors
  *    Copyright (c) 2019 Nest Labs, Inc.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -113,7 +113,7 @@ CHIP_ERROR BLEManagerImpl::_Init(void)
     /* Register BLE Stack assert handler */
     RegisterAssertCback(AssertHandler);
 
-    mFlags = CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? kFlag_AdvertisingEnabled : 0;
+    mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
 
     mServiceMode             = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
     OnChipBleConnectReceived = HandleIncomingBleConnection;
@@ -137,13 +137,13 @@ CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(BLEManager::CHIPoBLEServiceMo
 
 bool BLEManagerImpl::_IsAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
+    return mFlags.Has(Flags::kAdvertisingEnabled);
 }
 
 /* Post event to app processing loop to begin CHIP advertising */
 CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 {
-    SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+    mFlags.Set(Flags::kAdvertisingEnabled, val);
 
     /* Send event to process state change request */
     return DriveBLEState();
@@ -151,16 +151,16 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 
 bool BLEManagerImpl::_IsFastAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
+    return mFlags.Has(Flags::kFastAdvertisingEnabled);
 }
 
 CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 {
     CHIP_ERROR ret = CHIP_NO_ERROR;
 
-    if (!GetFlag(mFlags, kFlag_FastAdvertisingEnabled))
+    if (!mFlags.Has(Flags::kFastAdvertisingEnabled))
     {
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
 
         /* Send event to process state change request */
         ret = DriveBLEState();
@@ -170,7 +170,7 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
 bool BLEManagerImpl::_IsAdvertising(void)
 {
-    return GetFlag(mFlags, kFlag_Advertising);
+    return mFlags.Has(Flags::kAdvertising);
 }
 
 CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize)
@@ -197,7 +197,7 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
     {
         strncpy(mDeviceName, deviceName, strlen(deviceName));
 
-        SetFlag(mFlags, kFlag_BLEStackGATTNameUpdate, true);
+        mFlags.Set(Flags::kBLEStackGATTNameUpdate);
 
         ret = DriveBLEState();
     }
@@ -409,7 +409,7 @@ void BLEManagerImpl::AdvInit(void)
     ConfigurationMgr().GetBLEDeviceIdentificationInfo(mDeviceIdInfo);
 
     // Verify device name was not already set
-    if (!GetFlag(sInstance.mFlags, kFlag_BLEStackGATTNameSet))
+    if (!sInstance.mFlags.Has(Flags::kBLEStackGATTNameSet))
     {
         /* Default device name is CHIP-<DISCRIMINATOR> */
         deviceDiscriminator = mDeviceIdInfo.GetDeviceDiscriminator();
@@ -758,13 +758,13 @@ void BLEManagerImpl::ProcessEvtHdrMsg(QueuedEvt_t * pMsg)
             /* Advertising flag set, either advertising or fast adv is enabled: Do nothing  */
             /* Advertising flag not set, neither advertising nor fast adv is enabled: do nothing */
             /* Advertising flag not set, either advertising or fast adv is enabled: Turn on */
-            if (!GetFlag(sInstance.mFlags, kFlag_Advertising))
+            if (!sInstance.mFlags.Has(Flags::kAdvertising))
             {
                 BLEMGR_LOG("BLEMGR: BLE Process Application Message: Not advertising");
 
-                if (GetFlag(sInstance.mFlags, kFlag_AdvertisingEnabled))
+                if (sInstance.mFlags.Has(Flags::kAdvertisingEnabled))
                 {
-                    ClearFlag(sInstance.mFlags, kFlag_FastAdvertisingEnabled);
+                    sInstance.mFlags.Clear(Flags::kFastAdvertisingEnabled);
 
                     BLEMGR_LOG("BLEMGR: BLE Process Application Message: Slow Advertising Enabled");
 // Send notification to thread manager that CHIPoBLE advertising is starting
@@ -780,11 +780,11 @@ void BLEManagerImpl::ProcessEvtHdrMsg(QueuedEvt_t * pMsg)
                     // Start advertisement timer
                     Util_startClock(&sInstance.clkAdvTimeout);
 
-                    SetFlag(sInstance.mFlags, kFlag_Advertising, true);
+                    sInstance.mFlags.Set(Flags::kAdvertising);
                 }
-                else if (GetFlag(sInstance.mFlags, kFlag_FastAdvertisingEnabled))
+                else if (sInstance.mFlags.Has(Flags::kFastAdvertisingEnabled))
                 {
-                    ClearFlag(sInstance.mFlags, kFlag_AdvertisingEnabled);
+                    sInstance.mFlags.Clear(Flags::kAdvertisingEnabled);
 
                     BLEMGR_LOG("BLEMGR: BLE Process Application Message: Fast Advertising Enabled");
 
@@ -795,28 +795,27 @@ void BLEManagerImpl::ProcessEvtHdrMsg(QueuedEvt_t * pMsg)
                     // Enable legacy advertising for set #1
                     status = (bStatus_t) GapAdv_enable(sInstance.advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX, 0);
                     assert(status == SUCCESS);
-                    SetFlag(sInstance.mFlags, kFlag_Advertising, true);
+                    sInstance.mFlags.Set(Flags::kAdvertising);
                 }
             }
             /* Advertising flag set, neither advertising nor fast adv is enabled: Turn off*/
-            else if (!GetFlag(sInstance.mFlags, kFlag_AdvertisingEnabled) &&
-                     !GetFlag(sInstance.mFlags, kFlag_FastAdvertisingEnabled))
+            else if (!sInstance.mFlags.Has(Flags::kAdvertisingEnabled) && !sInstance.mFlags.Has(Flags::kFastAdvertisingEnabled))
             {
                 BLEMGR_LOG("BLEMGR: BLE Process Application Message: Advertising disables");
 
                 // Stop advertising
                 GapAdv_disable(sInstance.advHandleLegacy);
-                ClearFlag(sInstance.mFlags, kFlag_Advertising);
+                sInstance.mFlags.Clear(Flags::kAdvertising);
 
                 Util_stopClock(&sInstance.clkAdvTimeout);
             }
         }
 
-        if (GetFlag(sInstance.mFlags, kFlag_BLEStackGATTNameUpdate))
+        if (sInstance.mFlags.Has(Flags::kBLEStackGATTNameUpdate))
         {
-            ClearFlag(sInstance.mFlags, kFlag_BLEStackGATTNameUpdate);
+            sInstance.mFlags.Clear(Flags::kBLEStackGATTNameUpdate);
             // Indicate that Device name has been set externally
-            SetFlag(mFlags, kFlag_BLEStackGATTNameSet, true);
+            mFlags.Set(Flags::kBLEStackGATTNameSet);
 
             // Set the Device Name characteristic in the GAP GATT Service
             GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, sInstance.mDeviceName);
@@ -1026,7 +1025,7 @@ void BLEManagerImpl::ProcessGapMessage(gapEventHdr_t * pMsg)
 
             AdvInit();
 
-            SetFlag(sInstance.mFlags, kFlag_BLEStackInitialized, true);
+            sInstance.mFlags.Set(Flags::kBLEStackInitialized);
 
             /* Trigger post-initialization state update */
             DriveBLEState();
@@ -1060,13 +1059,13 @@ void BLEManagerImpl::ProcessGapMessage(gapEventHdr_t * pMsg)
         if (numActive < MAX_NUM_BLE_CONNS)
         {
             // Start advertising since there is room for more connections. Advertisements stop automatically following connection.
-            ClearFlag(sInstance.mFlags, kFlag_Advertising);
+            sInstance.mFlags.Clear(Flags::kAdvertising);
         }
         else
         {
             // Stop advertising since there is no room for more connections
             BLEMGR_LOG("BLEMGR: BLE event GAP_LINK_ESTABLISHED_EVENT: MAX connections");
-            ClearFlag(sInstance.mFlags, kFlag_FastAdvertisingEnabled | kFlag_AdvertisingEnabled | kFlag_Advertising);
+            sInstance.mFlags.Clear(Flags::kFastAdvertisingEnabled).Clear(Flags::kAdvertisingEnabled.Clear(Flags::kAdvertising);
         }
 
         /* Stop advertisement timeout timer */
@@ -1686,11 +1685,11 @@ void BLEManagerImpl::AdvTimeoutHandler(uintptr_t arg)
 {
     BLEMGR_LOG("BLEMGR: AdvTimeoutHandler");
 
-    if (GetFlag(sInstance.mFlags, kFlag_AdvertisingEnabled))
+    if (sInstance.mFlags.Has(Flags::kAdvertisingEnabled))
     {
         BLEMGR_LOG("BLEMGR: AdvTimeoutHandler ble adv 15 minute timeout");
 
-        SetFlag(sInstance.mFlags, kFlag_AdvertisingEnabled, false);
+        sInstance.mFlags.Clear(Flags::kAdvertisingEnabled);
 
         /* Send event to process state change request */
         DriveBLEState();
index 57821d1..7cb8bb4 100644 (file)
@@ -46,8 +46,11 @@ declare_args() {
       (chip_device_platform == "linux" || chip_device_platform == "darwin" ||
        chip_device_platform == "cc13x2_26x2")
 
-  chip_enable_mdns =
-      chip_device_platform == "linux" || chip_device_platform == "esp32"
+  if (chip_device_platform == "linux" || chip_device_platform == "esp32") {
+    chip_mdns = "minimal"
+  } else {
+    chip_mdns = "none"
+  }
 }
 
 _chip_device_layer = "none"
diff --git a/src/platform/nrfconnect/BLEManagerImpl.cpp b/src/platform/nrfconnect/BLEManagerImpl.cpp
deleted file mode 100644 (file)
index 9d89e49..0000000
+++ /dev/null
@@ -1,40 +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.
- */
-
-/**
- *    @file
- *          Provides an implementation of the BLEManager singleton object
- *          for Zephyr platforms.
- */
-
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-
-#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
-
-#include <platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp>
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-BLEManagerImpl BLEManagerImpl::sInstance;
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
-
-#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
diff --git a/src/platform/nrfconnect/ConfigurationManagerImpl.cpp b/src/platform/nrfconnect/ConfigurationManagerImpl.cpp
deleted file mode 100644 (file)
index bde9059..0000000
+++ /dev/null
@@ -1,108 +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.
- */
-
-/**
- *    @file
- *          Provides the implementation of the Device Layer ConfigurationManager object
- *          for Zephyr platforms.
- */
-
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-
-#include <platform/ConfigurationManager.h>
-#include <platform/internal/GenericConfigurationManagerImpl.cpp>
-
-#include <core/CHIPVendorIdentifiers.hpp>
-#include <platform/nrfconnect/ZephyrConfig.h>
-
-#if CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING
-#include <platform/internal/FactoryProvisioning.cpp>
-#endif // CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING
-
-#include <support/CodeUtils.h>
-#include <support/logging/CHIPLogging.h>
-
-#include <power/reboot.h>
-
-namespace chip {
-namespace DeviceLayer {
-
-using namespace ::chip::DeviceLayer::Internal;
-
-/** Singleton instance of the ConfigurationManager implementation object.
- */
-ConfigurationManagerImpl ConfigurationManagerImpl::sInstance;
-
-CHIP_ERROR ConfigurationManagerImpl::_Init()
-{
-    CHIP_ERROR err;
-    bool failSafeArmed;
-
-    // Initialize the generic implementation base class.
-    err = Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>::_Init();
-    SuccessOrExit(err);
-
-    // TODO: Initialize the global GroupKeyStore object here
-#if CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING
-    {
-        FactoryProvisioning factoryProv;
-        uint8_t * const kDeviceRAMStart = (uint8_t *) CONFIG_SRAM_BASE_ADDRESS;
-        uint8_t * const kDeviceRAMEnd   = kDeviceRAMStart + CONFIG_SRAM_SIZE * 1024 - 1;
-
-        // Scan device RAM for injected provisioning data and save to persistent storage if found.
-        err = factoryProv.ProvisionDeviceFromRAM(kDeviceRAMStart, kDeviceRAMEnd);
-        SuccessOrExit(err);
-    }
-#endif // CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING
-
-    // If the fail-safe was armed when the device last shutdown, initiate a factory reset.
-    if (_GetFailSafeArmed(failSafeArmed) == CHIP_NO_ERROR && failSafeArmed)
-    {
-        ChipLogProgress(DeviceLayer, "Detected fail-safe armed on reboot; initiating factory reset");
-        _InitiateFactoryReset();
-    }
-
-    err = CHIP_NO_ERROR;
-
-exit:
-    return err;
-}
-
-void ConfigurationManagerImpl::_InitiateFactoryReset()
-{
-    PlatformMgr().ScheduleWork(DoFactoryReset);
-}
-
-void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg)
-{
-    ChipLogProgress(DeviceLayer, "Performing factory reset");
-    const CHIP_ERROR err = FactoryResetConfig();
-
-    if (err != CHIP_NO_ERROR)
-        ChipLogError(DeviceLayer, "FactoryResetConfig() failed: %s", ErrorStr(err));
-
-#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
-    ThreadStackMgr().ErasePersistentInfo();
-#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD
-
-#if CONFIG_REBOOT
-    sys_reboot(SYS_REBOOT_WARM);
-#endif
-}
-
-} // namespace DeviceLayer
-} // namespace chip
diff --git a/src/platform/nrfconnect/Logging.cpp b/src/platform/nrfconnect/Logging.cpp
deleted file mode 100644 (file)
index 526fe4b..0000000
+++ /dev/null
@@ -1,112 +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.
- */
-
-/**
- *    @file
- *          Provides implementations for the CHIP logging functions
- *          on Nordic nRF Connect SDK platforms.
- */
-
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-#include <support/logging/CHIPLogging.h>
-
-#include <kernel.h>
-#include <logging/log.h>
-
-#include <cstdio>
-
-using namespace ::chip;
-using namespace ::chip::DeviceLayer;
-using namespace ::chip::DeviceLayer::Internal;
-
-LOG_MODULE_REGISTER(chip, LOG_LEVEL_DBG);
-
-namespace chip {
-namespace DeviceLayer {
-
-/**
- * Called whenever a log message is emitted by chip.
- *
- * This function is intended be overridden by the application to, e.g.,
- * schedule output of queued log entries.
- */
-void __attribute__((weak)) OnLogOutput(void) {}
-
-} // namespace DeviceLayer
-
-namespace Logging {
-
-/**
- * CHIP log output function.
- */
-
-void LogV(uint8_t module, uint8_t category, const char * msg, va_list v)
-{
-    if (!IsCategoryEnabled(category))
-        return;
-
-    {
-        char formattedMsg[CHIP_DEVICE_CONFIG_LOG_MESSAGE_MAX_SIZE];
-        size_t prefixLen = 0;
-
-        // Max size for "[TAG] {UINT32}"
-        constexpr size_t maxPrefixLen = ChipLoggingModuleNameLen + 10 + 3;
-        static_assert(sizeof(formattedMsg) > maxPrefixLen);
-
-        prefixLen += snprintf(formattedMsg, sizeof(formattedMsg), "%u", k_uptime_get_32());
-
-        // Form the log prefix, e.g. "[DL] "
-        formattedMsg[prefixLen++] = '[';
-        GetModuleName(formattedMsg + prefixLen, module);
-        prefixLen                 = strlen(formattedMsg);
-        formattedMsg[prefixLen++] = ']';
-        formattedMsg[prefixLen++] = ' ';
-
-        // Append the log message.
-        vsnprintf(formattedMsg + prefixLen, sizeof(formattedMsg) - prefixLen, msg, v);
-
-        // Invoke the Zephyr logging library to log the message.
-        //
-        // Unfortunately the Zephyr logging macros end up assigning uint16_t
-        // variables to uint16_t:10 fields, which triggers integer conversion
-        // warnings.  And treating the Zephyr headers as system headers does not
-        // help, apparently.  Just turn off that warning around this switch.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-        switch (category)
-        {
-        case kLogCategory_Error:
-            LOG_ERR("%s", log_strdup(formattedMsg));
-            break;
-        case kLogCategory_Progress:
-        case kLogCategory_Retain:
-        default:
-            LOG_INF("%s", log_strdup(formattedMsg));
-            break;
-        case kLogCategory_Detail:
-            LOG_DBG("%s", log_strdup(formattedMsg));
-            break;
-        }
-#pragma GCC diagnostic pop
-    }
-
-    // Let the application know that a log message has been emitted.
-    DeviceLayer::OnLogOutput();
-}
-
-} // namespace Logging
-} // namespace chip
diff --git a/src/platform/nrfconnect/PlatformManagerImpl.cpp b/src/platform/nrfconnect/PlatformManagerImpl.cpp
deleted file mode 100644 (file)
index 488af60..0000000
+++ /dev/null
@@ -1,55 +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.
- */
-
-/**
- *    @file
- *          Provides an implementation of the PlatformManager object
- *          for nRF Connect SDK platforms.
- */
-
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-
-#include <platform/PlatformManager.h>
-#include <platform/internal/GenericPlatformManagerImpl_Zephyr.cpp>
-
-#include <support/logging/CHIPLogging.h>
-
-namespace chip {
-namespace DeviceLayer {
-
-static K_THREAD_STACK_DEFINE(sChipThreadStack, CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE);
-
-PlatformManagerImpl PlatformManagerImpl::sInstance{ sChipThreadStack };
-
-CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
-{
-    CHIP_ERROR err;
-
-    // Initialize the configuration system.
-    err = Internal::ZephyrConfig::Init();
-    SuccessOrExit(err);
-
-    // Call _InitChipStack() on the generic implementation base class to finish the initialization process.
-    err = Internal::GenericPlatformManagerImpl_Zephyr<PlatformManagerImpl>::_InitChipStack();
-    SuccessOrExit(err);
-
-exit:
-    return err;
-}
-
-} // namespace DeviceLayer
-} // namespace chip
diff --git a/src/platform/nrfconnect/ThreadStackManagerImpl.cpp b/src/platform/nrfconnect/ThreadStackManagerImpl.cpp
deleted file mode 100644 (file)
index 120da81..0000000
+++ /dev/null
@@ -1,40 +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.
- */
-
-/**
- *    @file
- *          Provides an implementation of the ThreadStackManager object for
- *          nRF Connect SDK platforms.
- *
- */
-/* this file behaves like a config.h, comes first */
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-
-#include <platform/Zephyr/GenericThreadStackManagerImpl_Zephyr.cpp>
-
-#include <platform/OpenThread/OpenThreadUtils.h>
-#include <platform/ThreadStackManager.h>
-
-namespace chip {
-namespace DeviceLayer {
-
-using namespace ::chip::DeviceLayer::Internal;
-
-ThreadStackManagerImpl ThreadStackManagerImpl::sInstance;
-
-} // namespace DeviceLayer
-} // namespace chip
diff --git a/src/platform/nrfconnect/ZephyrConfig.cpp b/src/platform/nrfconnect/ZephyrConfig.cpp
deleted file mode 100644 (file)
index 9a3acc0..0000000
+++ /dev/null
@@ -1,304 +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.
- */
-
-/**
- *    @file
- *          Utilities for accessing persisted device configuration on
- *          Zephyr platforms.
- */
-
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-#include <platform/nrfconnect/ZephyrConfig.h>
-
-#include <core/CHIPEncoding.h>
-#include <platform/internal/testing/ConfigUnitTest.h>
-#include <support/CodeUtils.h>
-#include <support/logging/CHIPLogging.h>
-
-#include <settings/settings.h>
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-// Helper macro to define and check length of a configuration key
-#define CONFIG_KEY(key)                                                                                                            \
-    (key);                                                                                                                         \
-    static_assert(sizeof(key) <= SETTINGS_MAX_NAME_LEN, "Config key too long: " key)
-
-// Config namespaces
-// clang-format off
-#define NAMESPACE_FACTORY  "chip-fact/"
-#define NAMESPACE_CONFIG   "chip-conf/"
-#define NAMESPACE_COUNTERS "chip-cntr/"
-// clang-format on
-
-// Keys stored in the chip factory nam
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_SerialNum           = CONFIG_KEY(NAMESPACE_FACTORY "serial-num");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_MfrDeviceId         = CONFIG_KEY(NAMESPACE_FACTORY "device-id");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_MfrDeviceCert       = CONFIG_KEY(NAMESPACE_FACTORY "device-cert");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_MfrDeviceICACerts   = CONFIG_KEY(NAMESPACE_FACTORY "device-ca-certs");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_MfrDevicePrivateKey = CONFIG_KEY(NAMESPACE_FACTORY "device-key");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_ProductRevision     = CONFIG_KEY(NAMESPACE_FACTORY "product-rev");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_ManufacturingDate   = CONFIG_KEY(NAMESPACE_FACTORY "mfg-date");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_SetupPinCode        = CONFIG_KEY(NAMESPACE_FACTORY "pin-code");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_SetupDiscriminator  = CONFIG_KEY(NAMESPACE_FACTORY "discriminator");
-// Keys stored in the chip config namespace
-// NOTE: update sAllResettableConfigKeys definition when adding a new entry below
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_FabricId                    = CONFIG_KEY(NAMESPACE_CONFIG "fabric-id");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_ServiceConfig               = CONFIG_KEY(NAMESPACE_CONFIG "service-config");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_PairedAccountId             = CONFIG_KEY(NAMESPACE_CONFIG "account-id");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_ServiceId                   = CONFIG_KEY(NAMESPACE_CONFIG "service-id");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_FabricSecret                = CONFIG_KEY(NAMESPACE_CONFIG "fabric-secret");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_GroupKeyIndex               = CONFIG_KEY(NAMESPACE_CONFIG "group-key-index");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_LastUsedEpochKeyId          = CONFIG_KEY(NAMESPACE_CONFIG "last-ek-id");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_FailSafeArmed               = CONFIG_KEY(NAMESPACE_CONFIG "fail-safe-armed");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_OperationalDeviceId         = CONFIG_KEY(NAMESPACE_CONFIG "op-device-id");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_OperationalDeviceCert       = CONFIG_KEY(NAMESPACE_CONFIG "op-device-cert");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_OperationalDeviceICACerts   = CONFIG_KEY(NAMESPACE_CONFIG "op-device-ca-certs");
-const ZephyrConfig::Key ZephyrConfig::kConfigKey_OperationalDevicePrivateKey = CONFIG_KEY(NAMESPACE_CONFIG "op-device-key");
-
-namespace {
-
-constexpr const char * sAllResettableConfigKeys[] = { ZephyrConfig::kConfigKey_FabricId,
-                                                      ZephyrConfig::kConfigKey_ServiceConfig,
-                                                      ZephyrConfig::kConfigKey_PairedAccountId,
-                                                      ZephyrConfig::kConfigKey_ServiceId,
-                                                      ZephyrConfig::kConfigKey_FabricSecret,
-                                                      ZephyrConfig::kConfigKey_GroupKeyIndex,
-                                                      ZephyrConfig::kConfigKey_LastUsedEpochKeyId,
-                                                      ZephyrConfig::kConfigKey_FailSafeArmed,
-                                                      ZephyrConfig::kConfigKey_OperationalDeviceId,
-                                                      ZephyrConfig::kConfigKey_OperationalDeviceCert,
-                                                      ZephyrConfig::kConfigKey_OperationalDeviceICACerts,
-                                                      ZephyrConfig::kConfigKey_OperationalDevicePrivateKey };
-
-// Data structure to be passed as a parameter of Zephyr's settings_load_subtree_direct() function
-struct ReadRequest
-{
-    void * const destination; // NOTE: can be nullptr in which case `configSize` should still be returned
-    const size_t bufferSize;  // size of destination buffer
-    CHIP_ERROR result;        // [out] read result
-    size_t configSize;        // [out] size of configuration value
-};
-
-// Callback for Zephyr's settings_load_subtree_direct() function
-int ConfigValueCallback(const char * name, size_t configSize, settings_read_cb readCb, void * cbArg, void * param)
-{
-    // If requested a config key X, process just node X and ignore all its descendants: X/*
-    if (settings_name_next(name, nullptr) > 0)
-        return 0;
-
-    ReadRequest & request = *reinterpret_cast<ReadRequest *>(param);
-
-    if (!request.destination || configSize > request.bufferSize)
-    {
-        request.result     = CHIP_ERROR_BUFFER_TOO_SMALL;
-        request.configSize = configSize;
-        return 0;
-    }
-
-    // Found requested key
-    const ssize_t bytesRead = readCb(cbArg, request.destination, request.bufferSize);
-    request.result          = bytesRead > 0 ? CHIP_NO_ERROR : CHIP_ERROR_PERSISTED_STORAGE_FAILED;
-    request.configSize      = bytesRead > 0 ? bytesRead : 0;
-    return 0;
-}
-
-// Read configuration value of maximum size `bufferSize` and store the actual size in `configSize`.
-CHIP_ERROR ReadConfigValueImpl(const ZephyrConfig::Key key, void * const destination, const size_t bufferSize, size_t & configSize)
-{
-    ReadRequest request{ destination, bufferSize, CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND, 0 };
-    settings_load_subtree_direct(key, ConfigValueCallback, &request);
-    configSize = request.configSize;
-    return request.result;
-}
-
-CHIP_ERROR WriteConfigValueImpl(const ZephyrConfig::Key key, const void * const source, const size_t length)
-{
-    if (settings_save_one(key, source, length) != 0)
-        return CHIP_ERROR_PERSISTED_STORAGE_FAILED;
-
-    return CHIP_NO_ERROR;
-}
-
-template <class T>
-inline CHIP_ERROR ReadSimpleConfigValue(const ZephyrConfig::Key key, T & value)
-{
-    CHIP_ERROR result;
-    T tempValue;
-    size_t configSize;
-
-    result = ReadConfigValueImpl(key, &tempValue, sizeof(T), configSize);
-    SuccessOrExit(result);
-
-    // For simple types require that size of the output variable matches size of the configuration value
-    VerifyOrExit(configSize == sizeof(T), result = CHIP_ERROR_INVALID_ARGUMENT);
-    value = tempValue;
-exit:
-    return result;
-}
-} // namespace
-
-CHIP_ERROR ZephyrConfig::Init()
-{
-    if (settings_subsys_init() != 0)
-        return CHIP_ERROR_PERSISTED_STORAGE_FAILED;
-
-    return CHIP_NO_ERROR;
-}
-
-CHIP_ERROR ZephyrConfig::ReadConfigValue(Key key, bool & val)
-{
-    return ReadSimpleConfigValue(key, val);
-}
-
-CHIP_ERROR ZephyrConfig::ReadConfigValue(Key key, uint32_t & val)
-{
-    return ReadSimpleConfigValue(key, val);
-}
-
-CHIP_ERROR ZephyrConfig::ReadConfigValue(Key key, uint64_t & val)
-{
-    return ReadSimpleConfigValue(key, val);
-}
-
-CHIP_ERROR ZephyrConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen)
-{
-    // Pretend that the buffer is smaller by 1 to secure space for null-character
-    const CHIP_ERROR result = ReadConfigValueImpl(key, buf, bufSize ? bufSize - 1 : 0, outLen);
-
-    // Add trailing null-character unless it's already there (NOTE: Zephyr forbids configuration
-    // values of size 0, so we put "\0" when a user wants to store an empty string).
-    if (result == CHIP_NO_ERROR)
-    {
-        if (buf[outLen - 1]) // CHIP_NO_ERROR implies outLen > 0
-            buf[outLen] = 0;
-        else
-            outLen--;
-    }
-
-    return result;
-}
-
-CHIP_ERROR ZephyrConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen)
-{
-    return ReadConfigValueImpl(key, buf, bufSize, outLen);
-}
-
-CHIP_ERROR ZephyrConfig::ReadConfigValueCounter(::chip::Platform::PersistedStorage::Key counterId, uint32_t & val)
-{
-    char key[SETTINGS_MAX_NAME_LEN];
-
-    if (!BuildCounterConfigKey(counterId, key))
-        return CHIP_ERROR_INVALID_ARGUMENT;
-
-    return ReadConfigValue(key, val);
-}
-
-CHIP_ERROR ZephyrConfig::WriteConfigValue(Key key, bool val)
-{
-    return WriteConfigValueImpl(key, &val, sizeof(bool));
-}
-
-CHIP_ERROR ZephyrConfig::WriteConfigValue(Key key, uint32_t val)
-{
-    return WriteConfigValueImpl(key, &val, sizeof(uint32_t));
-}
-
-CHIP_ERROR ZephyrConfig::WriteConfigValue(Key key, uint64_t val)
-{
-    return WriteConfigValueImpl(key, &val, sizeof(uint64_t));
-}
-
-CHIP_ERROR ZephyrConfig::WriteConfigValueStr(Key key, const char * str)
-{
-    return WriteConfigValueStr(key, str, str ? strlen(str) : 0);
-}
-
-CHIP_ERROR ZephyrConfig::WriteConfigValueStr(Key key, const char * str, size_t strLen)
-{
-    // NOTE: Zephyr forbids configuration values of size 0, so we put "\0" in such a case
-    if (str && strLen == 0)
-    {
-        str    = "\0";
-        strLen = 1;
-    }
-
-    return WriteConfigValueImpl(key, str, strLen);
-}
-
-CHIP_ERROR ZephyrConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen)
-{
-    return WriteConfigValueImpl(key, data, dataLen);
-}
-
-CHIP_ERROR ZephyrConfig::WriteConfigValueCounter(::chip::Platform::PersistedStorage::Key counterId, uint32_t val)
-{
-    char key[SETTINGS_MAX_NAME_LEN];
-
-    if (!BuildCounterConfigKey(counterId, key))
-        return CHIP_ERROR_INVALID_ARGUMENT;
-
-    return WriteConfigValue(key, val);
-}
-
-CHIP_ERROR ZephyrConfig::ClearConfigValue(Key key)
-{
-    if (settings_delete(key) != 0)
-        return CHIP_ERROR_PERSISTED_STORAGE_FAILED;
-
-    return CHIP_NO_ERROR;
-}
-
-bool ZephyrConfig::ConfigValueExists(Key key)
-{
-    size_t configSize;
-    return ReadConfigValueImpl(key, nullptr, 0, configSize) == CHIP_ERROR_BUFFER_TOO_SMALL;
-}
-
-CHIP_ERROR ZephyrConfig::FactoryResetConfig(void)
-{
-    for (const auto key : sAllResettableConfigKeys)
-        if (settings_delete(key) != 0)
-            return CHIP_ERROR_PERSISTED_STORAGE_FAILED;
-
-    return CHIP_NO_ERROR;
-}
-
-void ZephyrConfig::RunConfigUnitTest()
-{
-    // Run common unit test.
-    ::chip::DeviceLayer::Internal::RunConfigUnitTest<ZephyrConfig>();
-}
-
-bool ZephyrConfig::BuildCounterConfigKey(::chip::Platform::PersistedStorage::Key counterId, char key[SETTINGS_MAX_NAME_LEN])
-{
-    constexpr size_t KEY_PREFIX_LEN = sizeof(NAMESPACE_COUNTERS) - 1;
-    const size_t keySuffixLen       = strlen(counterId) + 1; // including null-character
-
-    if (KEY_PREFIX_LEN + keySuffixLen > SETTINGS_MAX_NAME_LEN)
-        return false;
-
-    memcpy(&key[0], NAMESPACE_COUNTERS, KEY_PREFIX_LEN);
-    memcpy(&key[KEY_PREFIX_LEN], counterId, keySuffixLen);
-    return true;
-}
-
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
diff --git a/src/platform/nrfconnect/ZephyrConfig.h b/src/platform/nrfconnect/ZephyrConfig.h
deleted file mode 100644 (file)
index f50cf39..0000000
+++ /dev/null
@@ -1,95 +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.
- */
-
-/**
- *    @file
- *          Utilities for accessing persistent device configuration on
- *          Zephyr platforms.
- */
-
-#pragma once
-
-#include <platform/internal/CHIPDeviceLayerInternal.h>
-
-namespace chip {
-namespace DeviceLayer {
-namespace Internal {
-
-/**
- * Provides functions and definitions for accessing device configuration information on Zephyr platforms.
- *
- * This implementation uses Zephyr Settings API as the underlying storage layer.
- *
- * This class is designed to be mixed-in to concrete implementation classes as a means to
- * provide access to configuration information to generic base classes.
- */
-class ZephyrConfig
-{
-public:
-    using Key = const char[];
-
-    // Key definitions for well-known keys.
-    static const Key kConfigKey_SerialNum;
-    static const Key kConfigKey_MfrDeviceId;
-    static const Key kConfigKey_MfrDeviceCert;
-    static const Key kConfigKey_MfrDeviceICACerts;
-    static const Key kConfigKey_MfrDevicePrivateKey;
-    static const Key kConfigKey_ProductRevision;
-    static const Key kConfigKey_ManufacturingDate;
-    static const Key kConfigKey_SetupPinCode;
-    static const Key kConfigKey_SetupDiscriminator;
-    static const Key kConfigKey_FabricId;
-    static const Key kConfigKey_ServiceConfig;
-    static const Key kConfigKey_PairedAccountId;
-    static const Key kConfigKey_ServiceId;
-    static const Key kConfigKey_FabricSecret;
-    static const Key kConfigKey_GroupKeyIndex;
-    static const Key kConfigKey_LastUsedEpochKeyId;
-    static const Key kConfigKey_FailSafeArmed;
-    static const Key kConfigKey_OperationalDeviceId;
-    static const Key kConfigKey_OperationalDeviceCert;
-    static const Key kConfigKey_OperationalDeviceICACerts;
-    static const Key kConfigKey_OperationalDevicePrivateKey;
-
-    static CHIP_ERROR Init(void);
-
-    // Config value accessors.
-    static CHIP_ERROR ReadConfigValue(Key key, bool & val);
-    static CHIP_ERROR ReadConfigValue(Key key, uint32_t & val);
-    static CHIP_ERROR ReadConfigValue(Key key, uint64_t & val);
-    static CHIP_ERROR ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen);
-    static CHIP_ERROR ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen);
-    static CHIP_ERROR ReadConfigValueCounter(::chip::Platform::PersistedStorage::Key counterId, uint32_t & val);
-    static CHIP_ERROR WriteConfigValue(Key key, bool val);
-    static CHIP_ERROR WriteConfigValue(Key key, uint32_t val);
-    static CHIP_ERROR WriteConfigValue(Key key, uint64_t val);
-    static CHIP_ERROR WriteConfigValueStr(Key key, const char * str);
-    static CHIP_ERROR WriteConfigValueStr(Key key, const char * str, size_t strLen);
-    static CHIP_ERROR WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen);
-    static CHIP_ERROR WriteConfigValueCounter(::chip::Platform::PersistedStorage::Key counterId, uint32_t val);
-    static CHIP_ERROR ClearConfigValue(Key key);
-    static bool ConfigValueExists(Key key);
-    static CHIP_ERROR FactoryResetConfig(void);
-
-    static void RunConfigUnitTest(void);
-
-private:
-    static bool BuildCounterConfigKey(::chip::Platform::PersistedStorage::Key counterId, char key[]);
-};
-} // namespace Internal
-} // namespace DeviceLayer
-} // namespace chip
index b831e9b..5c55c28 100644 (file)
@@ -68,8 +68,8 @@ CHIP_ERROR BLEManagerImpl::_Init()
     CHIP_ERROR err;
 
     mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;
-    mFlags       = CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? kFlag_AdvertisingEnabled : 0;
-    mNumGAPCons  = 0;
+    mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
+    mNumGAPCons = 0;
     for (int i = 0; i < kMaxConnections; i++)
     {
         mSubscribedConIds[i] = BLE_CONNECTION_UNINITIALIZED;
@@ -115,9 +115,9 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_AdvertisingEnabled, val);
+        mFlags.Set(Flags::kAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -131,9 +131,9 @@ CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val)
 
     VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);
 
-    if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val)
+    if (mFlags.Has(Flags::kFastAdvertisingEnabled) != val)
     {
-        SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val);
+        mFlags.Set(Flags::kFastAdvertisingEnabled, val);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 
@@ -209,13 +209,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
 
         // Force the advertising state to be refreshed to reflect new provisioning state.
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
 
         DriveBLEState();
 
@@ -353,16 +353,16 @@ void BLEManagerImpl::DriveBLEState(void)
     CHIP_ERROR err = CHIP_NO_ERROR;
 
     // Perform any initialization actions that must occur after the CHIP task is running.
-    if (!GetFlag(mFlags, kFlag_AsyncInitCompleted))
+    if (!mFlags.Has(Flags::kAsyncInitCompleted))
     {
-        SetFlag(mFlags, kFlag_AsyncInitCompleted);
+        mFlags.Set(Flags::kAsyncInitCompleted);
 
         // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled,
         // disable CHIPoBLE advertising if the device is fully provisioned.
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
         if (ConfigurationMgr().IsFullyProvisioned())
         {
-            ClearFlag(mFlags, kFlag_AdvertisingEnabled);
+            mFlags.Clear(Flags::kAdvertisingEnabled);
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned");
         }
 #endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED
@@ -370,7 +370,7 @@ void BLEManagerImpl::DriveBLEState(void)
 
     // If the application has enabled CHIPoBLE and BLE advertising...
     if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled &&
-        GetFlag(mFlags, kFlag_AdvertisingEnabled)
+        mFlags.Has(Flags::kAdvertisingEnabled)
 #if CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION
         // and no connections are active...
         && (mNumGAPCons == 0)
@@ -379,7 +379,7 @@ void BLEManagerImpl::DriveBLEState(void)
     {
         // Start/re-start BLE advertising if not already advertising, or if the
         // advertising state of the underlying stack needs to be refreshed.
-        if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_AdvertisingRefreshNeeded))
+        if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kAdvertisingRefreshNeeded))
         {
             err = StartAdvertising();
             SuccessOrExit(err);
@@ -415,7 +415,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
     err = ConfigurationMgr().GetBLEDeviceIdentificationInfo(mDeviceIdInfo);
     SuccessOrExit(err);
 
-    if (!GetFlag(mFlags, kFlag_DeviceNameSet))
+    if (!mFlags.Has(Flags::kDeviceNameSet))
     {
         snprintf(mDeviceName, sizeof(mDeviceName), "%s%04" PRIX32, CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, (uint32_t) 0);
 
@@ -474,9 +474,9 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     err = ConfigureAdvertisingData();
     SuccessOrExit(err);
 
-    SetFlag(mFlags, kFlag_Advertising, true);
+    mFlags.Set(Flags::kAdvertising);
 
-    interval = ((mNumGAPCons == 0 && !ConfigurationMgr().IsPairedToAccount()) || GetFlag(mFlags, kFlag_FastAdvertisingEnabled))
+    interval = ((mNumGAPCons == 0 && !ConfigurationMgr().IsPairedToAccount()) || mFlags.Has(Flags::kFastAdvertisingEnabled))
         ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
         : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL;
 
@@ -498,9 +498,9 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
     SuccessOrExit(err);
 
     // Transition to the not Advertising state...
-    if (GetFlag(mFlags, kFlag_Advertising))
+    if (mFlags.Has(Flags::kAdvertising))
     {
-        ClearFlag(mFlags, kFlag_Advertising);
+        mFlags.Clear(Flags::kAdvertising);
 
         ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");
 
@@ -648,14 +648,14 @@ void BLEManagerImpl::HandleDmMsg(qvCHIP_Ble_DmEvt_t * pDmEvt)
             ExitNow();
         }
 
-        ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded);
+        sInstance.mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
 
         // Transition to the Advertising state...
-        if (!GetFlag(sInstance.mFlags, kFlag_Advertising))
+        if (!sInstance.mFlags.Has(Flags::kAdvertising))
         {
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising started");
 
-            SetFlag(sInstance.mFlags, kFlag_Advertising, true);
+            sInstance.mFlags.Set(Flags::kAdvertising);
 
             // Post a CHIPoBLEAdvertisingChange(Started) event.
             {
@@ -674,12 +674,12 @@ void BLEManagerImpl::HandleDmMsg(qvCHIP_Ble_DmEvt_t * pDmEvt)
             ExitNow();
         }
 
-        ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded);
+        sInstance.mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
 
         // Transition to the not Advertising state...
-        if (GetFlag(sInstance.mFlags, kFlag_Advertising))
+        if (sInstance.mFlags.Has(Flags::kAdvertising))
         {
-            ClearFlag(sInstance.mFlags, kFlag_Advertising);
+            sInstance.mFlags.Clear(Flags::kAdvertising);
 
             ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");
 
@@ -706,7 +706,7 @@ void BLEManagerImpl::HandleDmMsg(qvCHIP_Ble_DmEvt_t * pDmEvt)
 
         // Receiving a connection stops the advertising processes.  So force a refresh of the advertising
         // state.
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
         break;
     }
@@ -742,7 +742,7 @@ void BLEManagerImpl::HandleDmMsg(qvCHIP_Ble_DmEvt_t * pDmEvt)
             PlatformMgr().PostEvent(&event);
         }
 
-        SetFlag(mFlags, kFlag_AdvertisingRefreshNeeded);
+        mFlags.Set(Flags::kAdvertisingRefreshNeeded);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
         break;
     }
index dd08bab..8de51c4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -87,15 +87,14 @@ private:
 
     // ===== Private members reserved for use by this class only.
 
-    enum
+    enum class Flags : uint16_t
     {
-        kFlag_AsyncInitCompleted     = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
-        kFlag_AdvertisingEnabled     = 0x0002, /**< The application has enabled CHIPoBLE advertising. */
-        kFlag_FastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */
-        kFlag_Advertising            = 0x0008, /**< The system is currently CHIPoBLE advertising. */
-        kFlag_AdvertisingRefreshNeeded =
-            0x0010, /**< The advertising state/configuration state in the BLE layer needs to be updated. */
-        kFlag_DeviceNameSet = 0x0020,
+        kAsyncInitCompleted       = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
+        kAdvertisingEnabled       = 0x0002, /**< The application has enabled CHIPoBLE advertising. */
+        kFastAdvertisingEnabled   = 0x0004, /**< The application has enabled fast advertising. */
+        kAdvertising              = 0x0008, /**< The system is currently CHIPoBLE advertising. */
+        kAdvertisingRefreshNeeded = 0x0010, /**< The advertising state/configuration state in the BLE layer needs to be updated. */
+        kDeviceNameSet            = 0x0020,
     };
 
     enum
@@ -106,7 +105,7 @@ private:
     };
 
     CHIPoBLEServiceMode mServiceMode;
-    uint16_t mFlags;
+    BitFlags<Flags> mFlags;
     char mDeviceName[kMaxDeviceNameLength + 1];
     uint16_t mNumGAPCons;
     uint16_t mSubscribedConIds[kMaxConnections];
@@ -173,17 +172,17 @@ inline BLEManager::CHIPoBLEServiceMode BLEManagerImpl::_GetCHIPoBLEServiceMode(v
 
 inline bool BLEManagerImpl::_IsAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_AdvertisingEnabled);
+    return mFlags.Has(Flags::kAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsFastAdvertisingEnabled(void)
 {
-    return GetFlag(mFlags, kFlag_FastAdvertisingEnabled);
+    return mFlags.Has(Flags::kFastAdvertisingEnabled);
 }
 
 inline bool BLEManagerImpl::_IsAdvertising(void)
 {
-    return GetFlag(mFlags, kFlag_Advertising);
+    return mFlags.Has(Flags::kAdvertising);
 }
 
 } // namespace Internal
old mode 100644 (file)
new mode 100755 (executable)
index 8626504..538e95e 100644 (file)
@@ -32,7 +32,7 @@ if (chip_device_platform != "none") {
       test_sources += [ "TestPlatformMgr.cpp" ]
     }
 
-    if (chip_enable_mdns && chip_enable_happy_tests &&
+    if (chip_mdns != "none" && chip_enable_happy_tests &&
         chip_device_platform == "linux") {
       test_sources += [ "TestMdns.cpp" ]
     }
diff --git a/src/platform/tests/TestConfigurationMgr.h b/src/platform/tests/TestConfigurationMgr.h
deleted file mode 100644 (file)
index a86c7e9..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry point for CHIP Configuration Manager code unit tests.
- *
- */
-
-#pragma once
-
-int TestConfigurationMgr();
diff --git a/src/platform/tests/TestConfigurationMgrDriver.cpp b/src/platform/tests/TestConfigurationMgrDriver.cpp
deleted file mode 100644 (file)
index 9a62f6e..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the Configuration Manager code code unit tests.
- *
- */
-
-#include "TestConfigurationMgr.h"
-
-int main()
-{
-    return (TestConfigurationMgr());
-}
diff --git a/src/platform/tests/TestMdns.h b/src/platform/tests/TestMdns.h
deleted file mode 100644 (file)
index f1169ec..0000000
+++ /dev/null
@@ -1,20 +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
-
-int TestMdns();
diff --git a/src/platform/tests/TestMdnsDriver.cpp b/src/platform/tests/TestMdnsDriver.cpp
deleted file mode 100644 (file)
index 07e973d..0000000
+++ /dev/null
@@ -1,41 +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.
- */
-
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-
-#include "TestMdns.h"
-
-int main()
-{
-    std::mutex mtx;
-    std::unique_lock<std::mutex> lock(mtx);
-    std::condition_variable done;
-    int retVal = -1;
-
-    std::thread t([&done, &retVal]() {
-        retVal = TestMdns();
-        done.notify_all();
-    });
-
-    if (done.wait_for(lock, std::chrono::seconds(5)) == std::cv_status::timeout)
-    {
-        fprintf(stderr, "mDNS test timeout, is avahi daemon running?");
-    }
-    return retVal;
-}
diff --git a/src/platform/tests/TestPlatformMgr.h b/src/platform/tests/TestPlatformMgr.h
deleted file mode 100644 (file)
index ecfb634..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry point for CHIP Platform Manager code unit tests.
- *
- */
-
-#pragma once
-
-int TestPlatformMgr();
diff --git a/src/platform/tests/TestPlatformMgrDriver.cpp b/src/platform/tests/TestPlatformMgrDriver.cpp
deleted file mode 100644 (file)
index 13422e5..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the Platform Manager code code unit tests.
- *
- */
-
-#include "TestPlatformMgr.h"
-
-int main()
-{
-    return (TestPlatformMgr());
-}
diff --git a/src/platform/tests/TestPlatformTime.h b/src/platform/tests/TestPlatformTime.h
deleted file mode 100644 (file)
index dfa1505..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry point for CHIP Platform Time code unit tests.
- *
- */
-
-#pragma once
-
-int TestPlatformTime();
diff --git a/src/platform/tests/TestPlatformTimeDriver.cpp b/src/platform/tests/TestPlatformTimeDriver.cpp
deleted file mode 100644 (file)
index 0fa1d1d..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the Platform Time code code unit tests.
- *
- */
-
-#include "TestPlatformTime.h"
-
-int main()
-{
-    return (TestPlatformTime());
-}
diff --git a/src/platform/tests/TestThreadStackMgr.h b/src/platform/tests/TestThreadStackMgr.h
deleted file mode 100644 (file)
index a05a494..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry point for CHIP Platform Manager code unit tests.
- *
- */
-
-#pragma once
-
-int TestThreadStackManager(void);
diff --git a/src/platform/tests/TestThreadStackMgrDriver.cpp b/src/platform/tests/TestThreadStackMgrDriver.cpp
deleted file mode 100644 (file)
index 5e4cbc5..0000000
+++ /dev/null
@@ -1,23 +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.
- */
-
-#include "TestThreadStackMgr.h"
-
-int main()
-{
-    TestThreadStackManager();
-}
index b64c7b8..bd9bf78 100644 (file)
@@ -42,18 +42,16 @@ using namespace chip::Encoding::LittleEndian;
 // the size of the message (even if the message is incomplete or filled out incorrectly).
 BufferWriter & TransferInit::WriteToBuffer(BufferWriter & aBuffer) const
 {
-    uint8_t proposedTransferCtl = 0;
-    bool widerange = (StartOffset > std::numeric_limits<uint32_t>::max()) || (MaxLength > std::numeric_limits<uint32_t>::max());
+    const BitFlags<TransferControlFlags> proposedTransferCtl(Version & kVersionMask, TransferCtlOptions);
+    const bool widerange =
+        (StartOffset > std::numeric_limits<uint32_t>::max()) || (MaxLength > std::numeric_limits<uint32_t>::max());
 
-    proposedTransferCtl |= Version & kVersionMask;
-    proposedTransferCtl = proposedTransferCtl | TransferCtlOptions.Raw();
+    BitFlags<RangeControlFlags> rangeCtlFlags;
+    rangeCtlFlags.Set(RangeControlFlags::kDefLen, MaxLength > 0);
+    rangeCtlFlags.Set(RangeControlFlags::kStartOffset, StartOffset > 0);
+    rangeCtlFlags.Set(RangeControlFlags::kWiderange, widerange);
 
-    BitFlags<uint8_t, RangeControlFlags> rangeCtlFlags;
-    rangeCtlFlags.Set(kRange_DefLen, MaxLength > 0);
-    rangeCtlFlags.Set(kRange_StartOffset, StartOffset > 0);
-    rangeCtlFlags.Set(kRange_Widerange, widerange);
-
-    aBuffer.Put(proposedTransferCtl);
+    aBuffer.Put(proposedTransferCtl.Raw());
     aBuffer.Put(rangeCtlFlags.Raw());
     aBuffer.Put16(MaxBlockSize);
 
@@ -98,22 +96,20 @@ CHIP_ERROR TransferInit::Parse(System::PacketBufferHandle aBuffer)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
     uint8_t proposedTransferCtl;
-    uint8_t rangeCtl;
     uint32_t tmpUint32Value = 0; // Used for reading non-wide length and offset fields
     uint8_t * bufStart      = aBuffer->Start();
     Reader bufReader(bufStart, aBuffer->DataLength());
-    BitFlags<uint8_t, RangeControlFlags> rangeCtlFlags;
+    BitFlags<RangeControlFlags> rangeCtlFlags;
 
-    SuccessOrExit(bufReader.Read8(&proposedTransferCtl).Read8(&rangeCtl).Read16(&MaxBlockSize).StatusCode());
+    SuccessOrExit(bufReader.Read8(&proposedTransferCtl).Read8(rangeCtlFlags.RawStorage()).Read16(&MaxBlockSize).StatusCode());
 
     Version = proposedTransferCtl & kVersionMask;
     TransferCtlOptions.SetRaw(static_cast<uint8_t>(proposedTransferCtl & ~kVersionMask));
-    rangeCtlFlags.SetRaw(rangeCtl);
 
     StartOffset = 0;
-    if (rangeCtlFlags.Has(kRange_StartOffset))
+    if (rangeCtlFlags.Has(RangeControlFlags::kStartOffset))
     {
-        if (rangeCtlFlags.Has(kRange_Widerange))
+        if (rangeCtlFlags.Has(RangeControlFlags::kWiderange))
         {
             SuccessOrExit(bufReader.Read64(&StartOffset).StatusCode());
         }
@@ -125,9 +121,9 @@ CHIP_ERROR TransferInit::Parse(System::PacketBufferHandle aBuffer)
     }
 
     MaxLength = 0;
-    if (rangeCtlFlags.Has(kRange_DefLen))
+    if (rangeCtlFlags.Has(RangeControlFlags::kDefLen))
     {
-        if (rangeCtlFlags.Has(kRange_Widerange))
+        if (rangeCtlFlags.Has(RangeControlFlags::kWiderange))
         {
             SuccessOrExit(bufReader.Read64(&MaxLength).StatusCode());
         }
@@ -189,7 +185,7 @@ bool TransferInit::operator==(const TransferInit & another) const
         metadataMatches = (memcmp(Metadata, another.Metadata, MetadataLength) == 0);
     }
 
-    return ((Version == another.Version) && (TransferCtlOptions.Raw() == another.TransferCtlOptions.Raw()) &&
+    return ((Version == another.Version) && (TransferCtlOptions == another.TransferCtlOptions) &&
             (StartOffset == another.StartOffset) && (MaxLength == another.MaxLength) && (MaxBlockSize == another.MaxBlockSize) &&
             fileDesMatches && metadataMatches);
 }
@@ -198,12 +194,9 @@ bool TransferInit::operator==(const TransferInit & another) const
 // the size of the message (even if the message is incomplete or filled out incorrectly).
 Encoding::LittleEndian::BufferWriter & SendAccept::WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const
 {
-    uint8_t transferCtl = 0;
-
-    transferCtl |= Version & kVersionMask;
-    transferCtl = transferCtl | TransferCtlFlags.Raw();
+    const BitFlags<TransferControlFlags> transferCtl(Version & kVersionMask, TransferCtlFlags);
 
-    aBuffer.Put(transferCtl);
+    aBuffer.Put(transferCtl.Raw());
     aBuffer.Put16(MaxBlockSize);
 
     if (Metadata != nullptr)
@@ -266,7 +259,7 @@ bool SendAccept::operator==(const SendAccept & another) const
         metadataMatches = (memcmp(Metadata, another.Metadata, MetadataLength) == 0);
     }
 
-    return ((Version == another.Version) && (TransferCtlFlags.Raw() == another.TransferCtlFlags.Raw()) &&
+    return ((Version == another.Version) && (TransferCtlFlags == another.TransferCtlFlags) &&
             (MaxBlockSize == another.MaxBlockSize) && metadataMatches);
 }
 
@@ -274,18 +267,15 @@ bool SendAccept::operator==(const SendAccept & another) const
 // the size of the message (even if the message is incomplete or filled out incorrectly).
 Encoding::LittleEndian::BufferWriter & ReceiveAccept::WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const
 {
-    uint8_t transferCtl = 0;
-    bool widerange      = (StartOffset > std::numeric_limits<uint32_t>::max()) || (Length > std::numeric_limits<uint32_t>::max());
-
-    transferCtl |= Version & kVersionMask;
-    transferCtl = transferCtl | TransferCtlFlags.Raw();
+    const BitFlags<TransferControlFlags> transferCtlFlags(Version & kVersionMask, TransferCtlFlags);
+    const bool widerange = (StartOffset > std::numeric_limits<uint32_t>::max()) || (Length > std::numeric_limits<uint32_t>::max());
 
-    BitFlags<uint8_t, RangeControlFlags> rangeCtlFlags;
-    rangeCtlFlags.Set(kRange_DefLen, Length > 0);
-    rangeCtlFlags.Set(kRange_StartOffset, StartOffset > 0);
-    rangeCtlFlags.Set(kRange_Widerange, widerange);
+    BitFlags<RangeControlFlags> rangeCtlFlags;
+    rangeCtlFlags.Set(RangeControlFlags::kDefLen, Length > 0);
+    rangeCtlFlags.Set(RangeControlFlags::kStartOffset, StartOffset > 0);
+    rangeCtlFlags.Set(RangeControlFlags::kWiderange, widerange);
 
-    aBuffer.Put(transferCtl);
+    aBuffer.Put(transferCtlFlags.Raw());
     aBuffer.Put(rangeCtlFlags.Raw());
     aBuffer.Put16(MaxBlockSize);
 
@@ -324,25 +314,22 @@ CHIP_ERROR ReceiveAccept::Parse(System::PacketBufferHandle aBuffer)
 {
     CHIP_ERROR err          = CHIP_NO_ERROR;
     uint8_t transferCtl     = 0;
-    uint8_t rangeCtl        = 0;
     uint32_t tmpUint32Value = 0; // Used for reading non-wide length and offset fields
     uint8_t * bufStart      = aBuffer->Start();
     Reader bufReader(bufStart, aBuffer->DataLength());
-    BitFlags<uint8_t, RangeControlFlags> rangeCtlFlags;
+    BitFlags<RangeControlFlags> rangeCtlFlags;
 
-    SuccessOrExit(bufReader.Read8(&transferCtl).Read8(&rangeCtl).Read16(&MaxBlockSize).StatusCode());
+    SuccessOrExit(bufReader.Read8(&transferCtl).Read8(rangeCtlFlags.RawStorage()).Read16(&MaxBlockSize).StatusCode());
 
     Version = transferCtl & kVersionMask;
 
     // Only one of these values should be set. It is up to the caller to verify this.
     TransferCtlFlags.SetRaw(static_cast<uint8_t>(transferCtl & ~kVersionMask));
 
-    rangeCtlFlags.SetRaw(rangeCtl);
-
     StartOffset = 0;
-    if (rangeCtlFlags.Has(kRange_StartOffset))
+    if (rangeCtlFlags.Has(RangeControlFlags::kStartOffset))
     {
-        if (rangeCtlFlags.Has(kRange_Widerange))
+        if (rangeCtlFlags.Has(RangeControlFlags::kWiderange))
         {
             SuccessOrExit(bufReader.Read64(&StartOffset).StatusCode());
         }
@@ -354,9 +341,9 @@ CHIP_ERROR ReceiveAccept::Parse(System::PacketBufferHandle aBuffer)
     }
 
     Length = 0;
-    if (rangeCtlFlags.Has(kRange_DefLen))
+    if (rangeCtlFlags.Has(RangeControlFlags::kDefLen))
     {
-        if (rangeCtlFlags.Has(kRange_Widerange))
+        if (rangeCtlFlags.Has(RangeControlFlags::kWiderange))
         {
             SuccessOrExit(bufReader.Read64(&Length).StatusCode());
         }
@@ -406,7 +393,7 @@ bool ReceiveAccept::operator==(const ReceiveAccept & another) const
         metadataMatches = (memcmp(Metadata, another.Metadata, MetadataLength) == 0);
     }
 
-    return ((Version == another.Version) && (TransferCtlFlags.Raw() == another.TransferCtlFlags.Raw()) &&
+    return ((Version == another.Version) && (TransferCtlFlags == another.TransferCtlFlags) &&
             (StartOffset == another.StartOffset) && (MaxBlockSize == another.MaxBlockSize) && (Length == another.Length) &&
             metadataMatches);
 }
index 6dabe6b..ccef89f 100644 (file)
@@ -45,39 +45,39 @@ enum class MessageType : uint8_t
     BlockAckEOF   = 0x14,
 };
 
-enum StatusCode : uint16_t
+enum class StatusCode : uint16_t
 {
-    kStatus_None                       = 0x0000,
-    kStatus_Overflow                   = 0x0011,
-    kStatus_LengthTooLarge             = 0x0012,
-    kStatus_LengthTooShort             = 0x0013,
-    kStatus_LengthMismatch             = 0x0014,
-    kStatus_LengthRequired             = 0x0015,
-    kStatus_BadMessageContents         = 0x0016,
-    kStatus_BadBlockCounter            = 0x0017,
-    kStatus_TransferFailedUnknownError = 0x001F,
-    kStatus_ServerBadState             = 0x0020,
-    kStatus_FailureToSend              = 0x0021,
-    kStatus_TransferMethodNotSupported = 0x0050,
-    kStatus_FileDesignatorUnknown      = 0x0051,
-    kStatus_StartOffsetNotSupported    = 0x0052,
-    kStatus_VersionNotSupported        = 0x0053,
-    kStatus_Unknown                    = 0x005F,
+    kNone                       = 0x0000,
+    kOverflow                   = 0x0011,
+    kLengthTooLarge             = 0x0012,
+    kLengthTooShort             = 0x0013,
+    kLengthMismatch             = 0x0014,
+    kLengthRequired             = 0x0015,
+    kBadMessageContents         = 0x0016,
+    kBadBlockCounter            = 0x0017,
+    kTransferFailedUnknownError = 0x001F,
+    kServerBadState             = 0x0020,
+    kFailureToSend              = 0x0021,
+    kTransferMethodNotSupported = 0x0050,
+    kFileDesignatorUnknown      = 0x0051,
+    kStartOffsetNotSupported    = 0x0052,
+    kVersionNotSupported        = 0x0053,
+    kUnknown                    = 0x005F,
 };
 
-enum TransferControlFlags : uint8_t
+enum class TransferControlFlags : uint8_t
 {
     // first 4 bits reserved for version
-    kControl_SenderDrive   = (1U << 4),
-    kControl_ReceiverDrive = (1U << 5),
-    kControl_Async         = (1U << 6),
+    kSenderDrive   = (1U << 4),
+    kReceiverDrive = (1U << 5),
+    kAsync         = (1U << 6),
 };
 
-enum RangeControlFlags : uint8_t
+enum class RangeControlFlags : uint8_t
 {
-    kRange_DefLen      = (1U),
-    kRange_StartOffset = (1U << 1),
-    kRange_Widerange   = (1U << 4),
+    kDefLen      = (1U),
+    kStartOffset = (1U << 1),
+    kWiderange   = (1U << 4),
 };
 
 /**
@@ -136,7 +136,7 @@ struct TransferInit : public BdxMessage
     bool operator==(const TransferInit &) const;
 
     // Proposed Transfer Control (required)
-    BitFlags<uint8_t, TransferControlFlags> TransferCtlOptions;
+    BitFlags<TransferControlFlags> TransferCtlOptions;
     uint8_t Version = 0; ///< The highest version supported by the sender
 
     // All required
@@ -175,7 +175,7 @@ struct SendAccept : public BdxMessage
     bool operator==(const SendAccept &) const;
 
     // Transfer Control (required, only one should be set)
-    BitFlags<uint8_t, TransferControlFlags> TransferCtlFlags;
+    BitFlags<TransferControlFlags> TransferCtlFlags;
 
     uint8_t Version       = 0; ///< The agreed upon version for the transfer (required)
     uint16_t MaxBlockSize = 0; ///< Chosen max block size to use in transfer (required)
@@ -206,7 +206,7 @@ struct ReceiveAccept : public BdxMessage
     bool operator==(const ReceiveAccept &) const;
 
     // Transfer Control (required, only one should be set)
-    BitFlags<uint8_t, TransferControlFlags> TransferCtlFlags;
+    BitFlags<TransferControlFlags> TransferCtlFlags;
 
     // All required
     uint8_t Version       = 0; ///< The agreed upon version for the transfer
index cea58bf..57245c5 100644 (file)
@@ -67,12 +67,12 @@ namespace bdx {
 
 TransferSession::TransferSession()
 {
-    mSuppportedXferOpts.SetRaw(0);
+    mSuppportedXferOpts.ClearAll();
 }
 
 void TransferSession::PollOutput(OutputEvent & event, uint64_t curTimeMs)
 {
-    event = OutputEvent(kNone);
+    event = OutputEvent(OutputEventType::kNone);
 
     if (mShouldInitTimeoutStart)
     {
@@ -82,60 +82,60 @@ void TransferSession::PollOutput(OutputEvent & event, uint64_t curTimeMs)
 
     if (mAwaitingResponse && ((curTimeMs - mTimeoutStartTimeMs) >= mTimeoutMs))
     {
-        event             = OutputEvent(kTransferTimeout);
-        mState            = kErrorState;
+        event             = OutputEvent(OutputEventType::kTransferTimeout);
+        mState            = TransferState::kErrorState;
         mAwaitingResponse = false;
         return;
     }
 
     switch (mPendingOutput)
     {
-    case kNone:
-        event = OutputEvent(kNone);
+    case OutputEventType::kNone:
+        event = OutputEvent(OutputEventType::kNone);
         break;
-    case kInternalError:
-        event = OutputEvent::StatusReportEvent(kInternalError, mStatusReportData);
+    case OutputEventType::kInternalError:
+        event = OutputEvent::StatusReportEvent(OutputEventType::kInternalError, mStatusReportData);
         break;
-    case kStatusReceived:
-        event = OutputEvent::StatusReportEvent(kStatusReceived, mStatusReportData);
+    case OutputEventType::kStatusReceived:
+        event = OutputEvent::StatusReportEvent(OutputEventType::kStatusReceived, mStatusReportData);
         break;
-    case kMsgToSend:
-        event               = OutputEvent(kMsgToSend);
+    case OutputEventType::kMsgToSend:
+        event               = OutputEvent(OutputEventType::kMsgToSend);
         event.MsgData       = std::move(mPendingMsgHandle);
         mTimeoutStartTimeMs = curTimeMs;
         break;
-    case kInitReceived:
+    case OutputEventType::kInitReceived:
         event = OutputEvent::TransferInitEvent(mTransferRequestData, std::move(mPendingMsgHandle));
         break;
-    case kAcceptReceived:
+    case OutputEventType::kAcceptReceived:
         event = OutputEvent::TransferAcceptEvent(mTransferAcceptData, std::move(mPendingMsgHandle));
         break;
-    case kQueryReceived:
-        event = OutputEvent(kQueryReceived);
+    case OutputEventType::kQueryReceived:
+        event = OutputEvent(OutputEventType::kQueryReceived);
         break;
-    case kBlockReceived:
+    case OutputEventType::kBlockReceived:
         event = OutputEvent::BlockDataEvent(mBlockEventData, std::move(mPendingMsgHandle));
         break;
-    case kAckReceived:
-        event = OutputEvent(kAckReceived);
+    case OutputEventType::kAckReceived:
+        event = OutputEvent(OutputEventType::kAckReceived);
         break;
-    case kAckEOFReceived:
-        event = OutputEvent(kAckEOFReceived);
+    case OutputEventType::kAckEOFReceived:
+        event = OutputEvent(OutputEventType::kAckEOFReceived);
         break;
     default:
-        event = OutputEvent(kNone);
+        event = OutputEvent(OutputEventType::kNone);
         break;
     }
 
     // If there's no other pending output but an error occured or was received, then continue to output the error.
     // This ensures that when the TransferSession encounters an error and needs to send a StatusReport, both a kMsgToSend and a
     // kInternalError output event will be emitted.
-    if (event.EventType == kNone && mState == kErrorState)
+    if (event.EventType == OutputEventType::kNone && mState == TransferState::kErrorState)
     {
-        event = OutputEvent::StatusReportEvent(kInternalError, mStatusReportData);
+        event = OutputEvent::StatusReportEvent(OutputEventType::kInternalError, mStatusReportData);
     }
 
-    mPendingOutput = kNone;
+    mPendingOutput = OutputEventType::kNone;
 }
 
 CHIP_ERROR TransferSession::StartTransfer(TransferRole role, const TransferInitData & initData, uint32_t timeoutMs)
@@ -144,50 +144,50 @@ CHIP_ERROR TransferSession::StartTransfer(TransferRole role, const TransferInitD
     MessageType msgType;
     TransferInit initMsg;
 
-    VerifyOrExit(mState == kUnitialized, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mState == TransferState::kUnitialized, err = CHIP_ERROR_INCORRECT_STATE);
 
     mRole      = role;
     mTimeoutMs = timeoutMs;
 
     // Set transfer parameters. They may be overridden later by an Accept message
-    mSuppportedXferOpts.SetRaw(initData.TransferCtlFlagsRaw);
+    mSuppportedXferOpts    = initData.TransferCtlFlags;
     mMaxSupportedBlockSize = initData.MaxBlockSize;
     mStartOffset           = initData.StartOffset;
     mTransferLength        = initData.Length;
 
     // Prepare TransferInit message
-    initMsg.TransferCtlOptions.SetRaw(initData.TransferCtlFlagsRaw);
-    initMsg.Version        = kBdxVersion;
-    initMsg.MaxBlockSize   = mMaxSupportedBlockSize;
-    initMsg.StartOffset    = mStartOffset;
-    initMsg.MaxLength      = mTransferLength;
-    initMsg.FileDesignator = initData.FileDesignator;
-    initMsg.FileDesLength  = initData.FileDesLength;
-    initMsg.Metadata       = initData.Metadata;
-    initMsg.MetadataLength = initData.MetadataLength;
+    initMsg.TransferCtlOptions = initData.TransferCtlFlags;
+    initMsg.Version            = kBdxVersion;
+    initMsg.MaxBlockSize       = mMaxSupportedBlockSize;
+    initMsg.StartOffset        = mStartOffset;
+    initMsg.MaxLength          = mTransferLength;
+    initMsg.FileDesignator     = initData.FileDesignator;
+    initMsg.FileDesLength      = initData.FileDesLength;
+    initMsg.Metadata           = initData.Metadata;
+    initMsg.MetadataLength     = initData.MetadataLength;
 
     err = WriteToPacketBuffer(initMsg, mPendingMsgHandle);
     SuccessOrExit(err);
 
-    msgType = (mRole == kRole_Sender) ? MessageType::SendInit : MessageType::ReceiveInit;
+    msgType = (mRole == TransferRole::kSender) ? MessageType::SendInit : MessageType::ReceiveInit;
     err     = AttachHeader(msgType, mPendingMsgHandle);
     SuccessOrExit(err);
 
-    mState            = kAwaitingAccept;
+    mState            = TransferState::kAwaitingAccept;
     mAwaitingResponse = true;
 
-    mPendingOutput = kMsgToSend;
+    mPendingOutput = OutputEventType::kMsgToSend;
 
 exit:
     return err;
 }
 
-CHIP_ERROR TransferSession::WaitForTransfer(TransferRole role, BitFlags<uint8_t, TransferControlFlags> xferControlOpts,
+CHIP_ERROR TransferSession::WaitForTransfer(TransferRole role, BitFlags<TransferControlFlags> xferControlOpts,
                                             uint16_t maxBlockSize, uint32_t timeoutMs)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
 
-    VerifyOrExit(mState == kUnitialized, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mState == TransferState::kUnitialized, err = CHIP_ERROR_INCORRECT_STATE);
 
     // Used to determine compatibility with any future TransferInit parameters
     mRole                  = role;
@@ -195,7 +195,7 @@ CHIP_ERROR TransferSession::WaitForTransfer(TransferRole role, BitFlags<uint8_t,
     mSuppportedXferOpts    = xferControlOpts;
     mMaxSupportedBlockSize = maxBlockSize;
 
-    mState = kAwaitingInitMsg;
+    mState = TransferState::kAwaitingInitMsg;
 
 exit:
     return err;
@@ -205,20 +205,19 @@ CHIP_ERROR TransferSession::AcceptTransfer(const TransferAcceptData & acceptData
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
     System::PacketBufferHandle outMsgBuf;
-    BitFlags<uint8_t, TransferControlFlags> proposedControlOpts;
+    const BitFlags<TransferControlFlags> proposedControlOpts(mTransferRequestData.TransferCtlFlags);
 
-    VerifyOrExit(mState == kNegotiateTransferParams, err = CHIP_ERROR_INCORRECT_STATE);
-    VerifyOrExit(mPendingOutput == kNone, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mState == TransferState::kNegotiateTransferParams, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mPendingOutput == OutputEventType::kNone, err = CHIP_ERROR_INCORRECT_STATE);
 
     // Don't allow a Control method that wasn't supported by the initiator
     // MaxBlockSize can't be larger than the proposed value
-    proposedControlOpts.SetRaw(mTransferRequestData.TransferCtlFlagsRaw);
     VerifyOrExit(proposedControlOpts.Has(acceptData.ControlMode), err = CHIP_ERROR_INVALID_ARGUMENT);
     VerifyOrExit(acceptData.MaxBlockSize <= mTransferRequestData.MaxBlockSize, err = CHIP_ERROR_INVALID_ARGUMENT);
 
     mTransferMaxBlockSize = acceptData.MaxBlockSize;
 
-    if (mRole == kRole_Sender)
+    if (mRole == TransferRole::kSender)
     {
         mStartOffset    = acceptData.StartOffset;
         mTransferLength = acceptData.Length;
@@ -254,12 +253,12 @@ CHIP_ERROR TransferSession::AcceptTransfer(const TransferAcceptData & acceptData
         SuccessOrExit(err);
     }
 
-    mPendingOutput = kMsgToSend;
+    mPendingOutput = OutputEventType::kMsgToSend;
 
-    mState = kTransferInProgress;
+    mState = TransferState::kTransferInProgress;
 
-    if ((mRole == kRole_Receiver && mControlMode == kControl_SenderDrive) ||
-        (mRole == kRole_Sender && mControlMode == kControl_ReceiverDrive))
+    if ((mRole == TransferRole::kReceiver && mControlMode == TransferControlFlags::kSenderDrive) ||
+        (mRole == TransferRole::kSender && mControlMode == TransferControlFlags::kReceiverDrive))
     {
         mAwaitingResponse = true;
     }
@@ -273,9 +272,9 @@ CHIP_ERROR TransferSession::PrepareBlockQuery()
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockQuery queryMsg;
 
-    VerifyOrExit(mState == kTransferInProgress, err = CHIP_ERROR_INCORRECT_STATE);
-    VerifyOrExit(mRole == kRole_Receiver, err = CHIP_ERROR_INCORRECT_STATE);
-    VerifyOrExit(mPendingOutput == kNone, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mState == TransferState::kTransferInProgress, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mRole == TransferRole::kReceiver, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mPendingOutput == OutputEventType::kNone, err = CHIP_ERROR_INCORRECT_STATE);
     VerifyOrExit(!mAwaitingResponse, err = CHIP_ERROR_INCORRECT_STATE);
 
     queryMsg.BlockCounter = mNextQueryNum;
@@ -286,7 +285,7 @@ CHIP_ERROR TransferSession::PrepareBlockQuery()
     err = AttachHeader(MessageType::BlockQuery, mPendingMsgHandle);
     SuccessOrExit(err);
 
-    mPendingOutput = kMsgToSend;
+    mPendingOutput = OutputEventType::kMsgToSend;
 
     mAwaitingResponse = true;
     mLastQueryNum     = mNextQueryNum++;
@@ -301,9 +300,9 @@ CHIP_ERROR TransferSession::PrepareBlock(const BlockData & inData)
     DataBlock blockMsg;
     MessageType msgType;
 
-    VerifyOrExit(mState == kTransferInProgress, err = CHIP_ERROR_INCORRECT_STATE);
-    VerifyOrExit(mRole == kRole_Sender, err = CHIP_ERROR_INCORRECT_STATE);
-    VerifyOrExit(mPendingOutput == kNone, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mState == TransferState::kTransferInProgress, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mRole == TransferRole::kSender, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mPendingOutput == OutputEventType::kNone, err = CHIP_ERROR_INCORRECT_STATE);
     VerifyOrExit(!mAwaitingResponse, err = CHIP_ERROR_INCORRECT_STATE);
 
     // Verify non-zero data is provided and is no longer than MaxBlockSize (BlockEOF may contain 0 length data)
@@ -320,11 +319,11 @@ CHIP_ERROR TransferSession::PrepareBlock(const BlockData & inData)
     err     = AttachHeader(msgType, mPendingMsgHandle);
     SuccessOrExit(err);
 
-    mPendingOutput = kMsgToSend;
+    mPendingOutput = OutputEventType::kMsgToSend;
 
     if (msgType == MessageType::BlockEOF)
     {
-        mState = kAwaitingEOFAck;
+        mState = TransferState::kAwaitingEOFAck;
     }
 
     mAwaitingResponse = true;
@@ -340,12 +339,13 @@ CHIP_ERROR TransferSession::PrepareBlockAck()
     CounterMessage ackMsg;
     MessageType msgType;
 
-    VerifyOrExit(mRole == kRole_Receiver, err = CHIP_ERROR_INCORRECT_STATE);
-    VerifyOrExit((mState == kTransferInProgress) || (mState == kReceivedEOF), err = CHIP_ERROR_INCORRECT_STATE);
-    VerifyOrExit(mPendingOutput == kNone, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mRole == TransferRole::kReceiver, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit((mState == TransferState::kTransferInProgress) || (mState == TransferState::kReceivedEOF),
+                 err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mPendingOutput == OutputEventType::kNone, err = CHIP_ERROR_INCORRECT_STATE);
 
     ackMsg.BlockCounter = mLastBlockNum;
-    msgType             = (mState == kReceivedEOF) ? MessageType::BlockAckEOF : MessageType::BlockAck;
+    msgType             = (mState == TransferState::kReceivedEOF) ? MessageType::BlockAckEOF : MessageType::BlockAck;
 
     err = WriteToPacketBuffer(ackMsg, mPendingMsgHandle);
     SuccessOrExit(err);
@@ -353,9 +353,9 @@ CHIP_ERROR TransferSession::PrepareBlockAck()
     err = AttachHeader(msgType, mPendingMsgHandle);
     SuccessOrExit(err);
 
-    if (mState == kTransferInProgress)
+    if (mState == TransferState::kTransferInProgress)
     {
-        if (mControlMode == kControl_SenderDrive)
+        if (mControlMode == TransferControlFlags::kSenderDrive)
         {
             // In Sender Drive, a BlockAck is implied to also be a query for the next Block, so expect to receive a Block
             // message.
@@ -363,13 +363,13 @@ CHIP_ERROR TransferSession::PrepareBlockAck()
             mAwaitingResponse = true;
         }
     }
-    else if (mState == kReceivedEOF)
+    else if (mState == TransferState::kReceivedEOF)
     {
-        mState            = kTransferDone;
+        mState            = TransferState::kTransferDone;
         mAwaitingResponse = false;
     }
 
-    mPendingOutput = kMsgToSend;
+    mPendingOutput = OutputEventType::kMsgToSend;
 
 exit:
     return err;
@@ -379,7 +379,8 @@ CHIP_ERROR TransferSession::AbortTransfer(StatusCode reason)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
 
-    VerifyOrExit((mState != kUnitialized) && (mState != kTransferDone) && (mState != kErrorState),
+    VerifyOrExit((mState != TransferState::kUnitialized) && (mState != TransferState::kTransferDone) &&
+                     (mState != TransferState::kErrorState),
                  err = CHIP_ERROR_INCORRECT_STATE);
 
     PrepareStatusReport(reason);
@@ -390,9 +391,9 @@ exit:
 
 void TransferSession::Reset()
 {
-    mPendingOutput = kNone;
-    mState         = kUnitialized;
-    mSuppportedXferOpts.SetRaw(0);
+    mPendingOutput = OutputEventType::kNone;
+    mState         = TransferState::kUnitialized;
+    mSuppportedXferOpts.ClearAll();
     mTransferVersion       = 0;
     mMaxSupportedBlockSize = 0;
     mStartOffset           = 0;
@@ -452,7 +453,7 @@ CHIP_ERROR TransferSession::HandleBdxMessage(PayloadHeader & header, System::Pac
     MessageType msgType = static_cast<MessageType>(header.GetMessageType());
 
     VerifyOrExit(!msg.IsNull(), err = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(mPendingOutput == kNone, err = CHIP_ERROR_INCORRECT_STATE);
+    VerifyOrExit(mPendingOutput == OutputEventType::kNone, err = CHIP_ERROR_INCORRECT_STATE);
 
     switch (msgType)
     {
@@ -501,7 +502,7 @@ CHIP_ERROR TransferSession::HandleStatusReportMessage(PayloadHeader & header, Sy
 {
     VerifyOrReturnError(!msg.IsNull(), CHIP_ERROR_INVALID_ARGUMENT);
 
-    mState            = kErrorState;
+    mState            = TransferState::kErrorState;
     mAwaitingResponse = false;
 
     uint16_t generalCode  = 0;
@@ -511,9 +512,9 @@ CHIP_ERROR TransferSession::HandleStatusReportMessage(PayloadHeader & header, Sy
     ReturnErrorOnFailure(reader.Read16(&generalCode).Read32(&protocolId).Read16(&protocolCode).StatusCode());
     VerifyOrReturnError((protocolId == Protocols::kProtocol_BDX), CHIP_ERROR_INVALID_MESSAGE_TYPE);
 
-    mStatusReportData.StatusCode = protocolCode;
+    mStatusReportData.statusCode = static_cast<StatusCode>(protocolCode);
 
-    mPendingOutput = kStatusReceived;
+    mPendingOutput = OutputEventType::kStatusReceived;
 
     return CHIP_NO_ERROR;
 }
@@ -523,19 +524,19 @@ void TransferSession::HandleTransferInit(MessageType msgType, System::PacketBuff
     CHIP_ERROR err = CHIP_NO_ERROR;
     TransferInit transferInit;
 
-    VerifyOrExit(mState == kAwaitingInitMsg, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mState == TransferState::kAwaitingInitMsg, PrepareStatusReport(StatusCode::kServerBadState));
 
-    if (mRole == kRole_Sender)
+    if (mRole == TransferRole::kSender)
     {
-        VerifyOrExit(msgType == MessageType::ReceiveInit, PrepareStatusReport(kStatus_ServerBadState));
+        VerifyOrExit(msgType == MessageType::ReceiveInit, PrepareStatusReport(StatusCode::kServerBadState));
     }
     else
     {
-        VerifyOrExit(msgType == MessageType::SendInit, PrepareStatusReport(kStatus_ServerBadState));
+        VerifyOrExit(msgType == MessageType::SendInit, PrepareStatusReport(StatusCode::kServerBadState));
     }
 
     err = transferInit.Parse(msgData.Retain());
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
 
     ResolveTransferControlOptions(transferInit.TransferCtlOptions);
     mTransferVersion      = ::chip::min(kBdxVersion, transferInit.Version);
@@ -546,19 +547,19 @@ void TransferSession::HandleTransferInit(MessageType msgType, System::PacketBuff
     mTransferLength = transferInit.MaxLength;
 
     // Store the Request data to share with the caller for verification
-    mTransferRequestData.TransferCtlFlagsRaw = transferInit.TransferCtlOptions.Raw(),
-    mTransferRequestData.MaxBlockSize        = transferInit.MaxBlockSize;
-    mTransferRequestData.StartOffset         = transferInit.StartOffset;
-    mTransferRequestData.Length              = transferInit.MaxLength;
-    mTransferRequestData.FileDesignator      = transferInit.FileDesignator;
-    mTransferRequestData.FileDesLength       = transferInit.FileDesLength;
-    mTransferRequestData.Metadata            = transferInit.Metadata;
-    mTransferRequestData.MetadataLength      = transferInit.MetadataLength;
+    mTransferRequestData.TransferCtlFlags = transferInit.TransferCtlOptions;
+    mTransferRequestData.MaxBlockSize     = transferInit.MaxBlockSize;
+    mTransferRequestData.StartOffset      = transferInit.StartOffset;
+    mTransferRequestData.Length           = transferInit.MaxLength;
+    mTransferRequestData.FileDesignator   = transferInit.FileDesignator;
+    mTransferRequestData.FileDesLength    = transferInit.FileDesLength;
+    mTransferRequestData.Metadata         = transferInit.Metadata;
+    mTransferRequestData.MetadataLength   = transferInit.MetadataLength;
 
     mPendingMsgHandle = std::move(msgData);
-    mPendingOutput    = kInitReceived;
+    mPendingOutput    = OutputEventType::kInitReceived;
 
-    mState = kNegotiateTransferParams;
+    mState = TransferState::kNegotiateTransferParams;
 
 exit:
     return;
@@ -569,11 +570,11 @@ void TransferSession::HandleReceiveAccept(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     ReceiveAccept rcvAcceptMsg;
 
-    VerifyOrExit(mRole == kRole_Receiver, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mState == kAwaitingAccept, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kAwaitingAccept, PrepareStatusReport(StatusCode::kServerBadState));
 
     err = rcvAcceptMsg.Parse(msgData.Retain());
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
 
     // Verify that Accept parameters are compatible with the original proposed parameters
     err = VerifyProposedMode(rcvAcceptMsg.TransferCtlFlags);
@@ -593,10 +594,10 @@ void TransferSession::HandleReceiveAccept(System::PacketBufferHandle msgData)
     mTransferAcceptData.MetadataLength = rcvAcceptMsg.MetadataLength;
 
     mPendingMsgHandle = std::move(msgData);
-    mPendingOutput    = kAcceptReceived;
+    mPendingOutput    = OutputEventType::kAcceptReceived;
 
-    mAwaitingResponse = (mControlMode == kControl_SenderDrive);
-    mState            = kTransferInProgress;
+    mAwaitingResponse = (mControlMode == TransferControlFlags::kSenderDrive);
+    mState            = TransferState::kTransferInProgress;
 
 exit:
     return;
@@ -607,11 +608,11 @@ void TransferSession::HandleSendAccept(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     SendAccept sendAcceptMsg;
 
-    VerifyOrExit(mRole == kRole_Sender, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mState == kAwaitingAccept, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kAwaitingAccept, PrepareStatusReport(StatusCode::kServerBadState));
 
     err = sendAcceptMsg.Parse(msgData.Retain());
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
 
     // Verify that Accept parameters are compatible with the original proposed parameters
     err = VerifyProposedMode(sendAcceptMsg.TransferCtlFlags);
@@ -629,10 +630,10 @@ void TransferSession::HandleSendAccept(System::PacketBufferHandle msgData)
     mTransferAcceptData.MetadataLength = sendAcceptMsg.MetadataLength;
 
     mPendingMsgHandle = std::move(msgData);
-    mPendingOutput    = kAcceptReceived;
+    mPendingOutput    = OutputEventType::kAcceptReceived;
 
-    mAwaitingResponse = (mControlMode == kControl_ReceiverDrive);
-    mState            = kTransferInProgress;
+    mAwaitingResponse = (mControlMode == TransferControlFlags::kReceiverDrive);
+    mState            = TransferState::kTransferInProgress;
 
 exit:
     return;
@@ -643,16 +644,16 @@ void TransferSession::HandleBlockQuery(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockQuery query;
 
-    VerifyOrExit(mRole == kRole_Sender, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mState == kTransferInProgress, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
 
     err = query.Parse(std::move(msgData));
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
 
-    VerifyOrExit(query.BlockCounter == mNextBlockNum, PrepareStatusReport(kStatus_BadBlockCounter));
+    VerifyOrExit(query.BlockCounter == mNextBlockNum, PrepareStatusReport(StatusCode::kBadBlockCounter));
 
-    mPendingOutput = kQueryReceived;
+    mPendingOutput = OutputEventType::kQueryReceived;
 
     mAwaitingResponse = false;
     mLastQueryNum     = query.BlockCounter;
@@ -666,20 +667,20 @@ void TransferSession::HandleBlock(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     Block blockMsg;
 
-    VerifyOrExit(mRole == kRole_Receiver, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mState == kTransferInProgress, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
 
     err = blockMsg.Parse(msgData.Retain());
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
 
-    VerifyOrExit(blockMsg.BlockCounter == mLastQueryNum, PrepareStatusReport(kStatus_BadBlockCounter));
+    VerifyOrExit(blockMsg.BlockCounter == mLastQueryNum, PrepareStatusReport(StatusCode::kBadBlockCounter));
     VerifyOrExit((blockMsg.DataLength > 0) && (blockMsg.DataLength <= mTransferMaxBlockSize),
-                 PrepareStatusReport(kStatus_BadMessageContents));
+                 PrepareStatusReport(StatusCode::kBadMessageContents));
 
     if (IsTransferLengthDefinite())
     {
-        VerifyOrExit(mNumBytesProcessed + blockMsg.DataLength <= mTransferLength, PrepareStatusReport(kStatus_LengthMismatch));
+        VerifyOrExit(mNumBytesProcessed + blockMsg.DataLength <= mTransferLength, PrepareStatusReport(StatusCode::kLengthMismatch));
     }
 
     mBlockEventData.Data   = blockMsg.Data;
@@ -687,7 +688,7 @@ void TransferSession::HandleBlock(System::PacketBufferHandle msgData)
     mBlockEventData.IsEof  = false;
 
     mPendingMsgHandle = std::move(msgData);
-    mPendingOutput    = kBlockReceived;
+    mPendingOutput    = OutputEventType::kBlockReceived;
 
     mNumBytesProcessed += blockMsg.DataLength;
     mLastBlockNum = blockMsg.BlockCounter;
@@ -703,28 +704,28 @@ void TransferSession::HandleBlockEOF(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockEOF blockEOFMsg;
 
-    VerifyOrExit(mRole == kRole_Receiver, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mState == kTransferInProgress, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
 
     err = blockEOFMsg.Parse(msgData.Retain());
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
 
-    VerifyOrExit(blockEOFMsg.BlockCounter == mLastQueryNum, PrepareStatusReport(kStatus_BadBlockCounter));
-    VerifyOrExit(blockEOFMsg.DataLength <= mTransferMaxBlockSize, PrepareStatusReport(kStatus_BadMessageContents));
+    VerifyOrExit(blockEOFMsg.BlockCounter == mLastQueryNum, PrepareStatusReport(StatusCode::kBadBlockCounter));
+    VerifyOrExit(blockEOFMsg.DataLength <= mTransferMaxBlockSize, PrepareStatusReport(StatusCode::kBadMessageContents));
 
     mBlockEventData.Data   = blockEOFMsg.Data;
     mBlockEventData.Length = blockEOFMsg.DataLength;
     mBlockEventData.IsEof  = true;
 
     mPendingMsgHandle = std::move(msgData);
-    mPendingOutput    = kBlockReceived;
+    mPendingOutput    = OutputEventType::kBlockReceived;
 
     mNumBytesProcessed += blockEOFMsg.DataLength;
     mLastBlockNum = blockEOFMsg.BlockCounter;
 
     mAwaitingResponse = false;
-    mState            = kReceivedEOF;
+    mState            = TransferState::kReceivedEOF;
 
 exit:
     return;
@@ -735,19 +736,19 @@ void TransferSession::HandleBlockAck(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockAck ackMsg;
 
-    VerifyOrExit(mRole == kRole_Sender, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mState == kTransferInProgress, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
 
     err = ackMsg.Parse(std::move(msgData));
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
-    VerifyOrExit(ackMsg.BlockCounter == mLastBlockNum, PrepareStatusReport(kStatus_BadBlockCounter));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
+    VerifyOrExit(ackMsg.BlockCounter == mLastBlockNum, PrepareStatusReport(StatusCode::kBadBlockCounter));
 
-    mPendingOutput = kAckReceived;
+    mPendingOutput = OutputEventType::kAckReceived;
 
     // In Receiver Drive, the Receiver can send a BlockAck to indicate receipt of the message and reset the timeout.
     // In this case, the Sender should wait to receive a BlockQuery next.
-    mAwaitingResponse = (mControlMode == kControl_ReceiverDrive);
+    mAwaitingResponse = (mControlMode == TransferControlFlags::kReceiverDrive);
 
 exit:
     return;
@@ -758,75 +759,75 @@ void TransferSession::HandleBlockAckEOF(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockAckEOF ackMsg;
 
-    VerifyOrExit(mRole == kRole_Sender, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mState == kAwaitingEOFAck, PrepareStatusReport(kStatus_ServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(kStatus_ServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kAwaitingEOFAck, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
 
     err = ackMsg.Parse(std::move(msgData));
-    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(kStatus_BadMessageContents));
-    VerifyOrExit(ackMsg.BlockCounter == mLastBlockNum, PrepareStatusReport(kStatus_BadBlockCounter));
+    VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
+    VerifyOrExit(ackMsg.BlockCounter == mLastBlockNum, PrepareStatusReport(StatusCode::kBadBlockCounter));
 
-    mPendingOutput = kAckEOFReceived;
+    mPendingOutput = OutputEventType::kAckEOFReceived;
 
     mAwaitingResponse = false;
 
-    mState = kTransferDone;
+    mState = TransferState::kTransferDone;
 
 exit:
     return;
 }
 
-void TransferSession::ResolveTransferControlOptions(const BitFlags<uint8_t, TransferControlFlags> & proposed)
+void TransferSession::ResolveTransferControlOptions(const BitFlags<TransferControlFlags> & proposed)
 {
     // Must specify at least one synchronous option
-    if (!proposed.Has(kControl_SenderDrive) && !proposed.Has(kControl_ReceiverDrive))
+    //
+    if (!proposed.HasAny(TransferControlFlags::kSenderDrive, TransferControlFlags::kReceiverDrive))
     {
-        PrepareStatusReport(kStatus_TransferMethodNotSupported);
+        PrepareStatusReport(StatusCode::kTransferMethodNotSupported);
         return;
     }
 
     // Ensure there are options supported by both nodes. Async gets priority.
     // If there is only one common option, choose that one. Otherwise the application must pick.
-    BitFlags<uint8_t, TransferControlFlags> commonOpts;
-    commonOpts.SetRaw(proposed.Raw() & mSuppportedXferOpts.Raw());
-    if (commonOpts.Raw() == 0)
+    const BitFlags<TransferControlFlags> commonOpts(proposed & mSuppportedXferOpts);
+    if (!commonOpts.HasAny())
     {
-        PrepareStatusReport(kStatus_TransferMethodNotSupported);
+        PrepareStatusReport(StatusCode::kTransferMethodNotSupported);
     }
-    else if (commonOpts.HasOnly(kControl_Async))
+    else if (commonOpts.HasOnly(TransferControlFlags::kAsync))
     {
-        mControlMode = kControl_Async;
+        mControlMode = TransferControlFlags::kAsync;
     }
-    else if (commonOpts.HasOnly(kControl_ReceiverDrive))
+    else if (commonOpts.HasOnly(TransferControlFlags::kReceiverDrive))
     {
-        mControlMode = kControl_ReceiverDrive;
+        mControlMode = TransferControlFlags::kReceiverDrive;
     }
-    else if (commonOpts.HasOnly(kControl_SenderDrive))
+    else if (commonOpts.HasOnly(TransferControlFlags::kSenderDrive))
     {
-        mControlMode = kControl_SenderDrive;
+        mControlMode = TransferControlFlags::kSenderDrive;
     }
 }
 
-CHIP_ERROR TransferSession::VerifyProposedMode(const BitFlags<uint8_t, TransferControlFlags> & proposed)
+CHIP_ERROR TransferSession::VerifyProposedMode(const BitFlags<TransferControlFlags> & proposed)
 {
     TransferControlFlags mode;
 
     // Must specify only one mode in Accept messages
-    if (proposed.HasOnly(kControl_Async))
+    if (proposed.HasOnly(TransferControlFlags::kAsync))
     {
-        mode = kControl_Async;
+        mode = TransferControlFlags::kAsync;
     }
-    else if (proposed.HasOnly(kControl_ReceiverDrive))
+    else if (proposed.HasOnly(TransferControlFlags::kReceiverDrive))
     {
-        mode = kControl_ReceiverDrive;
+        mode = TransferControlFlags::kReceiverDrive;
     }
-    else if (proposed.HasOnly(kControl_SenderDrive))
+    else if (proposed.HasOnly(TransferControlFlags::kSenderDrive))
     {
-        mode = kControl_SenderDrive;
+        mode = TransferControlFlags::kSenderDrive;
     }
     else
     {
-        PrepareStatusReport(kStatus_BadMessageContents);
+        PrepareStatusReport(StatusCode::kBadMessageContents);
         return CHIP_ERROR_INTERNAL;
     }
 
@@ -837,7 +838,7 @@ CHIP_ERROR TransferSession::VerifyProposedMode(const BitFlags<uint8_t, TransferC
     }
     else
     {
-        PrepareStatusReport(kStatus_TransferMethodNotSupported);
+        PrepareStatusReport(StatusCode::kTransferMethodNotSupported);
         return CHIP_ERROR_INTERNAL;
     }
 
@@ -846,29 +847,29 @@ CHIP_ERROR TransferSession::VerifyProposedMode(const BitFlags<uint8_t, TransferC
 
 void TransferSession::PrepareStatusReport(StatusCode code)
 {
-    mStatusReportData.StatusCode = code;
+    mStatusReportData.statusCode = code;
 
     Encoding::LittleEndian::PacketBufferWriter bbuf(chip::MessagePacketBuffer::New(kStatusReportMinSize), kStatusReportMinSize);
     VerifyOrReturn(!bbuf.IsNull());
 
     bbuf.Put16(static_cast<uint16_t>(Protocols::Common::StatusCode::Failure));
     bbuf.Put32(Protocols::kProtocol_BDX);
-    bbuf.Put16(mStatusReportData.StatusCode);
+    bbuf.Put16(static_cast<uint16_t>(mStatusReportData.statusCode));
 
     mPendingMsgHandle = bbuf.Finalize();
     if (mPendingMsgHandle.IsNull())
     {
-        mPendingOutput = kInternalError;
+        mPendingOutput = OutputEventType::kInternalError;
     }
     else
     {
         CHIP_ERROR err = AttachHeader(Protocols::Common::MsgType::StatusReport, mPendingMsgHandle);
         VerifyOrReturn(err == CHIP_NO_ERROR);
 
-        mPendingOutput = kMsgToSend;
+        mPendingOutput = OutputEventType::kMsgToSend;
     }
 
-    mState            = kErrorState;
+    mState            = TransferState::kErrorState;
     mAwaitingResponse = false; // Prevent triggering timeout
 }
 
@@ -879,7 +880,7 @@ bool TransferSession::IsTransferLengthDefinite()
 
 TransferSession::OutputEvent TransferSession::OutputEvent::TransferInitEvent(TransferInitData data, System::PacketBufferHandle msg)
 {
-    OutputEvent event(kInitReceived);
+    OutputEvent event(OutputEventType::kInitReceived);
     event.MsgData          = std::move(msg);
     event.transferInitData = data;
     return event;
@@ -891,7 +892,7 @@ TransferSession::OutputEvent TransferSession::OutputEvent::TransferInitEvent(Tra
  */
 TransferSession::OutputEvent TransferSession::OutputEvent::TransferAcceptEvent(TransferAcceptData data)
 {
-    OutputEvent event(kAcceptReceived);
+    OutputEvent event(OutputEventType::kAcceptReceived);
     event.transferAcceptData = data;
     return event;
 }
@@ -909,7 +910,7 @@ TransferSession::OutputEvent TransferSession::OutputEvent::TransferAcceptEvent(T
 
 TransferSession::OutputEvent TransferSession::OutputEvent::BlockDataEvent(BlockData data, System::PacketBufferHandle msg)
 {
-    OutputEvent event(kBlockReceived);
+    OutputEvent event(OutputEventType::kBlockReceived);
     event.MsgData   = std::move(msg);
     event.blockdata = data;
     return event;
index e3b5831..871f38b 100644 (file)
 namespace chip {
 namespace bdx {
 
-enum TransferRole : uint8_t
+enum class TransferRole : uint8_t
 {
-    kRole_Receiver = 0,
-    kRole_Sender   = 1,
+    kReceiver = 0,
+    kSender   = 1,
 };
 
 class DLL_EXPORT TransferSession
 {
 public:
-    enum OutputEventType : uint16_t
+    enum class OutputEventType : uint16_t
     {
         kNone = 0,
         kMsgToSend,
@@ -41,7 +41,7 @@ public:
 
     struct TransferInitData
     {
-        uint8_t TransferCtlFlagsRaw = 0;
+        TransferControlFlags TransferCtlFlags;
 
         uint16_t MaxBlockSize = 0;
         uint64_t StartOffset  = 0;
@@ -70,7 +70,7 @@ public:
 
     struct StatusReportData
     {
-        uint16_t StatusCode;
+        StatusCode statusCode;
     };
 
     struct BlockData
@@ -99,8 +99,8 @@ public:
             StatusReportData statusData;
         };
 
-        OutputEvent() : EventType(kNone) { statusData = { kStatus_None }; }
-        OutputEvent(OutputEventType type) : EventType(type) { statusData = { kStatus_None }; }
+        OutputEvent() : EventType(OutputEventType::kNone) { statusData = { StatusCode::kNone }; }
+        OutputEvent(OutputEventType type) : EventType(type) { statusData = { StatusCode::kNone }; }
 
         static OutputEvent TransferInitEvent(TransferInitData data, System::PacketBufferHandle msg);
         static OutputEvent TransferAcceptEvent(TransferAcceptData data);
@@ -160,7 +160,7 @@ public:
      * @return CHIP_ERROR Result of initialization. May also indicate if the TransferSession object is unable to handle this
      *                    request.
      */
-    CHIP_ERROR WaitForTransfer(TransferRole role, BitFlags<uint8_t, TransferControlFlags> xferControlOpts, uint16_t maxBlockSize,
+    CHIP_ERROR WaitForTransfer(TransferRole role, BitFlags<TransferControlFlags> xferControlOpts, uint16_t maxBlockSize,
                                uint32_t timeoutMs);
 
     /**
@@ -252,7 +252,7 @@ public:
     TransferSession();
 
 private:
-    enum TransferState : uint8_t
+    enum class TransferState : uint8_t
     {
         kUnitialized,
         kAwaitingInitMsg,
@@ -282,23 +282,23 @@ private:
      *   Used when handling a TransferInit message. Determines if there are any compatible Transfer control modes between the two
      *   transfer peers.
      */
-    void ResolveTransferControlOptions(const BitFlags<uint8_t, TransferControlFlags> & proposed);
+    void ResolveTransferControlOptions(const BitFlags<TransferControlFlags> & proposed);
 
     /**
      * @brief
      *   Used when handling an Accept message. Verifies that the chosen control mode is compatible with the orignal supported modes.
      */
-    CHIP_ERROR VerifyProposedMode(const BitFlags<uint8_t, TransferControlFlags> & proposed);
+    CHIP_ERROR VerifyProposedMode(const BitFlags<TransferControlFlags> & proposed);
 
     void PrepareStatusReport(StatusCode code);
     bool IsTransferLengthDefinite();
 
-    OutputEventType mPendingOutput = kNone;
-    TransferState mState           = kUnitialized;
+    OutputEventType mPendingOutput = OutputEventType::kNone;
+    TransferState mState           = TransferState::kUnitialized;
     TransferRole mRole;
 
     // Indicate supported options pre- transfer accept
-    BitFlags<uint8_t, TransferControlFlags> mSuppportedXferOpts;
+    BitFlags<TransferControlFlags> mSuppportedXferOpts;
     uint16_t mMaxSupportedBlockSize = 0;
 
     // Used to govern transfer once it has been accepted
index bd618af..3fd9b4d 100644 (file)
@@ -43,8 +43,7 @@ void TestTransferInitMessage(nlTestSuite * inSuite, void * inContext)
 {
     TransferInit testMsg;
 
-    testMsg.TransferCtlOptions.SetRaw(0);
-    testMsg.TransferCtlOptions.Set(kControl_ReceiverDrive, true);
+    testMsg.TransferCtlOptions.ClearAll().Set(TransferControlFlags::kReceiverDrive, true);
     testMsg.Version = 1;
 
     // Make sure MaxLength is greater than UINT32_MAX to test widerange being set
@@ -69,8 +68,7 @@ void TestSendAcceptMessage(nlTestSuite * inSuite, void * inContext)
     SendAccept testMsg;
 
     testMsg.Version = 1;
-    testMsg.TransferCtlFlags.SetRaw(0);
-    testMsg.TransferCtlFlags.Set(kControl_ReceiverDrive, true);
+    testMsg.TransferCtlFlags.ClearAll().Set(TransferControlFlags::kReceiverDrive, true);
     testMsg.MaxBlockSize = 256;
 
     uint8_t fakeData[5]    = { 7, 6, 5, 4, 3 };
@@ -85,8 +83,7 @@ void TestReceiveAcceptMessage(nlTestSuite * inSuite, void * inContext)
     ReceiveAccept testMsg;
 
     testMsg.Version = 1;
-    testMsg.TransferCtlFlags.SetRaw(0);
-    testMsg.TransferCtlFlags.Set(kControl_ReceiverDrive, true);
+    testMsg.TransferCtlFlags.ClearAll().Set(TransferControlFlags::kReceiverDrive, true);
 
     // Make sure Length is greater than UINT32_MAX to test widerange being set
     testMsg.Length = static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()) + 1;
index ab362a5..8ee740b 100644 (file)
@@ -115,9 +115,9 @@ void VerifyStatusReport(nlTestSuite * inSuite, void * inContext, const System::P
     CHIP_ERROR err      = CHIP_NO_ERROR;
     uint16_t headerSize = 0;
     PayloadHeader payloadHeader;
-    uint16_t generalCode  = 0;
-    uint32_t protocolId   = 0;
-    uint16_t protocolCode = 0;
+    uint16_t generalCode = 0;
+    uint32_t protocolId  = 0;
+    BitFlags<StatusCode> protocolCode;
 
     if (msg.IsNull())
     {
@@ -136,7 +136,7 @@ void VerifyStatusReport(nlTestSuite * inSuite, void * inContext, const System::P
     }
 
     Encoding::LittleEndian::Reader reader(msg->Start(), msg->DataLength());
-    err = reader.Skip(headerSize).Read16(&generalCode).Read32(&protocolId).Read16(&protocolCode).StatusCode();
+    err = reader.Skip(headerSize).Read16(&generalCode).Read32(&protocolId).Read16(protocolCode.RawStorage()).StatusCode();
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     NL_TEST_ASSERT(inSuite, generalCode == static_cast<uint16_t>(Protocols::Common::StatusCode::Failure));
     NL_TEST_ASSERT(inSuite, protocolId == Protocols::kProtocol_BDX);
@@ -147,19 +147,19 @@ void VerifyNoMoreOutput(nlTestSuite * inSuite, void * inContext, TransferSession
 {
     TransferSession::OutputEvent event;
     transferSession.PollOutput(event, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, event.EventType == TransferSession::kNone);
+    NL_TEST_ASSERT(inSuite, event.EventType == TransferSession::OutputEventType::kNone);
 }
 
 // Helper method for initializing two TransferSession objects, generating a TransferInit message, and passing it to a responding
 // TransferSession.
 void SendAndVerifyTransferInit(nlTestSuite * inSuite, void * inContext, TransferSession::OutputEvent & outEvent, uint32_t timeoutMs,
                                TransferSession & initiator, TransferRole initiatorRole, TransferSession::TransferInitData initData,
-                               TransferSession & responder, BitFlags<uint8_t, TransferControlFlags> & responderControlOpts,
+                               TransferSession & responder, BitFlags<TransferControlFlags> & responderControlOpts,
                                uint16_t responderMaxBlock)
 {
     CHIP_ERROR err              = CHIP_NO_ERROR;
-    TransferRole responderRole  = (initiatorRole == kRole_Sender) ? kRole_Receiver : kRole_Sender;
-    MessageType expectedInitMsg = (initiatorRole == kRole_Sender) ? MessageType::SendInit : MessageType::ReceiveInit;
+    TransferRole responderRole  = (initiatorRole == TransferRole::kSender) ? TransferRole::kReceiver : TransferRole::kSender;
+    MessageType expectedInitMsg = (initiatorRole == TransferRole::kSender) ? MessageType::SendInit : MessageType::ReceiveInit;
 
     // Initializer responder to wait for transfer
     err = responder.WaitForTransfer(responderRole, responderControlOpts, responderMaxBlock, timeoutMs);
@@ -170,7 +170,7 @@ void SendAndVerifyTransferInit(nlTestSuite * inSuite, void * inContext, Transfer
     err = initiator.StartTransfer(initiatorRole, initData, timeoutMs);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     initiator.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kMsgToSend);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend);
     VerifyBdxMessageType(inSuite, inContext, outEvent.MsgData, expectedInitMsg);
     VerifyNoMoreOutput(inSuite, inContext, initiator);
 
@@ -179,14 +179,15 @@ void SendAndVerifyTransferInit(nlTestSuite * inSuite, void * inContext, Transfer
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     responder.PollOutput(outEvent, kNoAdvanceTime);
     VerifyNoMoreOutput(inSuite, inContext, responder);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kInitReceived);
-    NL_TEST_ASSERT(inSuite, outEvent.transferInitData.TransferCtlFlagsRaw == initData.TransferCtlFlagsRaw);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kInitReceived);
+    NL_TEST_ASSERT(inSuite, outEvent.transferInitData.TransferCtlFlags == initData.TransferCtlFlags);
     NL_TEST_ASSERT(inSuite, outEvent.transferInitData.MaxBlockSize == initData.MaxBlockSize);
     NL_TEST_ASSERT(inSuite, outEvent.transferInitData.StartOffset == initData.StartOffset);
     NL_TEST_ASSERT(inSuite, outEvent.transferInitData.Length == initData.Length);
     NL_TEST_ASSERT(inSuite, outEvent.transferInitData.FileDesignator != nullptr);
     NL_TEST_ASSERT(inSuite, outEvent.transferInitData.FileDesLength == initData.FileDesLength);
-    if (outEvent.EventType == TransferSession::kInitReceived && outEvent.transferInitData.FileDesignator != nullptr)
+    if (outEvent.EventType == TransferSession::OutputEventType::kInitReceived &&
+        outEvent.transferInitData.FileDesignator != nullptr)
     {
         NL_TEST_ASSERT(
             inSuite,
@@ -223,7 +224,7 @@ void SendAndVerifyAcceptMsg(nlTestSuite * inSuite, void * inContext, TransferSes
     CHIP_ERROR err = CHIP_NO_ERROR;
 
     // If the node sending the Accept message is also the one that will send Blocks, then this should be a ReceiveAccept message.
-    MessageType expectedMsg = (acceptSenderRole == kRole_Sender) ? MessageType::ReceiveAccept : MessageType::SendAccept;
+    MessageType expectedMsg = (acceptSenderRole == TransferRole::kSender) ? MessageType::ReceiveAccept : MessageType::SendAccept;
 
     err = acceptSender.AcceptTransfer(acceptData);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
@@ -231,7 +232,7 @@ void SendAndVerifyAcceptMsg(nlTestSuite * inSuite, void * inContext, TransferSes
     // Verify Sender emits ReceiveAccept message for sending
     acceptSender.PollOutput(outEvent, kNoAdvanceTime);
     VerifyNoMoreOutput(inSuite, inContext, acceptSender);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kMsgToSend);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend);
     VerifyBdxMessageType(inSuite, inContext, outEvent.MsgData, expectedMsg);
 
     // Pass Accept message to acceptReceiver
@@ -243,7 +244,7 @@ void SendAndVerifyAcceptMsg(nlTestSuite * inSuite, void * inContext, TransferSes
     // Transfer at this point.
     acceptReceiver.PollOutput(outEvent, kNoAdvanceTime);
     VerifyNoMoreOutput(inSuite, inContext, acceptReceiver);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kAcceptReceived);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kAcceptReceived);
     NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.ControlMode == acceptData.ControlMode);
     NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.MaxBlockSize == acceptData.MaxBlockSize);
     NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.StartOffset == acceptData.StartOffset);
@@ -277,7 +278,7 @@ void SendAndVerifyQuery(nlTestSuite * inSuite, void * inContext, TransferSession
     CHIP_ERROR err = querySender.PrepareBlockQuery();
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     querySender.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kMsgToSend);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend);
     VerifyBdxMessageType(inSuite, inContext, outEvent.MsgData, MessageType::BlockQuery);
     VerifyNoMoreOutput(inSuite, inContext, querySender);
 
@@ -285,7 +286,7 @@ void SendAndVerifyQuery(nlTestSuite * inSuite, void * inContext, TransferSession
     err = queryReceiver.HandleMessageReceived(std::move(outEvent.MsgData), kNoAdvanceTime);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     queryReceiver.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kQueryReceived);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kQueryReceived);
     VerifyNoMoreOutput(inSuite, inContext, queryReceiver);
 }
 
@@ -320,7 +321,7 @@ void SendAndVerifyArbitraryBlock(nlTestSuite * inSuite, void * inContext, Transf
     err = sender.PrepareBlock(blockData);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     sender.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kMsgToSend);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend);
     VerifyBdxMessageType(inSuite, inContext, outEvent.MsgData, expected);
     VerifyNoMoreOutput(inSuite, inContext, sender);
 
@@ -328,9 +329,9 @@ void SendAndVerifyArbitraryBlock(nlTestSuite * inSuite, void * inContext, Transf
     err = receiver.HandleMessageReceived(std::move(outEvent.MsgData), kNoAdvanceTime);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     receiver.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kBlockReceived);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kBlockReceived);
     NL_TEST_ASSERT(inSuite, outEvent.blockdata.Data != nullptr);
-    if (outEvent.EventType == TransferSession::kBlockReceived && outEvent.blockdata.Data != nullptr)
+    if (outEvent.EventType == TransferSession::OutputEventType::kBlockReceived && outEvent.blockdata.Data != nullptr)
     {
         NL_TEST_ASSERT(inSuite, !memcmp(fakeBlockData, outEvent.blockdata.Data, outEvent.blockdata.Length));
     }
@@ -342,14 +343,14 @@ void SendAndVerifyBlockAck(nlTestSuite * inSuite, void * inContext, TransferSess
                            TransferSession::OutputEvent & outEvent, bool expectEOF)
 {
     TransferSession::OutputEventType expectedEventType =
-        expectEOF ? TransferSession::kAckEOFReceived : TransferSession::kAckReceived;
+        expectEOF ? TransferSession::OutputEventType::kAckEOFReceived : TransferSession::OutputEventType::kAckReceived;
     MessageType expectedMsgType = expectEOF ? MessageType::BlockAckEOF : MessageType::BlockAck;
 
     // Verify PrepareBlockAck() outputs message to send
     CHIP_ERROR err = ackSender.PrepareBlockAck();
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     ackSender.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kMsgToSend);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend);
     VerifyBdxMessageType(inSuite, inContext, outEvent.MsgData, expectedMsgType);
     VerifyNoMoreOutput(inSuite, inContext, ackSender);
 
@@ -379,21 +380,21 @@ void TestInitiatingReceiverReceiverDrive(nlTestSuite * inSuite, void * inContext
     uint32_t timeoutMs            = 1000 * 24;
 
     // Chosen specifically for this test
-    TransferControlFlags driveMode = kControl_ReceiverDrive;
+    TransferControlFlags driveMode = TransferControlFlags::kReceiverDrive;
 
     // ReceiveInit parameters
     TransferSession::TransferInitData initOptions;
-    initOptions.TransferCtlFlagsRaw = driveMode;
-    initOptions.MaxBlockSize        = proposedBlockSize;
-    char testFileDes[9]             = { "test.txt" };
-    initOptions.FileDesLength       = static_cast<uint16_t>(strlen(testFileDes));
-    initOptions.FileDesignator      = reinterpret_cast<uint8_t *>(testFileDes);
+    initOptions.TransferCtlFlags = driveMode;
+    initOptions.MaxBlockSize     = proposedBlockSize;
+    char testFileDes[9]          = { "test.txt" };
+    initOptions.FileDesLength    = static_cast<uint16_t>(strlen(testFileDes));
+    initOptions.FileDesignator   = reinterpret_cast<uint8_t *>(testFileDes);
 
     // Initialize respondingSender and pass ReceiveInit message
-    BitFlags<uint8_t, TransferControlFlags> senderOpts;
+    BitFlags<TransferControlFlags> senderOpts;
     senderOpts.Set(driveMode);
 
-    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingReceiver, kRole_Receiver, initOptions,
+    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingReceiver, TransferRole::kReceiver, initOptions,
                               respondingSender, senderOpts, proposedBlockSize);
 
     // Test metadata for Accept message
@@ -413,7 +414,7 @@ void TestInitiatingReceiverReceiverDrive(nlTestSuite * inSuite, void * inContext
     acceptData.Metadata       = tlvBuf;
     acceptData.MetadataLength = metadataSize;
 
-    SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingSender, kRole_Sender, acceptData, initiatingReceiver,
+    SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingSender, TransferRole::kSender, acceptData, initiatingReceiver,
                            initOptions);
 
     // Verify that MaxBlockSize was chosen correctly
@@ -473,14 +474,14 @@ void TestInitiatingSenderSenderDrive(nlTestSuite * inSuite, void * inContext)
     TransferSession initiatingSender;
     TransferSession respondingReceiver;
 
-    TransferControlFlags driveMode = kControl_SenderDrive;
+    TransferControlFlags driveMode = TransferControlFlags::kSenderDrive;
 
     // Chosen arbitrarily for this test
     uint16_t transferBlockSize = 10;
     uint32_t timeoutMs         = 1000 * 24;
 
     // Initialize respondingReceiver
-    BitFlags<uint8_t, TransferControlFlags> receiverOpts;
+    BitFlags<TransferControlFlags> receiverOpts;
     receiverOpts.Set(driveMode);
 
     // Test metadata for TransferInit message
@@ -493,15 +494,15 @@ void TestInitiatingSenderSenderDrive(nlTestSuite * inSuite, void * inContext)
 
     // Initialize struct with TransferInit parameters
     TransferSession::TransferInitData initOptions;
-    initOptions.TransferCtlFlagsRaw = driveMode;
-    initOptions.MaxBlockSize        = transferBlockSize;
-    char testFileDes[9]             = { "test.txt" };
-    initOptions.FileDesLength       = static_cast<uint16_t>(strlen(testFileDes));
-    initOptions.FileDesignator      = reinterpret_cast<uint8_t *>(testFileDes);
-    initOptions.Metadata            = tlvBuf;
-    initOptions.MetadataLength      = metadataSize;
-
-    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingSender, kRole_Sender, initOptions,
+    initOptions.TransferCtlFlags = driveMode;
+    initOptions.MaxBlockSize     = transferBlockSize;
+    char testFileDes[9]          = { "test.txt" };
+    initOptions.FileDesLength    = static_cast<uint16_t>(strlen(testFileDes));
+    initOptions.FileDesignator   = reinterpret_cast<uint8_t *>(testFileDes);
+    initOptions.Metadata         = tlvBuf;
+    initOptions.MetadataLength   = metadataSize;
+
+    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingSender, TransferRole::kSender, initOptions,
                               respondingReceiver, receiverOpts, transferBlockSize);
 
     // Verify parsed TLV metadata matches the original
@@ -519,7 +520,7 @@ void TestInitiatingSenderSenderDrive(nlTestSuite * inSuite, void * inContext)
     acceptData.Metadata       = nullptr;
     acceptData.MetadataLength = 0;
 
-    SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingReceiver, kRole_Receiver, acceptData, initiatingSender,
+    SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingReceiver, TransferRole::kReceiver, acceptData, initiatingSender,
                            initOptions);
 
     // Test multiple Block -> BlockAck -> Block
@@ -542,28 +543,28 @@ void TestBadAcceptMessageFields(nlTestSuite * inSuite, void * inContext)
     TransferSession respondingSender;
 
     uint16_t maxBlockSize          = 64;
-    TransferControlFlags driveMode = kControl_ReceiverDrive;
+    TransferControlFlags driveMode = TransferControlFlags::kReceiverDrive;
     uint64_t commonLength          = 0;
     uint64_t commonOffset          = 0;
     uint32_t timeoutMs             = 1000 * 24;
 
     // Initialize struct with TransferInit parameters
     TransferSession::TransferInitData initOptions;
-    initOptions.TransferCtlFlagsRaw = driveMode;
-    initOptions.MaxBlockSize        = maxBlockSize;
-    initOptions.StartOffset         = commonOffset;
-    initOptions.Length              = commonLength;
-    char testFileDes[9]             = { "test.txt" }; // arbitrary file designator
-    initOptions.FileDesLength       = static_cast<uint16_t>(strlen(testFileDes));
-    initOptions.FileDesignator      = reinterpret_cast<uint8_t *>(testFileDes);
-    initOptions.Metadata            = nullptr;
-    initOptions.MetadataLength      = 0;
+    initOptions.TransferCtlFlags = driveMode;
+    initOptions.MaxBlockSize     = maxBlockSize;
+    initOptions.StartOffset      = commonOffset;
+    initOptions.Length           = commonLength;
+    char testFileDes[9]          = { "test.txt" }; // arbitrary file designator
+    initOptions.FileDesLength    = static_cast<uint16_t>(strlen(testFileDes));
+    initOptions.FileDesignator   = reinterpret_cast<uint8_t *>(testFileDes);
+    initOptions.Metadata         = nullptr;
+    initOptions.MetadataLength   = 0;
 
     // Responder parameters
-    BitFlags<uint8_t, TransferControlFlags> responderControl;
+    BitFlags<TransferControlFlags> responderControl;
     responderControl.Set(driveMode);
 
-    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingReceiver, kRole_Receiver, initOptions,
+    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingReceiver, TransferRole::kReceiver, initOptions,
                               respondingSender, responderControl, maxBlockSize);
 
     // Verify AcceptTransfer() returns error for choosing larger max block size
@@ -577,7 +578,8 @@ void TestBadAcceptMessageFields(nlTestSuite * inSuite, void * inContext)
 
     // Verify AcceptTransfer() returns error for choosing unsupported transfer control mode
     TransferSession::TransferAcceptData acceptData2;
-    acceptData2.ControlMode  = (driveMode == kControl_ReceiverDrive) ? kControl_SenderDrive : kControl_ReceiverDrive;
+    acceptData2.ControlMode = (driveMode == TransferControlFlags::kReceiverDrive) ? TransferControlFlags::kSenderDrive
+                                                                                  : TransferControlFlags::kReceiverDrive;
     acceptData2.MaxBlockSize = maxBlockSize;
     acceptData2.StartOffset  = commonOffset;
     acceptData2.Length       = commonLength;
@@ -598,17 +600,17 @@ void TestTimeout(nlTestSuite * inSuite, void * inContext)
 
     // Initialize struct with arbitrary TransferInit parameters
     TransferSession::TransferInitData initOptions;
-    initOptions.TransferCtlFlagsRaw = kControl_ReceiverDrive;
-    initOptions.MaxBlockSize        = 64;
-    initOptions.StartOffset         = 0;
-    initOptions.Length              = 0;
-    char testFileDes[9]             = { "test.txt" }; // arbitrary file designator
-    initOptions.FileDesLength       = static_cast<uint16_t>(strlen(testFileDes));
-    initOptions.FileDesignator      = reinterpret_cast<uint8_t *>(testFileDes);
-    initOptions.Metadata            = nullptr;
-    initOptions.MetadataLength      = 0;
-
-    TransferRole role = kRole_Receiver;
+    initOptions.TransferCtlFlags = TransferControlFlags::kReceiverDrive;
+    initOptions.MaxBlockSize     = 64;
+    initOptions.StartOffset      = 0;
+    initOptions.Length           = 0;
+    char testFileDes[9]          = { "test.txt" }; // arbitrary file designator
+    initOptions.FileDesLength    = static_cast<uint16_t>(strlen(testFileDes));
+    initOptions.FileDesignator   = reinterpret_cast<uint8_t *>(testFileDes);
+    initOptions.Metadata         = nullptr;
+    initOptions.MetadataLength   = 0;
+
+    TransferRole role = TransferRole::kReceiver;
 
     // Verify initiator outputs respective Init message (depending on role) after StartTransfer()
     err = initiator.StartTransfer(role, initOptions, timeoutMs);
@@ -616,13 +618,13 @@ void TestTimeout(nlTestSuite * inSuite, void * inContext)
 
     // First PollOutput() should output the TransferInit message
     initiator.PollOutput(outEvent, startTimeMs);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kMsgToSend);
-    MessageType expectedInitMsg = (role == kRole_Sender) ? MessageType::SendInit : MessageType::ReceiveInit;
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend);
+    MessageType expectedInitMsg = (role == TransferRole::kSender) ? MessageType::SendInit : MessageType::ReceiveInit;
     VerifyBdxMessageType(inSuite, inContext, outEvent.MsgData, expectedInitMsg);
 
     // Second PollOutput() with no call to HandleMessageReceived() should result in a timeout.
     initiator.PollOutput(outEvent, endTimeMs);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kTransferTimeout);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kTransferTimeout);
 }
 
 // Test that sending the same block twice (with same block counter) results in a StatusReport message with BadBlockCounter. Also
@@ -645,21 +647,21 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext)
     uint32_t timeoutMs      = 1000 * 24;
 
     // Chosen specifically for this test
-    TransferControlFlags driveMode = kControl_ReceiverDrive;
+    TransferControlFlags driveMode = TransferControlFlags::kReceiverDrive;
 
     // ReceiveInit parameters
     TransferSession::TransferInitData initOptions;
-    initOptions.TransferCtlFlagsRaw = driveMode;
-    initOptions.MaxBlockSize        = blockSize;
-    char testFileDes[9]             = { "test.txt" };
-    initOptions.FileDesLength       = static_cast<uint16_t>(strlen(testFileDes));
-    initOptions.FileDesignator      = reinterpret_cast<uint8_t *>(testFileDes);
+    initOptions.TransferCtlFlags = driveMode;
+    initOptions.MaxBlockSize     = blockSize;
+    char testFileDes[9]          = { "test.txt" };
+    initOptions.FileDesLength    = static_cast<uint16_t>(strlen(testFileDes));
+    initOptions.FileDesignator   = reinterpret_cast<uint8_t *>(testFileDes);
 
     // Initialize respondingSender and pass ReceiveInit message
-    BitFlags<uint8_t, TransferControlFlags> senderOpts;
+    BitFlags<TransferControlFlags> senderOpts;
     senderOpts.Set(driveMode);
 
-    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingReceiver, kRole_Receiver, initOptions,
+    SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeoutMs, initiatingReceiver, TransferRole::kReceiver, initOptions,
                               respondingSender, senderOpts, blockSize);
 
     // Compose ReceiveAccept parameters struct and give to respondingSender
@@ -671,7 +673,7 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext)
     acceptData.Metadata       = nullptr;
     acceptData.MetadataLength = 0;
 
-    SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingSender, kRole_Sender, acceptData, initiatingReceiver,
+    SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingSender, TransferRole::kSender, acceptData, initiatingReceiver,
                            initOptions);
 
     SendAndVerifyQuery(inSuite, inContext, respondingSender, initiatingReceiver, outEvent);
@@ -685,7 +687,7 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext)
     err = respondingSender.PrepareBlock(blockData);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     respondingSender.PollOutput(eventWithBlock, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, eventWithBlock.EventType == TransferSession::kMsgToSend);
+    NL_TEST_ASSERT(inSuite, eventWithBlock.EventType == TransferSession::OutputEventType::kMsgToSend);
     VerifyBdxMessageType(inSuite, inContext, eventWithBlock.MsgData, MessageType::Block);
     VerifyNoMoreOutput(inSuite, inContext, respondingSender);
     System::PacketBufferHandle blockCopy =
@@ -695,7 +697,7 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext)
     err = initiatingReceiver.HandleMessageReceived(std::move(eventWithBlock.MsgData), kNoAdvanceTime);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     initiatingReceiver.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kBlockReceived);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kBlockReceived);
     NL_TEST_ASSERT(inSuite, outEvent.blockdata.Data != nullptr);
     VerifyNoMoreOutput(inSuite, inContext, initiatingReceiver);
 
@@ -705,30 +707,30 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext)
     err = initiatingReceiver.HandleMessageReceived(std::move(blockCopy), kNoAdvanceTime);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     initiatingReceiver.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kMsgToSend);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend);
     System::PacketBufferHandle statusReportMsg = outEvent.MsgData.Retain();
-    VerifyStatusReport(inSuite, inContext, std::move(outEvent.MsgData), kStatus_BadBlockCounter);
+    VerifyStatusReport(inSuite, inContext, std::move(outEvent.MsgData), StatusCode::kBadBlockCounter);
 
     // All subsequent PollOutput() calls should return kInternalError
     for (int i = 0; i < 5; ++i)
     {
         initiatingReceiver.PollOutput(outEvent, kNoAdvanceTime);
-        NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kInternalError);
-        NL_TEST_ASSERT(inSuite, outEvent.statusData.StatusCode == kStatus_BadBlockCounter);
+        NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kInternalError);
+        NL_TEST_ASSERT(inSuite, outEvent.statusData.statusCode == StatusCode::kBadBlockCounter);
     }
 
     err = respondingSender.HandleMessageReceived(std::move(statusReportMsg), kNoAdvanceTime);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     respondingSender.PollOutput(outEvent, kNoAdvanceTime);
-    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kStatusReceived);
-    NL_TEST_ASSERT(inSuite, outEvent.statusData.StatusCode == kStatus_BadBlockCounter);
+    NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kStatusReceived);
+    NL_TEST_ASSERT(inSuite, outEvent.statusData.statusCode == StatusCode::kBadBlockCounter);
 
     // All subsequent PollOutput() calls should return kInternalError
     for (int i = 0; i < 5; ++i)
     {
         respondingSender.PollOutput(outEvent, kNoAdvanceTime);
-        NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::kInternalError);
-        NL_TEST_ASSERT(inSuite, outEvent.statusData.StatusCode == kStatus_BadBlockCounter);
+        NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kInternalError);
+        NL_TEST_ASSERT(inSuite, outEvent.statusData.statusCode == StatusCode::kBadBlockCounter);
     }
 }
 
index cbf0abb..271f512 100644 (file)
@@ -87,14 +87,14 @@ public:
     /**
      * Send an echo request to a CHIP node.
      *
-     * @param nodeId        The destination's nodeId
      * @param payload       A PacketBufferHandle with the payload.
+     * @param sendFlags     Flags set by the application for the CHIP message being sent.
      *
      * @return CHIP_ERROR_NO_MEMORY if no ExchangeContext is available.
      *         Other CHIP_ERROR codes as returned by the lower layers.
      *
      */
-    CHIP_ERROR SendEchoRequest(System::PacketBufferHandle && payload);
+    CHIP_ERROR SendEchoRequest(System::PacketBufferHandle && payload, const Messaging::SendFlags & sendFlags);
 
 private:
     Messaging::ExchangeManager * mExchangeMgr = nullptr;
index 70a9405..6feeafe 100644 (file)
@@ -50,9 +50,12 @@ void EchoClient::Shutdown()
         mExchangeCtx->Abort();
         mExchangeCtx = nullptr;
     }
+
+    OnEchoResponseReceived = nullptr;
+    mExchangeMgr           = nullptr;
 }
 
-CHIP_ERROR EchoClient::SendEchoRequest(System::PacketBufferHandle && payload)
+CHIP_ERROR EchoClient::SendEchoRequest(System::PacketBufferHandle && payload, const Messaging::SendFlags & sendFlags)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
 
@@ -72,8 +75,7 @@ CHIP_ERROR EchoClient::SendEchoRequest(System::PacketBufferHandle && payload)
     }
 
     // Send an Echo Request message.  Discard the exchange context if the send fails.
-    err = mExchangeCtx->SendMessage(MsgType::EchoRequest, std::move(payload),
-                                    Messaging::SendFlags(Messaging::SendMessageFlags::kNone));
+    err = mExchangeCtx->SendMessage(MsgType::EchoRequest, std::move(payload), sendFlags);
 
     if (err != CHIP_NO_ERROR)
     {
index 5e6d990..341c0e6 100644 (file)
@@ -44,7 +44,7 @@ using namespace chip::Encoding::LittleEndian;
 CHIP_ERROR
 AdditionalDataPayloadGenerator::generateAdditionalDataPayload(uint16_t lifetimeCounter, const char * serialNumberBuffer,
                                                               size_t serialNumberBufferSize, PacketBufferHandle & bufferHandle,
-                                                              BitFlags<uint8_t, AdditionalDataFields> additionalDataFields)
+                                                              BitFlags<AdditionalDataFields> additionalDataFields)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
     System::PacketBufferTLVWriter writer;
index 6b48eda..652b267 100644 (file)
@@ -71,7 +71,7 @@ public:
      */
     CHIP_ERROR generateAdditionalDataPayload(uint16_t lifetimeCounter, const char * serialNumberBuffer,
                                              size_t serialNumberBufferSize, chip::System::PacketBufferHandle & bufferHandle,
-                                             BitFlags<uint8_t, AdditionalDataFields> additionalDataFields);
+                                             BitFlags<AdditionalDataFields> additionalDataFields);
     // Generate Device Rotating ID
     /**
      * Generate additional data payload (i.e. TLV encoded).
diff --git a/src/setup_payload/tests/TestManualCode.h b/src/setup_payload/tests/TestManualCode.h
deleted file mode 100644 (file)
index fb9d998..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry point for CHIP manual code unit tests.
- *
- */
-
-#pragma once
-
-int TestManualSetupCode();
diff --git a/src/setup_payload/tests/TestManualCodeDriver.cpp b/src/setup_payload/tests/TestManualCodeDriver.cpp
deleted file mode 100644 (file)
index 3bab2a1..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the manual setup code unit tests.
- *
- */
-
-#include "TestManualCode.h"
-
-int main()
-{
-    return (TestManualSetupCode());
-}
diff --git a/src/setup_payload/tests/TestQRCode.h b/src/setup_payload/tests/TestQRCode.h
deleted file mode 100644 (file)
index 42f5896..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry point for CHIP qr code unit tests.
- *
- */
-
-#pragma once
-
-int TestQuickResponseCode();
diff --git a/src/setup_payload/tests/TestQRCodeDriver.cpp b/src/setup_payload/tests/TestQRCodeDriver.cpp
deleted file mode 100644 (file)
index 6bc7d01..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the Quick Response code unit tests.
- *
- */
-
-#include "TestQRCode.h"
-
-int main()
-{
-    return (TestQuickResponseCode());
-}
diff --git a/src/setup_payload/tests/TestQRCodeTLV.h b/src/setup_payload/tests/TestQRCodeTLV.h
deleted file mode 100644 (file)
index 68e5d5d..0000000
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- *    @file
- *      This file declares test entry point for CHIP qr code tlv unit tests.
- *
- */
-
-#pragma once
-
-int TestQRCodeTLV();
diff --git a/src/setup_payload/tests/TestQRCodeTLVDriver.cpp b/src/setup_payload/tests/TestQRCodeTLVDriver.cpp
deleted file mode 100644 (file)
index 5e9c5e9..0000000
+++ /dev/null
@@ -1,30 +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.
- */
-
-/**
- *    @file
- *      This file implements a standalone/native program executable
- *      test driver for the Quick Response code TLV unit tests.
- *
- */
-
-#include "TestQRCodeTLV.h"
-
-int main()
-{
-    return (TestQRCodeTLV());
-}
diff --git a/src/transport/SecurePairingSession.cpp b/src/transport/SecurePairingSession.cpp
deleted file mode 100644 (file)
index 59c114d..0000000
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      This file implements the CHIP SPAKE2P Session object that provides
- *      APIs for constructing spake2p messages and establishing encryption
- *      keys.
- *
- *      The protocol for handling pA, pB, cB and cA is defined in SPAKE2
- *      Plus specifications.
- *      (https://www.ietf.org/id/draft-bar-cfrg-spake2plus-01.html)
- *
- */
-#include <transport/SecurePairingSession.h>
-
-#include <inttypes.h>
-#include <string.h>
-
-#include <core/CHIPSafeCasts.h>
-#include <protocols/Protocols.h>
-#include <support/BufBound.h>
-#include <support/CodeUtils.h>
-#include <support/SafeInt.h>
-
-namespace chip {
-
-using namespace Crypto;
-
-const char * kSpake2pContext        = "CHIP 1.0 Provisioning";
-const char * kSpake2pI2RSessionInfo = "Commissioning I2R Key";
-const char * kSpake2pR2ISessionInfo = "Commissioning R2I Key";
-
-SecurePairingSession::SecurePairingSession() {}
-
-SecurePairingSession::~SecurePairingSession()
-{
-    memset(&mPoint[0], 0, sizeof(mPoint));
-    memset(&mWS[0][0], 0, sizeof(mWS));
-    memset(&mKe[0], 0, sizeof(mKe));
-}
-
-CHIP_ERROR SecurePairingSession::Serialize(SecurePairingSessionSerialized & output)
-{
-    CHIP_ERROR error       = CHIP_NO_ERROR;
-    uint16_t serializedLen = 0;
-    SecurePairingSessionSerializable serializable;
-
-    VerifyOrExit(BASE64_ENCODED_LEN(sizeof(serializable)) <= sizeof(output.inner), error = CHIP_ERROR_INVALID_ARGUMENT);
-
-    error = ToSerializable(serializable);
-    SuccessOrExit(error);
-
-    serializedLen = chip::Base64Encode(Uint8::to_const_uchar(reinterpret_cast<uint8_t *>(&serializable)),
-                                       static_cast<uint16_t>(sizeof(serializable)), Uint8::to_char(output.inner));
-    VerifyOrExit(serializedLen > 0, error = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(serializedLen < sizeof(output.inner), error = CHIP_ERROR_INVALID_ARGUMENT);
-    output.inner[serializedLen] = '\0';
-
-exit:
-    return error;
-}
-
-CHIP_ERROR SecurePairingSession::Deserialize(SecurePairingSessionSerialized & input)
-{
-    CHIP_ERROR error = CHIP_NO_ERROR;
-    SecurePairingSessionSerializable serializable;
-    size_t maxlen            = BASE64_ENCODED_LEN(sizeof(serializable));
-    size_t len               = strnlen(Uint8::to_char(input.inner), maxlen);
-    uint16_t deserializedLen = 0;
-
-    VerifyOrExit(len < sizeof(SecurePairingSessionSerialized), error = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(CanCastTo<uint16_t>(len), error = CHIP_ERROR_INVALID_ARGUMENT);
-
-    memset(&serializable, 0, sizeof(serializable));
-    deserializedLen =
-        Base64Decode(Uint8::to_const_char(input.inner), static_cast<uint16_t>(len), Uint8::to_uchar((uint8_t *) &serializable));
-
-    VerifyOrExit(deserializedLen > 0, error = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(deserializedLen <= sizeof(serializable), error = CHIP_ERROR_INVALID_ARGUMENT);
-
-    error = FromSerializable(serializable);
-
-exit:
-    return error;
-}
-
-CHIP_ERROR SecurePairingSession::ToSerializable(SecurePairingSessionSerializable & serializable)
-{
-    CHIP_ERROR error = CHIP_NO_ERROR;
-
-    const NodeId localNodeId = mLocalNodeId.ValueOr(kUndefinedNodeId);
-    const NodeId peerNodeId  = mPeerNodeId.ValueOr(kUndefinedNodeId);
-    VerifyOrExit(CanCastTo<uint16_t>(mKeLen), error = CHIP_ERROR_INTERNAL);
-    VerifyOrExit(CanCastTo<uint64_t>(localNodeId), error = CHIP_ERROR_INTERNAL);
-    VerifyOrExit(CanCastTo<uint64_t>(peerNodeId), error = CHIP_ERROR_INTERNAL);
-
-    memset(&serializable, 0, sizeof(serializable));
-    serializable.mKeLen           = static_cast<uint16_t>(mKeLen);
-    serializable.mPairingComplete = (mPairingComplete) ? 1 : 0;
-    serializable.mLocalNodeId     = localNodeId;
-    serializable.mPeerNodeId      = peerNodeId;
-    serializable.mLocalKeyId      = mLocalKeyId;
-    serializable.mPeerKeyId       = mPeerKeyId;
-
-    memcpy(serializable.mKe, mKe, mKeLen);
-
-exit:
-    return error;
-}
-
-CHIP_ERROR SecurePairingSession::FromSerializable(const SecurePairingSessionSerializable & serializable)
-{
-    CHIP_ERROR error = CHIP_NO_ERROR;
-
-    mPairingComplete = (serializable.mPairingComplete == 1);
-    mKeLen           = static_cast<size_t>(serializable.mKeLen);
-
-    VerifyOrExit(mKeLen <= sizeof(mKe), error = CHIP_ERROR_INVALID_ARGUMENT);
-    memset(mKe, 0, sizeof(mKe));
-    memcpy(mKe, serializable.mKe, mKeLen);
-
-    mLocalNodeId = Optional<NodeId>::Value(serializable.mLocalNodeId);
-    mPeerNodeId  = Optional<NodeId>::Value(serializable.mPeerNodeId);
-
-    mLocalKeyId = serializable.mLocalKeyId;
-    mPeerKeyId  = serializable.mPeerKeyId;
-
-exit:
-    return error;
-}
-
-CHIP_ERROR SecurePairingSession::Init(uint32_t setupCode, uint32_t pbkdf2IterCount, const uint8_t * salt, size_t saltLen,
-                                      Optional<NodeId> myNodeId, uint16_t myKeyId, SecurePairingSessionDelegate * delegate)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    VerifyOrExit(salt != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(saltLen > 0, err = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(delegate != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
-
-    err = mSpake2p.Init(Uint8::from_const_char(kSpake2pContext), strlen(kSpake2pContext));
-    SuccessOrExit(err);
-
-    err = pbkdf2_sha256(reinterpret_cast<const uint8_t *>(&setupCode), sizeof(setupCode), salt, saltLen, pbkdf2IterCount,
-                        sizeof(mWS), &mWS[0][0]);
-    SuccessOrExit(err);
-
-    mDelegate    = delegate;
-    mLocalNodeId = myNodeId;
-    mLocalKeyId  = myKeyId;
-
-exit:
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::WaitForPairing(uint32_t mySetUpPINCode, uint32_t pbkdf2IterCount, const uint8_t * salt,
-                                                size_t saltLen, Optional<NodeId> myNodeId, uint16_t myKeyId,
-                                                SecurePairingSessionDelegate * delegate)
-{
-    size_t sizeof_point = sizeof(mPoint);
-
-    CHIP_ERROR err = Init(mySetUpPINCode, pbkdf2IterCount, salt, saltLen, myNodeId, myKeyId, delegate);
-    SuccessOrExit(err);
-
-    err = mSpake2p.ComputeL(mPoint, &sizeof_point, &mWS[1][0], kSpake2p_WS_Length);
-    SuccessOrExit(err);
-
-    mNextExpectedMsg = Spake2pMsgType::kSpake2pCompute_pA;
-    mPairingComplete = false;
-
-exit:
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::AttachHeaderAndSend(uint8_t msgType, System::PacketBuffer * msgIn)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    System::PacketBufferHandle msgBuf;
-
-    PayloadHeader payloadHeader;
-
-    payloadHeader
-        .SetMessageType(msgType) //
-        .SetProtocolID(Protocols::kProtocol_SecurityChannel);
-
-    uint16_t headerSize              = payloadHeader.EncodeSizeBytes();
-    uint16_t actualEncodedHeaderSize = 0;
-
-    msgBuf.Adopt(msgIn);
-    VerifyOrExit(msgBuf->EnsureReservedSize(headerSize), err = CHIP_ERROR_NO_MEMORY);
-
-    msgBuf->SetStart(msgBuf->Start() - headerSize);
-    err = payloadHeader.Encode(msgBuf->Start(), msgBuf->DataLength(), &actualEncodedHeaderSize);
-    SuccessOrExit(err);
-    VerifyOrExit(headerSize == actualEncodedHeaderSize, err = CHIP_ERROR_INTERNAL);
-
-    err = mDelegate->SendPairingMessage(PacketHeader().SetSourceNodeId(mLocalNodeId).SetEncryptionKeyID(mLocalKeyId), mPeerAddress,
-                                        msgBuf.Release_ForNow());
-    SuccessOrExit(err);
-
-exit:
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::Pair(const Transport::PeerAddress peerAddress, uint32_t peerSetUpPINCode, uint32_t pbkdf2IterCount,
-                                      const uint8_t * salt, size_t saltLen, Optional<NodeId> myNodeId, uint16_t myKeyId,
-                                      SecurePairingSessionDelegate * delegate)
-{
-    uint8_t X[kMAX_Point_Length];
-    size_t X_len = sizeof(X);
-    uint16_t data_len; // Will be the same as X_len in practice.
-
-    System::PacketBufferHandle resp;
-
-    CHIP_ERROR err = Init(peerSetUpPINCode, pbkdf2IterCount, salt, saltLen, myNodeId, myKeyId, delegate);
-    SuccessOrExit(err);
-
-    mPeerAddress = peerAddress;
-
-    err = mSpake2p.BeginProver(reinterpret_cast<const uint8_t *>(""), 0, reinterpret_cast<const uint8_t *>(""), 0, &mWS[0][0],
-                               kSpake2p_WS_Length, &mWS[1][0], kSpake2p_WS_Length);
-    SuccessOrExit(err);
-
-    err = mSpake2p.ComputeRoundOne(X, &X_len);
-    SuccessOrExit(err);
-    VerifyOrExit(CanCastTo<uint16_t>(X_len), err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-    data_len = static_cast<uint16_t>(X_len);
-
-    resp = System::PacketBuffer::NewWithAvailableSize(data_len);
-    VerifyOrExit(!resp.IsNull(), err = CHIP_SYSTEM_ERROR_NO_MEMORY);
-
-    {
-        BufBound bbuf(resp->Start(), data_len);
-        bbuf.Put(&X[0], X_len);
-        VerifyOrExit(bbuf.Fit(), err = CHIP_ERROR_NO_MEMORY);
-    }
-
-    resp->SetDataLength(data_len);
-    mNextExpectedMsg = Spake2pMsgType::kSpake2pCompute_pB_cB;
-
-    // Call delegate to send the Compute_pA to peer
-    err = AttachHeaderAndSend(Spake2pMsgType::kSpake2pCompute_pA, resp.Release_ForNow());
-    SuccessOrExit(err);
-    return err;
-
-exit:
-    mNextExpectedMsg = Spake2pMsgType::kSpake2pMsgTypeMax;
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::DeriveSecureSession(const uint8_t * info, size_t info_len, SecureSession & session)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    VerifyOrExit(info != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(info_len > 0, err = CHIP_ERROR_INVALID_ARGUMENT);
-    VerifyOrExit(mPairingComplete, err = CHIP_ERROR_INCORRECT_STATE);
-
-    err = session.InitFromSecret(mKe, mKeLen, nullptr, 0, info, info_len);
-    SuccessOrExit(err);
-
-exit:
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::HandleCompute_pA(const PacketHeader & header, const System::PacketBufferHandle & msg)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    uint8_t Y[kMAX_Point_Length];
-    size_t Y_len = sizeof(Y);
-
-    uint8_t verifier[kMAX_Hash_Length];
-    size_t verifier_len = kMAX_Hash_Length;
-
-    uint16_t data_len; // To be initialized once we compute it.
-
-    const uint8_t * buf = msg->Start();
-    size_t buf_len      = msg->TotalLength();
-
-    System::PacketBufferHandle resp;
-
-    VerifyOrExit(buf != nullptr, err = CHIP_ERROR_MESSAGE_INCOMPLETE);
-    VerifyOrExit(buf_len == kMAX_Point_Length, err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-
-    err = mSpake2p.BeginVerifier(reinterpret_cast<const uint8_t *>(""), 0, reinterpret_cast<const uint8_t *>(""), 0, &mWS[0][0],
-                                 kSpake2p_WS_Length, mPoint, sizeof(mPoint));
-    SuccessOrExit(err);
-
-    err = mSpake2p.ComputeRoundOne(Y, &Y_len);
-    SuccessOrExit(err);
-
-    err = mSpake2p.ComputeRoundTwo(buf, buf_len, verifier, &verifier_len);
-    SuccessOrExit(err);
-
-    mPeerKeyId  = header.GetEncryptionKeyID();
-    mPeerNodeId = header.GetSourceNodeId();
-
-    // Make sure our addition doesn't overflow.
-    VerifyOrExit(UINTMAX_MAX - verifier_len >= Y_len, err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-    VerifyOrExit(CanCastTo<uint16_t>(Y_len + verifier_len), err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-    data_len = static_cast<uint16_t>(Y_len + verifier_len);
-
-    resp = System::PacketBuffer::NewWithAvailableSize(data_len);
-    VerifyOrExit(!resp.IsNull(), err = CHIP_SYSTEM_ERROR_NO_MEMORY);
-
-    {
-        BufBound bbuf(resp->Start(), data_len);
-        bbuf.Put(&Y[0], Y_len);
-        bbuf.Put(verifier, verifier_len);
-        VerifyOrExit(bbuf.Fit(), err = CHIP_ERROR_NO_MEMORY);
-    }
-
-    resp->SetDataLength(data_len);
-    mNextExpectedMsg = Spake2pMsgType::kSpake2pCompute_cA;
-
-    // Call delegate to send the Compute_pB_cB to peer
-    err = AttachHeaderAndSend(Spake2pMsgType::kSpake2pCompute_pB_cB, resp.Release_ForNow());
-    SuccessOrExit(err);
-    return err;
-
-exit:
-
-    mNextExpectedMsg = Spake2pMsgType::kSpake2pMsgTypeMax;
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::HandleCompute_pB_cB(const PacketHeader & header, const System::PacketBufferHandle & msg)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    uint8_t verifier[kMAX_Hash_Length];
-    size_t verifier_len_raw = kMAX_Hash_Length;
-    uint16_t verifier_len; // To be inited one we check length is small enough
-
-    const uint8_t * buf = msg->Start();
-    size_t buf_len      = msg->TotalLength();
-
-    System::PacketBufferHandle resp;
-
-    VerifyOrExit(buf != nullptr, err = CHIP_ERROR_MESSAGE_INCOMPLETE);
-    VerifyOrExit(buf_len == kMAX_Point_Length + kMAX_Hash_Length, err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-
-    err = mSpake2p.ComputeRoundTwo(buf, kMAX_Point_Length, verifier, &verifier_len_raw);
-    SuccessOrExit(err);
-    VerifyOrExit(CanCastTo<uint16_t>(verifier_len_raw), err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-    verifier_len = static_cast<uint16_t>(verifier_len_raw);
-
-    mPeerKeyId  = header.GetEncryptionKeyID();
-    mPeerNodeId = header.GetSourceNodeId();
-
-    resp = System::PacketBuffer::NewWithAvailableSize(verifier_len);
-    VerifyOrExit(!resp.IsNull(), err = CHIP_SYSTEM_ERROR_NO_MEMORY);
-
-    {
-        BufBound bbuf(resp->Start(), verifier_len);
-        bbuf.Put(verifier, verifier_len);
-        VerifyOrExit(bbuf.Fit(), err = CHIP_ERROR_NO_MEMORY);
-    }
-
-    resp->SetDataLength(verifier_len);
-
-    // Call delegate to send the Compute_cA to peer
-    err = AttachHeaderAndSend(Spake2pMsgType::kSpake2pCompute_cA, resp.Release_ForNow());
-    SuccessOrExit(err);
-
-    {
-        const uint8_t * hash = &buf[kMAX_Point_Length];
-        err                  = mSpake2p.KeyConfirm(hash, kMAX_Hash_Length);
-        SuccessOrExit(err);
-
-        err = mSpake2p.GetKeys(mKe, &mKeLen);
-        SuccessOrExit(err);
-    }
-
-    mPairingComplete = true;
-
-    // Call delegate to indicate pairing completion
-    mDelegate->OnPairingComplete();
-
-exit:
-
-    mNextExpectedMsg = Spake2pMsgType::kSpake2pMsgTypeMax;
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::HandleCompute_cA(const PacketHeader & header, const System::PacketBufferHandle & msg)
-{
-    CHIP_ERROR err       = CHIP_NO_ERROR;
-    const uint8_t * hash = msg->Start();
-
-    VerifyOrExit(hash != nullptr, err = CHIP_ERROR_MESSAGE_INCOMPLETE);
-    VerifyOrExit(msg->TotalLength() == kMAX_Hash_Length, err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
-
-    VerifyOrExit(header.GetSourceNodeId() == mPeerNodeId, err = CHIP_ERROR_WRONG_NODE_ID);
-    VerifyOrExit(header.GetEncryptionKeyID() == mPeerKeyId, err = CHIP_ERROR_INVALID_KEY_ID);
-
-    err = mSpake2p.KeyConfirm(hash, kMAX_Hash_Length);
-    SuccessOrExit(err);
-
-    err = mSpake2p.GetKeys(mKe, &mKeLen);
-    SuccessOrExit(err);
-
-    mPairingComplete = true;
-
-    // Call delegate to indicate pairing completion
-    mDelegate->OnPairingComplete();
-
-exit:
-
-    mNextExpectedMsg = Spake2pMsgType::kSpake2pMsgTypeMax;
-    return err;
-}
-
-CHIP_ERROR SecurePairingSession::HandlePeerMessage(const PacketHeader & packetHeader, const Transport::PeerAddress & peerAddress,
-                                                   System::PacketBufferHandle msg)
-{
-    CHIP_ERROR err      = CHIP_NO_ERROR;
-    uint16_t headerSize = 0;
-    PayloadHeader payloadHeader;
-
-    VerifyOrExit(!msg.IsNull(), err = CHIP_ERROR_INVALID_ARGUMENT);
-
-    err = payloadHeader.Decode(msg->Start(), msg->DataLength(), &headerSize);
-    SuccessOrExit(err);
-
-    msg->ConsumeHead(headerSize);
-
-    VerifyOrExit(payloadHeader.GetProtocolID() == Protocols::kProtocol_SecurityChannel, err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
-    VerifyOrExit(payloadHeader.GetMessageType() == (uint8_t) mNextExpectedMsg, err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
-
-    mPeerAddress = peerAddress;
-
-    switch (static_cast<Spake2pMsgType>(payloadHeader.GetMessageType()))
-    {
-    case Spake2pMsgType::kSpake2pCompute_pA:
-        err = HandleCompute_pA(packetHeader, msg);
-        break;
-
-    case Spake2pMsgType::kSpake2pCompute_pB_cB:
-        err = HandleCompute_pB_cB(packetHeader, msg);
-        break;
-
-    case Spake2pMsgType::kSpake2pCompute_cA:
-        err = HandleCompute_cA(packetHeader, msg);
-        break;
-
-    default:
-        err = CHIP_ERROR_INVALID_MESSAGE_TYPE;
-        break;
-    };
-
-exit:
-
-    // Call delegate to indicate pairing failure
-    if (err != CHIP_NO_ERROR)
-    {
-        mDelegate->OnPairingError(err);
-    }
-
-    return err;
-}
-
-} // namespace chip
diff --git a/src/transport/SecurePairingSession.h b/src/transport/SecurePairingSession.h
deleted file mode 100644 (file)
index 7693c2d..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      This file defines the CHIP SPAKE2P Session object that provides
- *      APIs for constructing spake2p messages and establishing encryption
- *      keys.
- *
- */
-
-#pragma once
-
-#include <crypto/CHIPCryptoPAL.h>
-#include <support/Base64.h>
-#include <system/SystemPacketBuffer.h>
-#include <transport/SecureSession.h>
-#include <transport/raw/MessageHeader.h>
-#include <transport/raw/PeerAddress.h>
-
-namespace chip {
-
-extern const char * kSpake2pI2RSessionInfo;
-extern const char * kSpake2pR2ISessionInfo;
-
-using namespace Crypto;
-
-class DLL_EXPORT SecurePairingSessionDelegate
-{
-public:
-    /**
-     * @brief
-     *   Called when pairing session generates a new message that should be sent to peer.
-     *
-     * @param header the message header for the sent message
-     * @param peerAddress the destination of the message
-     * @param msgBuf the raw data for the message being sent
-     * @return CHIP_ERROR Error thrown when sending the message
-     */
-    virtual CHIP_ERROR SendPairingMessage(const PacketHeader & header, const Transport::PeerAddress & peerAddress,
-                                          System::PacketBuffer * msgBuf)
-    {
-        return CHIP_ERROR_NOT_IMPLEMENTED;
-    }
-
-    /**
-     * @brief
-     *   Called when pairing fails with an error
-     *
-     * @param error error code
-     */
-    virtual void OnPairingError(CHIP_ERROR error) {}
-
-    /**
-     * @brief
-     *   Called when the pairing is complete and the new secure session has been established
-     */
-    virtual void OnPairingComplete() {}
-
-    virtual ~SecurePairingSessionDelegate() {}
-};
-
-struct SecurePairingSessionSerialized;
-
-struct SecurePairingSessionSerializable
-{
-    uint16_t mKeLen;
-    uint8_t mKe[kMAX_Hash_Length];
-    uint8_t mPairingComplete;
-    uint64_t mLocalNodeId;
-    uint64_t mPeerNodeId;
-    uint16_t mLocalKeyId;
-    uint16_t mPeerKeyId;
-};
-
-class DLL_EXPORT SecurePairingSession
-{
-public:
-    SecurePairingSession();
-    SecurePairingSession(SecurePairingSession &&)      = default;
-    SecurePairingSession(const SecurePairingSession &) = delete;
-    SecurePairingSession & operator=(const SecurePairingSession &) = default;
-    SecurePairingSession & operator=(SecurePairingSession &&) = default;
-
-    virtual ~SecurePairingSession();
-
-    /**
-     * @brief
-     *   Initialize using setup PIN code and wait for pairing requests.
-     *
-     * @param mySetUpPINCode  Setup PIN code of the local device
-     * @param pbkdf2IterCount Iteration count for PBKDF2 function
-     * @param salt            Salt to be used for SPAKE2P opertation
-     * @param saltLen         Length of salt
-     * @param myNodeId        Optional node id of local node
-     * @param myKeyId         Key ID to be assigned to the secure session on the peer node
-     * @param delegate        Callback object
-     *
-     * @return CHIP_ERROR     The result of initialization
-     */
-    CHIP_ERROR WaitForPairing(uint32_t mySetUpPINCode, uint32_t pbkdf2IterCount, const uint8_t * salt, size_t saltLen,
-                              Optional<NodeId> myNodeId, uint16_t myKeyId, SecurePairingSessionDelegate * delegate);
-
-    /**
-     * @brief
-     *   Create a pairing request using peer's setup PIN code.
-     *
-     * @param peerAddress      Address of peer to pair
-     * @param peerSetUpPINCode Setup PIN code of the peer device
-     * @param pbkdf2IterCount  Iteration count for PBKDF2 function
-     * @param salt             Salt to be used for SPAKE2P opertation
-     * @param saltLen          Length of salt
-     * @param myNodeId         Optional node id of local node
-     * @param myKeyId          Key ID to be assigned to the secure session on the peer node
-     * @param delegate         Callback object
-     *
-     * @return CHIP_ERROR      The result of initialization
-     */
-    CHIP_ERROR Pair(const Transport::PeerAddress peerAddress, uint32_t peerSetUpPINCode, uint32_t pbkdf2IterCount,
-                    const uint8_t * salt, size_t saltLen, Optional<NodeId> myNodeId, uint16_t myKeyId,
-                    SecurePairingSessionDelegate * delegate);
-
-    /**
-     * @brief
-     *   Derive a secure session from the paired session. The API will return error
-     *   if called before pairing is established.
-     *
-     * @param info        Information string used for key derivation
-     * @param info_len    Length of info string
-     * @param session     Referene to the sescure session that will be
-     *                    initialized once pairing is complete
-     * @return CHIP_ERROR The result of session derivation
-     */
-    virtual CHIP_ERROR DeriveSecureSession(const uint8_t * info, size_t info_len, SecureSession & session);
-
-    /**
-     * @brief
-     *   Handler for peer's messages, exchanged during pairing handshake.
-     *
-     * @param packetHeader      Message header for the received message
-     * @param peerAddress Source of the message
-     * @param msg         Message sent by the peer
-     * @return CHIP_ERROR The result of message processing
-     */
-    virtual CHIP_ERROR HandlePeerMessage(const PacketHeader & packetHeader, const Transport::PeerAddress & peerAddress,
-                                         System::PacketBufferHandle msg);
-
-    /**
-     * @brief
-     *  Return the associated secure session peer NodeId
-     *
-     * @return Optional<NodeId> The associated peer NodeId
-     */
-    NodeId GetPeerNodeId() const { return mPeerNodeId.Value(); }
-
-    /**
-     * @brief
-     *  Return the associated peer key id
-     *
-     * @return uint16_t The associated peer key id
-     */
-    uint16_t GetPeerKeyId() { return mPeerKeyId; }
-
-    /**
-     * @brief
-     *  Return the associated local key id
-     *
-     * @return uint16_t The assocated local key id
-     */
-    uint16_t GetLocalKeyId() { return mLocalKeyId; }
-
-    /** @brief Serialize the Pairing Session to a string.
-     *
-     * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
-     **/
-    CHIP_ERROR Serialize(SecurePairingSessionSerialized & output);
-
-    /** @brief Deserialize the Pairing Session from the string.
-     *
-     * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
-     **/
-    CHIP_ERROR Deserialize(SecurePairingSessionSerialized & input);
-
-    /** @brief Serialize the SecurePairingSession to the given serializable data structure for secure pairing
-     *
-     * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
-     **/
-    CHIP_ERROR ToSerializable(SecurePairingSessionSerializable & output);
-
-    /** @brief Reconstruct secure pairing class from the serializable data structure.
-     *
-     * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise
-     **/
-    CHIP_ERROR FromSerializable(const SecurePairingSessionSerializable & output);
-
-private:
-    CHIP_ERROR Init(uint32_t setupCode, uint32_t pbkdf2IterCount, const uint8_t * salt, size_t saltLen, Optional<NodeId> myNodeId,
-                    uint16_t myKeyId, SecurePairingSessionDelegate * delegate);
-
-    CHIP_ERROR HandleCompute_pA(const PacketHeader & header, const System::PacketBufferHandle & msg);
-    CHIP_ERROR HandleCompute_pB_cB(const PacketHeader & header, const System::PacketBufferHandle & msg);
-    CHIP_ERROR HandleCompute_cA(const PacketHeader & header, const System::PacketBufferHandle & msg);
-
-    CHIP_ERROR AttachHeaderAndSend(uint8_t msgType, System::PacketBuffer * msgBuf);
-
-    static constexpr size_t kSpake2p_WS_Length = kP256_FE_Length + 8;
-
-    enum Spake2pMsgType : uint8_t
-    {
-        kSpake2pCompute_pA    = 0,
-        kSpake2pCompute_pB_cB = 1,
-        kSpake2pCompute_cA    = 2,
-        kSpake2pMsgTypeMax    = 3,
-    };
-
-    SecurePairingSessionDelegate * mDelegate = nullptr;
-
-    Spake2pMsgType mNextExpectedMsg = Spake2pMsgType::kSpake2pMsgTypeMax;
-
-    Spake2p_P256_SHA256_HKDF_HMAC mSpake2p;
-
-    uint8_t mPoint[kMAX_Point_Length];
-
-    /* w0s and w1s */
-    uint8_t mWS[2][kSpake2p_WS_Length];
-
-protected:
-    Optional<NodeId> mLocalNodeId = Optional<NodeId>::Value(kUndefinedNodeId);
-
-    Optional<NodeId> mPeerNodeId = Optional<NodeId>::Value(kUndefinedNodeId);
-
-    uint16_t mLocalKeyId;
-
-    uint16_t mPeerKeyId;
-
-    Transport::PeerAddress mPeerAddress;
-
-    uint8_t mKe[kMAX_Hash_Length];
-
-    size_t mKeLen = sizeof(mKe);
-
-    bool mPairingComplete = false;
-};
-
-/*
- * The following constants are node IDs that test devices and test
- * controllers use while using the SecurePairingUsingTestSecret to
- * establish secure channel
- */
-constexpr chip::NodeId kTestControllerNodeId = 112233;
-constexpr chip::NodeId kTestDeviceNodeId     = 12344321;
-
-/*
- * The following class should only be used for test usecases.
- * The class is currently also used for devices that do no yet support
- * rendezvous. Once all the non-test usecases start supporting
- * rendezvous, this class will be moved to the test code.
- */
-class SecurePairingUsingTestSecret : public SecurePairingSession
-{
-public:
-    SecurePairingUsingTestSecret()
-    {
-        const char * secret = "Test secret for key derivation";
-        size_t secretLen    = strlen(secret);
-        mKeLen              = secretLen;
-        memmove(mKe, secret, mKeLen);
-        mPairingComplete = true;
-    }
-
-    SecurePairingUsingTestSecret(Optional<NodeId> peerNodeId, uint16_t peerKeyId, uint16_t localKeyId)
-    {
-        const char * secret = "Test secret for key derivation";
-        size_t secretLen    = strlen(secret);
-        mPeerNodeId         = peerNodeId;
-        mPeerKeyId          = peerKeyId;
-        mLocalKeyId         = localKeyId;
-        mKeLen              = secretLen;
-        memmove(mKe, secret, mKeLen);
-        mPairingComplete = true;
-    }
-
-    ~SecurePairingUsingTestSecret() override {}
-
-    CHIP_ERROR WaitForPairing(uint32_t mySetUpPINCode, uint32_t pbkdf2IterCount, const uint8_t * salt, size_t saltLen,
-                              Optional<NodeId> myNodeId, uint16_t myKeyId, SecurePairingSessionDelegate * delegate)
-    {
-        return CHIP_NO_ERROR;
-    }
-
-    CHIP_ERROR Pair(uint32_t peerSetUpPINCode, uint32_t pbkdf2IterCount, const uint8_t * salt, size_t saltLen,
-                    Optional<NodeId> myNodeId, uint16_t myKeyId, SecurePairingSessionDelegate * delegate)
-    {
-        return CHIP_NO_ERROR;
-    }
-
-    CHIP_ERROR HandlePeerMessage(const PacketHeader & packetHeader, const Transport::PeerAddress & peerAddress,
-                                 System::PacketBufferHandle msg) override
-    {
-        return CHIP_NO_ERROR;
-    }
-};
-
-typedef struct SecurePairingSessionSerialized
-{
-    // Extra uint64_t to account for padding bytes (NULL termination, and some decoding overheads)
-    uint8_t inner[BASE64_ENCODED_LEN(sizeof(SecurePairingSessionSerializable) + sizeof(uint64_t))];
-} SecurePairingSessionSerialized;
-
-} // namespace chip
index 95219e5..8c4cad6 100644 (file)
@@ -85,6 +85,16 @@ CHIP_ERROR SecureSessionMgr::Init(NodeId localNodeId, System::Layer * systemLaye
     return CHIP_NO_ERROR;
 }
 
+void SecureSessionMgr::Shutdown()
+{
+    mState        = State::kNotReady;
+    mLocalNodeId  = kUndefinedNodeId;
+    mSystemLayer  = nullptr;
+    mTransportMgr = nullptr;
+    mAdmins       = nullptr;
+    mCB           = nullptr;
+}
+
 Transport::Type SecureSessionMgr::GetTransportType(NodeId peerNodeId)
 {
     PeerConnectionState * state = mPeerConnections.FindPeerConnectionState(peerNodeId, nullptr);
index 4432620..eeef685 100644 (file)
@@ -272,6 +272,13 @@ public:
 
     /**
      * @brief
+     *  Shutdown the Secure Session Manager. This terminates this instance
+     *  of the object and reset it's state.
+     */
+    void Shutdown();
+
+    /**
+     * @brief
      *   Set local node ID
      *
      * @param nodeId    Node id for the current node
diff --git a/src/transport/TransportMgr.cpp b/src/transport/TransportMgr.cpp
deleted file mode 100644 (file)
index 8cd040a..0000000
+++ /dev/null
@@ -1,67 +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
- */
-
-/**
- * @file
- *   This file implements a stateless TransportMgr, it will took a raw message
- * buffer from transports, and then extract the message header without decode it.
- * For secure messages, it will pass it to the SecureSessionMgr, and for unsecure
- * messages (rendezvous messages), it will pass it to RendezvousSession.
- *   When sending messages, it will encode the packet header, and pass it to the
- * transports.
- *   The whole process is fully stateless.
- */
-
-#include <transport/TransportMgr.h>
-
-#include <transport/RendezvousSession.h>
-#include <transport/SecureSessionMgr.h>
-#include <transport/raw/Base.h>
-#include <transport/raw/MessageHeader.h>
-#include <transport/raw/PeerAddress.h>
-
-namespace chip {
-
-CHIP_ERROR TransportMgrBase::Init(Transport::Base * transport)
-{
-    if (mTransport != nullptr)
-    {
-        return CHIP_ERROR_INCORRECT_STATE;
-    }
-    mTransport = transport;
-    mTransport->SetMessageReceiveHandler(HandleMessageReceived, this);
-    ChipLogDetail(Inet, "TransportMgr initialized");
-    return CHIP_NO_ERROR;
-}
-
-void TransportMgrBase::HandleMessageReceived(const PacketHeader & packetHeader, const Transport::PeerAddress & peerAddress,
-                                             System::PacketBufferHandle msg, TransportMgrBase * dispatcher)
-{
-    TransportMgrDelegate * handler =
-        packetHeader.GetFlags().Has(Header::FlagValues::kSecure) ? dispatcher->mSecureSessionMgr : dispatcher->mRendezvous;
-    if (handler != nullptr)
-    {
-        handler->OnMessageReceived(packetHeader, peerAddress, std::move(msg));
-    }
-    else
-    {
-        char addrBuffer[Transport::PeerAddress::kMaxToStringSize];
-        peerAddress.ToString(addrBuffer, sizeof(addrBuffer));
-        ChipLogError(Inet, "%s message from %s is dropped since no corresponding handler is set in TransportMgr.",
-                     packetHeader.GetFlags().Has(Header::FlagValues::kSecure) ? "Encrypted" : "Unencrypted", addrBuffer);
-    }
-}
-} // namespace chip
index 8a95a74..9e05324 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -319,9 +319,9 @@ CHIP_ERROR PacketHeader::EncodeBeforeData(const System::PacketBufferHandle & buf
 
 CHIP_ERROR PayloadHeader::Encode(uint8_t * data, uint16_t size, uint16_t * encode_size) const
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    uint8_t * p    = data;
-    uint8_t header = mExchangeFlags.Raw();
+    CHIP_ERROR err       = CHIP_NO_ERROR;
+    uint8_t * p          = data;
+    const uint8_t header = mExchangeFlags.Raw();
 
     VerifyOrExit(size >= EncodeSizeBytes(), err = CHIP_ERROR_INVALID_ARGUMENT);
 
index 3a7feca..dfe8d8c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2020 Project CHIP Authors
+ *    Copyright (c) 2020-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.
@@ -95,9 +95,9 @@ enum class FlagValues : uint16_t
 
 };
 
-using Flags         = BitFlags<uint16_t, FlagValues>;
-using ExFlags       = BitFlags<uint8_t, ExFlagValues>;
-using InternalFlags = BitFlags<uint8_t, InternalFlagValues>;
+using Flags         = BitFlags<FlagValues>;
+using ExFlags       = BitFlags<ExFlagValues>;
+using InternalFlags = BitFlags<InternalFlagValues>;
 
 // Header is a 16-bit value of the form
 //  |  4 bit  | 4 bit |8 bit Security Flags|
diff --git a/src/transport/tests/TestSecurePairingSession.cpp b/src/transport/tests/TestSecurePairingSession.cpp
deleted file mode 100644 (file)
index 98208b9..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 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.
- */
-
-/**
- *    @file
- *      This file implements unit tests for the SecurePairingSession implementation.
- */
-
-#include <errno.h>
-#include <nlunit-test.h>
-
-#include <core/CHIPCore.h>
-#include <core/CHIPSafeCasts.h>
-#include <stdarg.h>
-#include <support/CHIPMem.h>
-#include <support/CodeUtils.h>
-#include <support/UnitTestRegistration.h>
-#include <transport/SecurePairingSession.h>
-
-using namespace chip;
-
-class TestSecurePairingDelegate : public SecurePairingSessionDelegate
-{
-public:
-    CHIP_ERROR SendPairingMessage(const PacketHeader & header, const Transport::PeerAddress & peerAddress,
-                                  System::PacketBuffer * msgBuf) override
-    {
-        mNumMessageSend++;
-        System::PacketBufferHandle msg_ForNow;
-        msg_ForNow.Adopt(msgBuf);
-        return (peer != nullptr) ? peer->HandlePeerMessage(header, peerAddress, std::move(msg_ForNow)) : mMessageSendError;
-    }
-
-    void OnPairingError(CHIP_ERROR error) override { mNumPairingErrors++; }
-
-    void OnPairingComplete() override { mNumPairingComplete++; }
-
-    uint32_t mNumMessageSend     = 0;
-    uint32_t mNumPairingErrors   = 0;
-    uint32_t mNumPairingComplete = 0;
-    CHIP_ERROR mMessageSendError = CHIP_NO_ERROR;
-
-    SecurePairingSession * peer = nullptr;
-};
-
-void SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext)
-{
-    // Test all combinations of invalid parameters
-    TestSecurePairingDelegate delegate;
-    SecurePairingSession pairing;
-
-    NL_TEST_ASSERT(inSuite,
-                   pairing.WaitForPairing(1234, 500, nullptr, 0, Optional<NodeId>::Value(1), 0, &delegate) ==
-                       CHIP_ERROR_INVALID_ARGUMENT);
-    NL_TEST_ASSERT(inSuite,
-                   pairing.WaitForPairing(1234, 500, (const uint8_t *) "salt", 4, Optional<NodeId>::Value(1), 0, nullptr) ==
-                       CHIP_ERROR_INVALID_ARGUMENT);
-    NL_TEST_ASSERT(inSuite,
-                   pairing.WaitForPairing(1234, 500, (const uint8_t *) "salt", 4, Optional<NodeId>::Value(1), 0, &delegate) ==
-                       CHIP_NO_ERROR);
-}
-
-void SecurePairingStartTest(nlTestSuite * inSuite, void * inContext)
-{
-    // Test all combinations of invalid parameters
-    TestSecurePairingDelegate delegate;
-    SecurePairingSession pairing;
-
-    NL_TEST_ASSERT(inSuite,
-                   pairing.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 500, nullptr, 0, Optional<NodeId>::Value(1), 0,
-                                &delegate) == CHIP_ERROR_INVALID_ARGUMENT);
-    NL_TEST_ASSERT(inSuite,
-                   pairing.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 500, (const uint8_t *) "salt", 4,
-                                Optional<NodeId>::Value(1), 0, nullptr) == CHIP_ERROR_INVALID_ARGUMENT);
-    NL_TEST_ASSERT(inSuite,
-                   pairing.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 500, (const uint8_t *) "salt", 4,
-                                Optional<NodeId>::Value(1), 0, &delegate) == CHIP_NO_ERROR);
-
-    NL_TEST_ASSERT(inSuite, delegate.mNumMessageSend == 1);
-
-    delegate.mMessageSendError = CHIP_ERROR_BAD_REQUEST;
-
-    SecurePairingSession pairing1;
-
-    NL_TEST_ASSERT(inSuite,
-                   pairing1.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 500, (const uint8_t *) "salt", 4,
-                                 Optional<NodeId>::Value(1), 0, &delegate) == CHIP_ERROR_BAD_REQUEST);
-}
-
-void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, SecurePairingSession & pairingCommissioner,
-                                      TestSecurePairingDelegate & delegateCommissioner)
-{
-    // Test all combinations of invalid parameters
-    TestSecurePairingDelegate delegateAccessory;
-    SecurePairingSession pairingAccessory;
-
-    delegateCommissioner.peer = &pairingAccessory;
-    delegateAccessory.peer    = &pairingCommissioner;
-
-    NL_TEST_ASSERT(inSuite,
-                   pairingAccessory.WaitForPairing(1234, 500, (const uint8_t *) "salt", 4, Optional<NodeId>::Value(1), 0,
-                                                   &delegateAccessory) == CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite,
-                   pairingCommissioner.Pair(Transport::PeerAddress(Transport::Type::kBle), 1234, 500, (const uint8_t *) "salt", 4,
-                                            Optional<NodeId>::Value(2), 0, &delegateCommissioner) == CHIP_NO_ERROR);
-
-    NL_TEST_ASSERT(inSuite, delegateAccessory.mNumMessageSend == 1);
-    NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1);
-
-    NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumMessageSend == 2);
-    NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1);
-}
-
-void SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext)
-{
-    TestSecurePairingDelegate delegateCommissioner;
-    SecurePairingSession pairingCommissioner;
-    SecurePairingHandshakeTestCommon(inSuite, inContext, pairingCommissioner, delegateCommissioner);
-}
-
-void SecurePairingDeserialize(nlTestSuite * inSuite, void * inContext, SecurePairingSession & pairingCommissioner,
-                              SecurePairingSession & deserialized)
-{
-    SecurePairingSessionSerialized serialized;
-    NL_TEST_ASSERT(inSuite, pairingCommissioner.Serialize(serialized) == CHIP_NO_ERROR);
-
-    NL_TEST_ASSERT(inSuite, deserialized.Deserialize(serialized) == CHIP_NO_ERROR);
-
-    // Serialize from the deserialized session, and check we get the same string back
-    SecurePairingSessionSerialized serialized2;
-    NL_TEST_ASSERT(inSuite, deserialized.Serialize(serialized2) == CHIP_NO_ERROR);
-
-    NL_TEST_ASSERT(inSuite, strncmp(Uint8::to_char(serialized.inner), Uint8::to_char(serialized2.inner), sizeof(serialized)) == 0);
-}
-
-void SecurePairingSerializeTest(nlTestSuite * inSuite, void * inContext)
-{
-    TestSecurePairingDelegate delegateCommissioner;
-
-    // Allocate on the heap to avoid stack overflow in some restricted test scenarios (e.g. QEMU)
-    auto * testPairingSession1 = chip::Platform::New<SecurePairingSession>();
-    auto * testPairingSession2 = chip::Platform::New<SecurePairingSession>();
-
-    SecurePairingHandshakeTestCommon(inSuite, inContext, *testPairingSession1, delegateCommissioner);
-    SecurePairingDeserialize(inSuite, inContext, *testPairingSession1, *testPairingSession2);
-
-    const uint8_t plain_text[] = { 0x86, 0x74, 0x64, 0xe5, 0x0b, 0xd4, 0x0d, 0x90, 0xe1, 0x17, 0xa3, 0x2d, 0x4b, 0xd4, 0xe1, 0xe6 };
-    uint8_t encrypted[64];
-    PacketHeader header;
-    MessageAuthenticationCode mac;
-
-    // Let's try encrypting using original session, and decrypting using deserialized
-    {
-        SecureSession session1;
-
-        NL_TEST_ASSERT(inSuite,
-                       testPairingSession1->DeriveSecureSession(Uint8::from_const_char("abc"), 3, session1) == CHIP_NO_ERROR);
-
-        NL_TEST_ASSERT(inSuite, session1.Encrypt(plain_text, sizeof(plain_text), encrypted, header, mac) == CHIP_NO_ERROR);
-    }
-
-    {
-        SecureSession session2;
-        NL_TEST_ASSERT(inSuite,
-                       testPairingSession2->DeriveSecureSession(Uint8::from_const_char("abc"), 3, session2) == CHIP_NO_ERROR);
-
-        uint8_t decrypted[64];
-        NL_TEST_ASSERT(inSuite, session2.Decrypt(encrypted, sizeof(plain_text), decrypted, header, mac) == CHIP_NO_ERROR);
-        NL_TEST_ASSERT(inSuite, memcmp(plain_text, decrypted, sizeof(plain_text)) == 0);
-    }
-
-    chip::Platform::Delete(testPairingSession1);
-    chip::Platform::Delete(testPairingSession2);
-}
-
-// Test Suite
-
-/**
- *  Test Suite that lists all the test functions.
- */
-// clang-format off
-static const nlTest sTests[] =
-{
-    NL_TEST_DEF("WaitInit",    SecurePairingWaitTest),
-    NL_TEST_DEF("Start",       SecurePairingStartTest),
-    NL_TEST_DEF("Handshake",   SecurePairingHandshakeTest),
-    NL_TEST_DEF("Serialize",   SecurePairingSerializeTest),
-
-    NL_TEST_SENTINEL()
-};
-// clang-format on
-//
-/**
- *  Set up the test suite.
- */
-int TestSecurePairing_Setup(void * inContext)
-{
-    CHIP_ERROR error = chip::Platform::MemoryInit();
-    if (error != CHIP_NO_ERROR)
-        return FAILURE;
-    return SUCCESS;
-}
-
-/**
- *  Tear down the test suite.
- */
-int TestSecurePairing_Teardown(void * inContext)
-{
-    chip::Platform::MemoryShutdown();
-    return SUCCESS;
-}
-
-// clang-format off
-static nlTestSuite sSuite =
-{
-    "Test-CHIP-SecurePairing",
-    &sTests[0],
-    TestSecurePairing_Setup,
-    TestSecurePairing_Teardown,
-};
-// clang-format on
-
-/**
- *  Main
- */
-int TestSecurePairingSession()
-{
-    // Run test suit against one context
-    nlTestRunner(&sSuite, nullptr);
-
-    return (nlTestRunnerStats(&sSuite));
-}
-
-CHIP_REGISTER_TEST_SUITE(TestSecurePairingSession)
-
-namespace chip {
-namespace Logging {
-void LogV(uint8_t module, uint8_t category, const char * format, va_list argptr)
-{
-    (void) module, (void) category;
-    vfprintf(stderr, format, argptr);
-}
-} // namespace Logging
-} // namespace chip
diff --git a/third_party/bluez/repo/src/hcid.h b/third_party/bluez/repo/src/hcid.h
deleted file mode 100644 (file)
index 95d4b96..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2000-2001  Qualcomm Incorporated
- *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
- *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
- *
- *
- */
-
-typedef enum {
-       BT_MODE_DUAL,
-       BT_MODE_BREDR,
-       BT_MODE_LE,
-} bt_mode_t;
-
-typedef enum {
-       BT_GATT_CACHE_ALWAYS,
-       BT_GATT_CACHE_YES,
-       BT_GATT_CACHE_NO,
-} bt_gatt_cache_t;
-
-enum jw_repairing_t {
-       JW_REPAIRING_NEVER,
-       JW_REPAIRING_CONFIRM,
-       JW_REPAIRING_ALWAYS,
-};
-
-enum mps_mode_t {
-       MPS_OFF,
-       MPS_SINGLE,
-       MPS_MULTIPLE,
-};
-
-struct main_opts {
-       char            *name;
-       uint32_t        class;
-       gboolean        pairable;
-       uint32_t        pairto;
-       uint32_t        discovto;
-       uint32_t        tmpto;
-       uint8_t         privacy;
-
-       struct {
-               uint16_t        num_entries;
-
-               uint16_t        br_page_scan_type;
-               uint16_t        br_page_scan_interval;
-               uint16_t        br_page_scan_win;
-
-               uint16_t        br_scan_type;
-               uint16_t        br_scan_interval;
-               uint16_t        br_scan_win;
-
-               uint16_t        br_link_supervision_timeout;
-               uint16_t        br_page_timeout;
-
-               uint16_t        br_min_sniff_interval;
-               uint16_t        br_max_sniff_interval;
-
-               uint16_t        le_min_adv_interval;
-               uint16_t        le_max_adv_interval;
-               uint16_t        le_multi_adv_rotation_interval;
-
-               uint16_t        le_scan_interval_autoconnect;
-               uint16_t        le_scan_win_autoconnect;
-               uint16_t        le_scan_interval_suspend;
-               uint16_t        le_scan_win_suspend;
-               uint16_t        le_scan_interval_discovery;
-               uint16_t        le_scan_win_discovery;
-               uint16_t        le_scan_interval_adv_monitor;
-               uint16_t        le_scan_win_adv_monitor;
-               uint16_t        le_scan_interval_connect;
-               uint16_t        le_scan_win_connect;
-
-               uint16_t        le_min_conn_interval;
-               uint16_t        le_max_conn_interval;
-               uint16_t        le_conn_latency;
-               uint16_t        le_conn_lsto;
-               uint16_t        le_autoconnect_timeout;
-       } default_params;
-
-
-       gboolean        reverse_discovery;
-       gboolean        name_resolv;
-       gboolean        debug_keys;
-       gboolean        fast_conn;
-       gboolean        refresh_discovery;
-
-       uint16_t        did_source;
-       uint16_t        did_vendor;
-       uint16_t        did_product;
-       uint16_t        did_version;
-
-       bt_mode_t       mode;
-       bt_gatt_cache_t gatt_cache;
-       uint16_t        gatt_mtu;
-       uint8_t         gatt_channels;
-       enum mps_mode_t mps;
-
-       uint8_t         key_size;
-
-       enum jw_repairing_t jw_repairing;
-};
-
-extern struct main_opts main_opts;
-
-gboolean plugin_init(const char *enable, const char *disable);
-void plugin_cleanup(void);
-
-void rfkill_init(void);
-void rfkill_exit(void);
-
-GKeyFile *btd_get_main_conf(void);
-
-void btd_exit(void);
diff --git a/third_party/openthread/repo/examples/apps/ncp/ncp.cmake b/third_party/openthread/repo/examples/apps/ncp/ncp.cmake
deleted file mode 100644 (file)
index 4f7ca1a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-add_executable(ot-ncp-ftd
-    main.c
-)
-
-add_executable(ot-ncp-mtd
-    main.c
-)
-
-target_include_directories(ot-ncp-ftd PRIVATE ${COMMON_INCLUDES})
-target_include_directories(ot-ncp-mtd PRIVATE ${COMMON_INCLUDES})
-
-target_link_libraries(ot-ncp-ftd PRIVATE
-    openthread-ncp-ftd
-    ${OT_PLATFORM_LIB}
-    openthread-ftd
-    ${OT_PLATFORM_LIB}
-    mbedcrypto
-    ot-config
-)
-
-target_link_libraries(ot-ncp-mtd PRIVATE
-    openthread-ncp-mtd
-    ${OT_PLATFORM_LIB}
-    openthread-mtd
-    ${OT_PLATFORM_LIB}
-    mbedcrypto
-    ot-config
-)
-
-install(TARGETS ot-ncp-ftd ot-ncp-mtd DESTINATION bin)
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg1/Makefile.am
deleted file mode 100644 (file)
index c50b01a..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-
-lib_LIBRARIES = libopenthread-efr32mg1.a
-
-# Do not enable -Wconversion for rail
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-# Do not enable -pedantic-errors for rail
-override CFLAGS   := $(filter-out -pedantic-errors,$(CFLAGS))
-override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
-
-# Do not enable -Wundef for rail
-override CFLAGS   := $(filter-out -Wundef,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-libopenthread_efr32mg1_a_CPPFLAGS                                             = \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -Wno-sign-compare                                                           \
-    -DCORTEXM3                                                                  \
-    -DPHY=EMBER_PHY_RAIL                                                        \
-    -DMICRO=EMBER_MICRO_CORTEXM3_EFR32                                          \
-    -DCORTEXM3_EFM32_MICRO                                                      \
-    -DPLAT=EMBER_PLATFORM_CORTEXM3                                              \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg1/$(EFR32_BOARD_DIR)              \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)                                                            \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG1_$(BOARD)/config                      \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/bootloader/api                                    \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG1P/Include              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/inc                                    \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/config                                 \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-PLATFORM_SOURCES                                                              = \
-    alarm.c                                                                     \
-    diag.c                                                                      \
-    entropy.c                                                                   \
-    fem-control.c                                                               \
-    flash.c                                                                     \
-    logging.c                                                                   \
-    misc.c                                                                      \
-    openthread-core-efr32-config.h                                              \
-    openthread-core-efr32-config-check.h                                        \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    radio.c                                                                     \
-    rail_config.h                                                               \
-    startup-gcc.c                                                               \
-    system.c                                                                    \
-    uart.c                                                                      \
-    $(NULL)
-
-noinst_HEADERS                                                                = \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    $(NULL)
-
-libopenthread_efr32mg1_a_SOURCES                                              = \
-    $(PLATFORM_SOURCES)                                                         \
-    $(NULL)
-
-Dash = -
-libopenthread_efr32mg1_a_LIBADD                                                                      = \
-    $(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")             \
-    $(shell find $(top_builddir)/third_party/jlink/SEGGER_RTT_V640/RTT $(Dash)type f $(Dash)name "*.o")
-
-DIST_SUBDIRS                                                                  = \
-    $(NULL)
-
-SUBDIRS                                                                       = \
-    $(NULL)
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/Makefile.platform.am b/third_party/openthread/repo/examples/platforms/efr32mg1/Makefile.platform.am
deleted file mode 100644 (file)
index d7920a8..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# efr32mg1 platform-specific Makefile
-#
-
-LIBRAIL = $(shell                                                                \
-if [ "$(DMP)" = "1" ]; then                                                      \
-    echo "librail_multiprotocol_efr32xg1_gcc_release.a";                         \
-else                                                                             \
-    echo "librail_efr32xg1_gcc_release.a";                                       \
-fi )
-
-LDADD_COMMON                                                                  += \
-    $(top_builddir)/examples/platforms/efr32mg1/libopenthread-efr32mg1.a         \
-    $(top_builddir)/third_party/silabs/libsilabs-efr32mg1-sdk.a                  \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/autogen/librail_release/$(LIBRAIL) \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emdrv/nvm3/lib/libnvm3_CM4_gcc.a \
-    $(NULL)
-
-LDFLAGS_COMMON                                                                += \
-    -T $(top_srcdir)/examples/platforms/efr32mg1/efr32mg1.ld                     \
-    $(NULL)
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/README.md b/third_party/openthread/repo/examples/platforms/efr32mg1/README.md
deleted file mode 100644 (file)
index 17b5b65..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-# OpenThread on EFR32MG1P Example
-
-This directory contains example platform drivers for the [Silicon Labs EFR32MG1P][efr32mg1p] based on [EFR32™ Mighty Gecko Wireless Starter Kit][slwstk6000b].
-
-[efr32mg]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc
-[slwstk6000b]: http://www.silabs.com/products/development-tools/wireless/mesh-networking/mighty-gecko-starter-kit
-
-The example platform drivers are intended to present the minimal code necessary to support OpenThread. [EFR32MG1P SoC][efr32mg1p] has rich memory and peripheral resources which can support all OpenThread capabilities. See the "Run the example with EFR32MG1 boards" section below for an example using basic OpenThread capabilities.
-
-## Toolchain
-
-Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
-
-[gnu-toolchain]: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
-
-In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
-
-```bash
-$ cd <path-to-openthread>
-$ ./script/bootstrap
-```
-
-## Build Examples
-
-1. Download and install the [Simplicity Studio][simplicity_studio].
-
-[simplicity_studio]: http://www.silabs.com/products/development-tools/software/simplicity-studio
-
-2. Install Flex (Gecko) SDK including RAIL Library from Simplicity Studio.
-   - Connect EFR32MG1P Wireless Starter Kit to Simplicity Studio.
-   - Find Flex SDK v2.7 in the Software Update page and click Install.
-   - Flex SDK v2.7 will be installed in the path: `/SimplicityStudio_v4/developer/sdks/gecko_sdk_suite`.
-
-For more information on configuring, building, and installing applications for the Wireless Gecko (EFR32) portfolio using FLEX, see [Getting Started with the Silicon Labs Flex Software Development Kit for the Wireless Gecko (EFR32™) Portfolio][qsg138]. For more information on RAIL, see [Radio Abstraction Interface Layer][rail].
-
-[qsg138]: https://www.silabs.com/documents/public/quick-start-guides/qsg138-flex-efr32.pdf
-[rail]: http://www.silabs.com/products/development-tools/software/radio-abstraction-interface-layer-sdk
-
-3. Configure the path to Flex SDK source code.
-
-```bash
-$ cd <path-to-openthread>/third_party
-$ mkdir silabs
-$ cd <path-to-Simplicity-Studio>/developer/sdks
-$ cp -rf gecko_sdk_suite <path-to-openthread>/third_party/silabs/
-```
-
-Alternatively create a symbolic link to the Flex SDK source code.
-
-```bash
-$ cd <path-to-openthread>/third_party
-$ mkdir silabs
-$ ln -s <path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite silabs/gecko_sdk_suite
-```
-
-4. Build OpenThread Firmware (CLI example) on EFR32 platform.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-```
-
-For EFR32MG1™ Mighty Gecko Wireless Starter Kit:
-
-```bash
-$ make -f examples/Makefile-efr32mg1 BOARD=BRD4151A
-```
-
-After a successful build, the `elf` files are found in `<path-to-openthread>/output/efr32mg1/bin`.
-
-## Flash Binaries
-
-Compiled binaries may be flashed onto the EFR32 using [JLinkGDBServer][jlinkgdbserver]. EFR32 Starter kit mainboard integrates an on-board SEGGER J-Link debugger.
-
-[jlinkgdbserver]: https://www.segger.com/jlink-gdb-server.html
-
-```bash
-$ cd <path-to-JLinkGDBServer>
-$ sudo ./JLinkGDBServer -if swd -device EFR32MG1PxxxF256
-$ cd <path-to-openthread>/output/efr32mg1/bin
-$ arm-none-eabi-gdb ot-cli-ftd
-$ (gdb) target remote 127.0.0.1:2331
-$ (gdb) load
-$ (gdb) monitor reset
-$ (gdb) c
-```
-
-Or Compiled binaries also may be flashed onto the specified EFR32 dev board using [J-Link Commander][j-link-commander].
-
-[j-link-commander]: https://www.segger.com/products/debug-probes/j-link/tools/j-link-commander/
-
-```bash
-$ cd <path-to-openthread>/output/efr32mg1/bin
-$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex
-$ JLinkExe -device EFR32MG1PxxxF256 -speed 4000 -if SWD -autoconnect 1 -SelectEmuBySN <SerialNo>
-$ J-Link>loadfile ot-cli-ftd.hex
-$ J-Link>r
-$ J-Link>q
-```
-
-Note: SerialNo is J-Link serial number. Use the following command to get the serial number of the connected J-Link.
-
-```bash
-$ JLinkExe
-```
-
-Alternatively Simplicity Commander provides a graphical interface for J-Link Commander.
-
-```bash
-$ cd <path-to-openthread>/output/efr32mg1/bin
-$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.ihex
-$ <path-to-simplicity-studio>/developer/adapter_packs/commander/commander
-```
-
-In the J-Link Device drop-down list select the serial number of the device to flash. Click the Adapter Connect button. Ensure the Debug Interface drop-down list is set to SWD and click the Target Connect button. Click on the Flash icon on the left side of the window to switch to the flash page. In the Flash MCU pane enter the path of the ot-cli-ftd.s37 file or choose the file with the Browse... button. Click the Flash button located under the Browse... button.
-
-## Run the example with EFR32MG1 boards
-
-1. Flash two EFR32 boards with the `CLI example` firmware (as shown above).
-2. Open terminal to first device `/dev/ttyACM0` (serial port settings: 115200 8-N-1). Type `help` for a list of commands.
-
-   ```bash
-   > help
-   help
-   channel
-   childtimeout
-   contextreusedelay
-   extaddr
-   extpanid
-   ipaddr
-   keysequence
-   leaderweight
-   masterkey
-   mode
-   netdataregister
-   networkidtimeout
-   networkname
-   panid
-   ping
-   prefix
-   releaserouterid
-   rloc16
-   route
-   routerupgradethreshold
-   scan
-   start
-   state
-   stop
-   whitelist
-   ```
-
-3. Start a Thread network as Leader.
-
-   ```bash
-   > dataset init new
-   Done
-   > dataset
-   Active Timestamp: 1
-   Channel: 13
-   Channel Mask: 0x07fff800
-   Ext PAN ID: d63e8e3e495ebbc3
-   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
-   Master Key: dfd34f0f05cad978ec4e32b0413038ff
-   Network Name: OpenThread-8f28
-   PAN ID: 0x8f28
-   PSKc: c23a76e98f1a6483639b1ac1271e2e27
-   Security Policy: 0, onrcb
-   Done
-   > dataset commit active
-   Done
-   > ifconfig up
-   Done
-   > thread start
-   Done
-
-   wait a couple of seconds...
-
-   > state
-   leader
-   Done
-   ```
-
-4. Open terminal to second device `/dev/ttyACM1` (serial port settings: 115200 8-N-1) and attach it to the Thread network as a Router.
-
-   ```bash
-   > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
-   Done
-   > dataset commit active
-   Done
-   > routerselectionjitter 1
-   Done
-   > ifconfig up
-   Done
-   > thread start
-   Done
-
-   wait a couple of seconds...
-
-   > state
-   router
-   Done
-   ```
-
-5. List all IPv6 addresses of Leader.
-
-   ```bash
-   > ipaddr
-   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
-   fd3d:b50b:f96d:722d:0:ff:fe00:c00
-   fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-   fe80:0:0:0:6c41:9001:f3d6:4148
-   Done
-   ```
-
-6. Send an ICMPv6 ping to Leader's Mesh-EID IPv6 address.
-
-   ```bash
-   > ping fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-   16 bytes from fd3d:b50b:f96d:722d:558:f56b:d688:799: icmp_seq=1 hlim=64 time=24ms
-   ```
-
-The above example demonstrates basic OpenThread capabilities. Enable more features/roles (e.g. commissioner, joiner, DHCPv6 Server/Client, etc.) by assigning compile-options before compiling.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-$ make -f examples/Makefile-efr32mg1 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1
-```
-
-For a list of all available commands, visit [OpenThread CLI Reference README.md][cli].
-
-[cli]: https://github.com/openthread/openthread/blob/master/src/cli/README.md
-
-## Verification
-
-The following toolchain has been used for testing and verification:
-
-- gcc version 7.3.1
-
-The EFR32 example has been verified with following Flex SDK/RAIL Library version:
-
-- Flex SDK version 2.7.0.0
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/alarm.c b/third_party/openthread/repo/examples/platforms/efr32mg1/alarm.c
deleted file mode 100644 (file)
index 71a39c0..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the alarm.
- *
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "openthread-system.h"
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include "common/logging.hpp"
-
-#include "platform-efr32.h"
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "rail.h"
-#include "sl_sleeptimer.h"
-
-#define XTAL_ACCURACY 200
-
-static sl_sleeptimer_timer_handle_t sl_handle;
-static uint32_t                     sAlarm     = 0;
-static bool                         sIsRunning = false;
-
-static void AlarmCallback(sl_sleeptimer_timer_handle_t *aHandle, void *aData)
-{
-    otSysEventSignalPending();
-}
-
-void efr32AlarmInit(void)
-{
-    memset(&sl_handle, 0, sizeof sl_handle);
-}
-
-uint32_t otPlatAlarmMilliGetNow(void)
-{
-    uint64_t    ticks;
-    uint64_t    now;
-    sl_status_t status;
-
-    ticks  = sl_sleeptimer_get_tick_count64();
-    status = sl_sleeptimer_tick64_to_ms(ticks, &now);
-    assert(status == SL_STATUS_OK);
-    return (uint32_t)now;
-}
-
-uint32_t otPlatTimeGetXtalAccuracy(void)
-{
-    return XTAL_ACCURACY;
-}
-
-void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    sl_status_t status;
-    int32_t     remaining;
-    uint32_t    ticks;
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-
-    sAlarm     = aT0 + aDt;
-    remaining  = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-    sIsRunning = true;
-
-    if (remaining <= 0)
-    {
-        otSysEventSignalPending();
-    }
-    else
-    {
-        status = sl_sleeptimer_ms32_to_tick(remaining, &ticks);
-        assert(status == SL_STATUS_OK);
-
-        status = sl_sleeptimer_start_timer(&sl_handle, ticks, AlarmCallback, NULL, 0,
-                                           SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG);
-        assert(status == SL_STATUS_OK);
-    }
-}
-
-void otPlatAlarmMilliStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-    sIsRunning = false;
-}
-
-void efr32AlarmProcess(otInstance *aInstance)
-{
-    int32_t remaining;
-
-    if (sIsRunning)
-    {
-        remaining = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-
-        if (remaining <= 0)
-        {
-            sIsRunning = false;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-            if (otPlatDiagModeGet())
-            {
-                otPlatDiagAlarmFired(aInstance);
-            }
-            else
-#endif
-            {
-                otPlatAlarmMilliFired(aInstance);
-            }
-        }
-    }
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/brd4151a/board_config.h b/third_party/openthread/repo/examples/platforms/efr32mg1/brd4151a/board_config.h
deleted file mode 100644 (file)
index d798d52..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes dev borad compile-time configuration constants for efr32.
- *
- */
-
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-
-#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
-#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 0 /// Dev board doesn't support OQPSK modulation in 915MHz band.
-
-#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
-#endif
-
-#ifndef RADIO_CONFIG_DMP_SUPPORT
-#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
-#endif
-
-#define RADIO_CONFIG_PA_USES_DCDC 0 /// The PA(s) is(are) fed from VBAT
-
-#endif // __BOARD_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/brd4151a/hal-config.h b/third_party/openthread/repo/examples/platforms/efr32mg1/brd4151a/hal-config.h
deleted file mode 100644 (file)
index 24a9a5e..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-#ifndef HAL_CONFIG_H
-#define HAL_CONFIG_H
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-// This file is auto-generated by Hardware Configurator in Simplicity Studio.
-// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
-// Content outside these regions will be preserved.
-
-// $[ACMP0]
-// [ACMP0]$
-
-// $[ACMP1]
-// [ACMP1]$
-
-// $[ADC0]
-// [ADC0]$
-
-// $[ANTDIV]
-// [ANTDIV]$
-
-// $[BATTERYMON]
-// [BATTERYMON]$
-
-// $[BTL_BUTTON]
-// [BTL_BUTTON]$
-
-// $[BULBPWM]
-// [BULBPWM]$
-
-// $[BULBPWM_COLOR]
-// [BULBPWM_COLOR]$
-
-// $[BUTTON]
-#define BSP_BUTTON_PRESENT (1)
-
-#define BSP_BUTTON0_PIN (6U)
-#define BSP_BUTTON0_PORT (gpioPortF)
-
-#define BSP_BUTTON1_PIN (7U)
-#define BSP_BUTTON1_PORT (gpioPortF)
-
-#define BSP_BUTTON_COUNT (2U)
-#define BSP_BUTTON_INIT                                                            \
-    {                                                                              \
-        {BSP_BUTTON0_PORT, BSP_BUTTON0_PIN}, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } \
-    }
-#define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
-#define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
-// [BUTTON]$
-
-// $[CMU]
-#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
-#define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_LFXO_PRESENT (1)
-#define BSP_CLK_HFXO_PRESENT (1)
-#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
-#define BSP_CLK_LFXO_CTUNE (0)
-#define BSP_CLK_LFXO_FREQ (32768U)
-#define HAL_CLK_LFACLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_HFXO_FREQ (38400000UL)
-#define BSP_CLK_HFXO_CTUNE (338)
-#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
-#define BSP_CLK_HFXO_CTUNE_TOKEN (0)
-#define HAL_CLK_HFXO_AUTOSTART (HAL_CLK_HFXO_AUTOSTART_NONE)
-// [CMU]$
-
-// $[COEX]
-// [COEX]$
-
-// $[CS5463]
-// [CS5463]$
-
-// $[CSEN0]
-// [CSEN0]$
-
-// $[DCDC]
-#define BSP_DCDC_PRESENT (1)
-
-#define HAL_DCDC_BYPASS (0)
-#define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
-// [DCDC]$
-
-// $[EMU]
-// [EMU]$
-
-// $[EXTFLASH]
-// [EXTFLASH]$
-
-// $[EZRADIOPRO]
-// [EZRADIOPRO]$
-
-// $[GPIO]
-#define PORTIO_GPIO_SWCLKTCK_PIN (0)
-#define PORTIO_GPIO_SWCLKTCK_PORT (gpioPortF)
-#define PORTIO_GPIO_DBGROUTE_LOC (0)
-
-#define PORTIO_GPIO_SWDIOTMS_PIN (1)
-#define PORTIO_GPIO_SWDIOTMS_PORT (gpioPortF)
-
-#define PORTIO_GPIO_SWV_PIN (2)
-#define PORTIO_GPIO_SWV_PORT (gpioPortF)
-#define PORTIO_GPIO_SWV_LOC (0)
-
-#define PORTIO_GPIO_TCLK_PIN (8)
-#define PORTIO_GPIO_TCLK_PORT (gpioPortF)
-#define PORTIO_GPIO_TCLK_LOC (0)
-
-#define PORTIO_GPIO_TD0_PIN (9)
-#define PORTIO_GPIO_TD0_PORT (gpioPortF)
-#define PORTIO_GPIO_TD0_LOC (0)
-
-#define PORTIO_GPIO_TD1_PIN (10)
-#define PORTIO_GPIO_TD1_PORT (gpioPortF)
-#define PORTIO_GPIO_TD1_LOC (0)
-
-#define PORTIO_GPIO_TD2_PIN (11)
-#define PORTIO_GPIO_TD2_PORT (gpioPortF)
-#define PORTIO_GPIO_TD2_LOC (0)
-
-#define PORTIO_GPIO_TD3_PIN (12)
-#define PORTIO_GPIO_TD3_PORT (gpioPortF)
-#define PORTIO_GPIO_TD3_LOC (0)
-
-// [GPIO]$
-
-// $[I2C0]
-#define PORTIO_I2C0_SCL_PIN (10)
-#define PORTIO_I2C0_SCL_PORT (gpioPortC)
-#define PORTIO_I2C0_SCL_LOC (14)
-
-#define PORTIO_I2C0_SDA_PIN (11)
-#define PORTIO_I2C0_SDA_PORT (gpioPortC)
-#define PORTIO_I2C0_SDA_LOC (16)
-
-// [I2C0]$
-
-// $[I2C1]
-// [I2C1]$
-
-// $[I2CSENSOR]
-// [I2CSENSOR]$
-
-// $[IDAC0]
-// [IDAC0]$
-
-// $[IOEXP]
-// [IOEXP]$
-
-// $[LED]
-#define BSP_LED_PRESENT (1)
-
-#define BSP_LED0_PIN (4)
-#define BSP_LED0_PORT (gpioPortF)
-
-#define BSP_LED1_PIN (5)
-#define BSP_LED1_PORT (gpioPortF)
-
-#define HAL_LED_ENABLE \
-    {                  \
-        0, 1           \
-    }
-#define HAL_LED_COUNT (2)
-#define BSP_LED_COUNT (2)
-#define BSP_LED_INIT                                                   \
-    {                                                                  \
-        {BSP_LED0_PORT, BSP_LED0_PIN}, { BSP_LED1_PORT, BSP_LED1_PIN } \
-    }
-// [LED]$
-
-// $[LESENSE]
-// [LESENSE]$
-
-// $[LETIMER0]
-// [LETIMER0]$
-
-// $[LEUART0]
-// [LEUART0]$
-
-// $[LFXO]
-// [LFXO]$
-
-// $[LNA]
-// [LNA]$
-
-// $[PA]
-#define HAL_PA_ENABLE (1)
-
-#define HAL_PA_RAMP (10)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252)
-#define HAL_PA_VOLTAGE (3300)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-// [PA]$
-
-// $[PCNT0]
-// [PCNT0]$
-
-// $[PCNT1]
-// [PCNT1]$
-
-// $[PCNT2]
-// [PCNT2]$
-
-// $[PORTIO]
-// [PORTIO]$
-
-// $[PRS]
-#define PORTIO_PRS_CH4_PIN (13)
-#define PORTIO_PRS_CH4_PORT (gpioPortD)
-#define PORTIO_PRS_CH4_LOC (4)
-
-// [PRS]$
-
-// $[PTI]
-#define PORTIO_PTI_DFRAME_PIN (13)
-#define PORTIO_PTI_DFRAME_PORT (gpioPortB)
-#define PORTIO_PTI_DFRAME_LOC (6)
-
-#define PORTIO_PTI_DOUT_PIN (12)
-#define PORTIO_PTI_DOUT_PORT (gpioPortB)
-#define PORTIO_PTI_DOUT_LOC (6)
-
-#define HAL_PTI_ENABLE (1)
-
-#define BSP_PTI_DFRAME_PIN (13)
-#define BSP_PTI_DFRAME_PORT (gpioPortB)
-#define BSP_PTI_DFRAME_LOC (6)
-
-#define BSP_PTI_DOUT_PIN (12)
-#define BSP_PTI_DOUT_PORT (gpioPortB)
-#define BSP_PTI_DOUT_LOC (6)
-
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000)
-// [PTI]$
-
-// $[PYD1698]
-// [PYD1698]$
-
-// $[SERIAL]
-#define HAL_SERIAL_USART0_ENABLE (0)
-#define HAL_SERIAL_LEUART0_ENABLE (0)
-#define HAL_SERIAL_USART1_ENABLE (0)
-#define HAL_SERIAL_USART2_ENABLE (0)
-#define HAL_SERIAL_USART3_ENABLE (0)
-#define HAL_SERIAL_RXWAKE_ENABLE (0)
-#define BSP_SERIAL_APP_CTS_PIN (2)
-#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_CTS_LOC (30)
-
-#define BSP_SERIAL_APP_RX_PIN (1)
-#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RX_LOC (0)
-
-#define BSP_SERIAL_APP_TX_PIN (0)
-#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_TX_LOC (0)
-
-#define BSP_SERIAL_APP_RTS_PIN (3)
-#define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RTS_LOC (30)
-
-#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_BAUD_RATE (115200)
-#define HAL_SERIAL_APP_RXSTOP (16)
-#define HAL_SERIAL_APP_RXSTART (16)
-#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [SERIAL]$
-
-// $[SPIDISPLAY]
-// [SPIDISPLAY]$
-
-// $[SPINCP]
-// [SPINCP]$
-
-// $[TIMER0]
-// [TIMER0]$
-
-// $[TIMER1]
-// [TIMER1]$
-
-// $[UARTNCP]
-// [UARTNCP]$
-
-// $[USART0]
-#define PORTIO_USART0_CTS_PIN (2)
-#define PORTIO_USART0_CTS_PORT (gpioPortA)
-#define PORTIO_USART0_CTS_LOC (30)
-
-#define PORTIO_USART0_RTS_PIN (3)
-#define PORTIO_USART0_RTS_PORT (gpioPortA)
-#define PORTIO_USART0_RTS_LOC (30)
-
-#define PORTIO_USART0_RX_PIN (1)
-#define PORTIO_USART0_RX_PORT (gpioPortA)
-#define PORTIO_USART0_RX_LOC (0)
-
-#define PORTIO_USART0_TX_PIN (0)
-#define PORTIO_USART0_TX_PORT (gpioPortA)
-#define PORTIO_USART0_TX_LOC (0)
-
-#define HAL_USART0_ENABLE (1)
-
-#define BSP_USART0_CTS_PIN (2)
-#define BSP_USART0_CTS_PORT (gpioPortA)
-#define BSP_USART0_CTS_LOC (30)
-
-#define BSP_USART0_RX_PIN (1)
-#define BSP_USART0_RX_PORT (gpioPortA)
-#define BSP_USART0_RX_LOC (0)
-
-#define BSP_USART0_TX_PIN (0)
-#define BSP_USART0_TX_PORT (gpioPortA)
-#define BSP_USART0_TX_LOC (0)
-
-#define BSP_USART0_RTS_PIN (3)
-#define BSP_USART0_RTS_PORT (gpioPortA)
-#define BSP_USART0_RTS_LOC (30)
-
-#define HAL_USART0_RX_QUEUE_SIZE (128)
-#define HAL_USART0_BAUD_RATE (115200)
-#define HAL_USART0_RXSTOP (16)
-#define HAL_USART0_RXSTART (16)
-#define HAL_USART0_TX_QUEUE_SIZE (128)
-#define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
-// [USART0]$
-
-// $[USART1]
-#define PORTIO_USART1_CLK_PIN (8)
-#define PORTIO_USART1_CLK_PORT (gpioPortC)
-#define PORTIO_USART1_CLK_LOC (11)
-
-#define PORTIO_USART1_CS_PIN (9)
-#define PORTIO_USART1_CS_PORT (gpioPortC)
-#define PORTIO_USART1_CS_LOC (11)
-
-#define PORTIO_USART1_RX_PIN (7)
-#define PORTIO_USART1_RX_PORT (gpioPortC)
-#define PORTIO_USART1_RX_LOC (11)
-
-#define PORTIO_USART1_TX_PIN (6)
-#define PORTIO_USART1_TX_PORT (gpioPortC)
-#define PORTIO_USART1_TX_LOC (11)
-
-// [USART1]$
-
-// $[USART2]
-#define PORTIO_USART2_CLK_PIN (8)
-#define PORTIO_USART2_CLK_PORT (gpioPortA)
-#define PORTIO_USART2_CLK_LOC (1)
-
-#define PORTIO_USART2_CS_PIN (9)
-#define PORTIO_USART2_CS_PORT (gpioPortA)
-#define PORTIO_USART2_CS_LOC (1)
-
-#define PORTIO_USART2_RX_PIN (7)
-#define PORTIO_USART2_RX_PORT (gpioPortA)
-#define PORTIO_USART2_RX_LOC (1)
-
-#define PORTIO_USART2_TX_PIN (6)
-#define PORTIO_USART2_TX_PORT (gpioPortA)
-#define PORTIO_USART2_TX_LOC (1)
-
-// [USART2]$
-
-// $[USART3]
-#define PORTIO_USART3_CTS_PIN (8)
-#define PORTIO_USART3_CTS_PORT (gpioPortD)
-#define PORTIO_USART3_CTS_LOC (28)
-
-#define PORTIO_USART3_RTS_PIN (9)
-#define PORTIO_USART3_RTS_PORT (gpioPortD)
-#define PORTIO_USART3_RTS_LOC (28)
-
-#define PORTIO_USART3_RX_PIN (7)
-#define PORTIO_USART3_RX_PORT (gpioPortB)
-#define PORTIO_USART3_RX_LOC (10)
-
-#define PORTIO_USART3_TX_PIN (6)
-#define PORTIO_USART3_TX_PORT (gpioPortB)
-#define PORTIO_USART3_TX_LOC (10)
-
-// [USART3]$
-
-// $[VCOM]
-// [VCOM]$
-
-// $[VDAC0]
-// [VDAC0]$
-
-// $[VUART]
-// [VUART]$
-
-// $[WDOG]
-// [WDOG]$
-
-// $[WTIMER0]
-// [WTIMER0]$
-
-// $[WTIMER1]
-// [WTIMER1]$
-
-#endif /* HAL_CONFIG_H */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/crypto/efr32-mbedtls-config.h b/third_party/openthread/repo/examples/platforms/efr32mg1/crypto/efr32-mbedtls-config.h
deleted file mode 100644 (file)
index 14f1d1c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EFR32_MBEDTLS_CONFIG_H
-#define EFR32_MBEDTLS_CONFIG_H
-
-#include "em_device.h"
-
-/**
- * \def MBEDTLS_AES_ALT
- *
- * Enable hardware acceleration for the AES block cipher
- *
- * Module:  sl_crypto/src/crypto_aes.c for devices with CRYPTO
- *          sl_crypto/src/aes_aes.c for devices with AES
- *
- * See MBEDTLS_AES_C for more information.
- */
-#define MBEDTLS_AES_ALT
-
-/**
- * \def MBEDTLS_ECP_INTERNAL_ALT
- * \def ECP_SHORTWEIERSTRASS
- * \def MBEDTLS_ECP_ADD_MIXED_ALT
- * \def MBEDTLS_ECP_DOUBLE_JAC_ALT
- * \def MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
- * \def MBEDTLS_ECP_NORMALIZE_JAC_ALT
- *
- * Enable hardware acceleration for the elliptic curve over GF(p) library.
- *
- * Module:  sl_crypto/src/crypto_ecp.c
- * Caller:  library/ecp.c
- *
- * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_ECP_C and at least one
- * MBEDTLS_ECP_DP_XXX_ENABLED and (CRYPTO_COUNT > 0)
- */
-#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
-#define MBEDTLS_ECP_INTERNAL_ALT
-#define ECP_SHORTWEIERSTRASS
-#define MBEDTLS_ECP_ADD_MIXED_ALT
-#define MBEDTLS_ECP_DOUBLE_JAC_ALT
-#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
-#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
-#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
-#endif
-
-/**
- * \def MBEDTLS_SHA256_ALT
- *
- * Enable hardware acceleration for the SHA-224 and SHA-256 cryptographic
- * hash algorithms.
- *
- * Module:  sl_crypto/src/crypto_sha.c
- * Caller:  library/entropy.c
- *          library/mbedtls_md.c
- *          library/ssl_cli.c
- *          library/ssl_srv.c
- *          library/ssl_tls.c
- *
- * Requires: MBEDTLS_SHA256_C and (CRYPTO_COUNT > 0)
- * See MBEDTLS_SHA256_C for more information.
- */
-#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
-#define MBEDTLS_SHA256_ALT
-#endif
-
-#endif // EFR32_MBEDTLS_CONFIG_H
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/diag.c b/third_party/openthread/repo/examples/platforms/efr32mg1/diag.c
deleted file mode 100644 (file)
index a7c3357..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the diagnostics.
- *
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/radio.h>
-
-#include "platform-efr32.h"
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-/**
- * Diagnostics mode variables.
- *
- */
-static bool sDiagMode = false;
-
-void otPlatDiagModeSet(bool aMode)
-{
-    sDiagMode = aMode;
-}
-
-bool otPlatDiagModeGet()
-{
-    return sDiagMode;
-}
-
-void otPlatDiagChannelSet(uint8_t aChannel)
-{
-    OT_UNUSED_VARIABLE(aChannel);
-}
-
-void otPlatDiagTxPowerSet(int8_t aTxPower)
-{
-    OT_UNUSED_VARIABLE(aTxPower);
-}
-
-void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aFrame);
-    OT_UNUSED_VARIABLE(aError);
-}
-
-void otPlatDiagAlarmCallback(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-#endif // #if OPENTHREAD_CONFIG_DIAG_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/efr32mg1.ld b/third_party/openthread/repo/examples/platforms/efr32mg1/efr32mg1.ld
deleted file mode 100644 (file)
index 92ba35e..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
- /**
- * @file
- *   This file implements the OpenThread linker script for the
- *   Silicon Labs efr32mg1 platform.
- *
- */
-
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
-  RAM (rwx)  : ORIGIN = 0x20000000, LENGTH = 32K
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- *
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __copy_table_start__
- *   __copy_table_end__
- *   __zero_table_start__
- *   __zero_table_end__
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapBase
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- *   __Vectors_End
- *   __Vectors_Size
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-  .text :
-  {
-    KEEP(*(.vectors))
-    __Vectors_End = .;
-    __Vectors_Size = __Vectors_End - __Vectors;
-    __end__ = .;
-
-    *(.text*)
-
-    KEEP(*(.init))
-    KEEP(*(.fini))
-
-    /* .ctors */
-    *crtbegin.o(.ctors)
-    *crtbegin?.o(.ctors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-    *(SORT(.ctors.*))
-    *(.ctors)
-
-    /* .dtors */
-    *crtbegin.o(.dtors)
-    *crtbegin?.o(.dtors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-    *(SORT(.dtors.*))
-    *(.dtors)
-
-    *(.rodata*)
-
-    KEEP(*(.eh_frame*))
-  } > FLASH
-
-  .ARM.extab :
-  {
-    *(.ARM.extab* .gnu.linkonce.armextab.*)
-  } > FLASH
-
-  __exidx_start = .;
-  .ARM.exidx :
-  {
-    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-  } > FLASH
-  __exidx_end = .;
-
-  /* To copy multiple ROM to RAM sections,
-   * uncomment .copy.table section and,
-   * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .copy.table :
-  {
-    . = ALIGN(4);
-    __copy_table_start__ = .;
-    LONG (__etext)
-    LONG (__data_start__)
-    LONG (__data_end__ - __data_start__)
-    LONG (__etext2)
-    LONG (__data2_start__)
-    LONG (__data2_end__ - __data2_start__)
-    __copy_table_end__ = .;
-  } > FLASH
-  */
-
-  /* To clear multiple BSS sections,
-   * uncomment .zero.table section and,
-   * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .zero.table :
-  {
-    . = ALIGN(4);
-    __zero_table_start__ = .;
-    LONG (__bss_start__)
-    LONG (__bss_end__ - __bss_start__)
-    LONG (__bss2_start__)
-    LONG (__bss2_end__ - __bss2_start__)
-    __zero_table_end__ = .;
-  } > FLASH
-  */
-
-  __etext = .;
-
-  .data : AT (__etext)
-  {
-    __data_start__ = .;
-    *(vtable)
-    *(.data*)
-    . = ALIGN (4);
-    PROVIDE (__ram_func_section_start = .);
-    *(.ram)
-    PROVIDE (__ram_func_section_end = .);
-
-    . = ALIGN(4);
-    /* preinit data */
-    PROVIDE_HIDDEN (__preinit_array_start = .);
-    KEEP(*(.preinit_array))
-    PROVIDE_HIDDEN (__preinit_array_end = .);
-
-    . = ALIGN(4);
-    /* init data */
-    PROVIDE_HIDDEN (__init_array_start = .);
-    KEEP(*(SORT(.init_array.*)))
-    KEEP(*(.init_array))
-    PROVIDE_HIDDEN (__init_array_end = .);
-
-    . = ALIGN(4);
-    /* finit data */
-    PROVIDE_HIDDEN (__fini_array_start = .);
-    KEEP(*(SORT(.fini_array.*)))
-    KEEP(*(.fini_array))
-    PROVIDE_HIDDEN (__fini_array_end = .);
-
-    KEEP(*(.jcr*))
-    . = ALIGN(4);
-    /* All data end */
-    __data_end__ = .;
-
-  } > RAM
-
-  .bss :
-  {
-    . = ALIGN(4);
-    __bss_start__ = .;
-    *(.bss*)
-    *(COMMON)
-    . = ALIGN(4);
-    __bss_end__ = .;
-  } > RAM
-
-  .heap (COPY):
-  {
-    __HeapBase = .;
-    __end__ = .;
-    end = __end__;
-    _end = __end__;
-    KEEP(*(.heap*))
-    __HeapLimit = .;
-  } > RAM
-
-  /* .stack_dummy section doesn't contains any symbols. It is only
-   * used for linker to calculate size of stack sections, and assign
-   * values to stack symbols later */
-  .stack_dummy (COPY):
-  {
-    KEEP(*(.stack*))
-  } > RAM
-
-  /* Set stack top to end of RAM, and stack limit move down by
-   * size of stack_dummy section */
-  __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-  __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-  PROVIDE(__stack = __StackTop);
-
-  /*******************************************************************/
-  /* Define flash block for nvm3                                     */
-  .nvm (DSECT) : {
-    KEEP(*(.simee*))
-  } > FLASH
-
-  linker_nvm_end = ORIGIN(FLASH) + LENGTH(FLASH);
-  linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm);
-  linker_nvm_size = SIZEOF(.nvm);
-  __nvm3Base = linker_nvm_begin;
-  /*******************************************************************/
-
-  /* Check if data + heap + stack exceeds RAM limit */
-  ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-
-  /* Check if FLASH usage exceeds FLASH size */
-  ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/entropy.c b/third_party/openthread/repo/examples/platforms/efr32mg1/entropy.c
deleted file mode 100644 (file)
index 2b196bb..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements an entropy source based on ADC.
- *
- */
-
-#include <openthread/platform/entropy.h>
-
-#include "utils/code_utils.h"
-
-#include "em_adc.h"
-#include "em_cmu.h"
-
-enum
-{
-    EFR32_ADC_REF_CLOCK = 7000000,
-};
-
-void efr32RandomInit(void)
-{
-    /* Enable ADC Clock */
-    CMU_ClockEnable(cmuClock_ADC0, true);
-    ADC_Init_TypeDef       init       = ADC_INIT_DEFAULT;
-    ADC_InitSingle_TypeDef singleInit = ADC_INITSINGLE_DEFAULT;
-
-    /* Initialize the ADC with the required values */
-    init.timebase = ADC_TimebaseCalc(0);
-    init.prescale = ADC_PrescaleCalc(EFR32_ADC_REF_CLOCK, 0);
-    ADC_Init(ADC0, &init);
-
-    /* Initialize for single conversion specific to RNG */
-    singleInit.reference = adcRefVEntropy;
-    singleInit.diff      = true;
-    singleInit.posSel    = adcPosSelVSS;
-    singleInit.negSel    = adcNegSelVSS;
-    ADC_InitSingle(ADC0, &singleInit);
-
-    /* Set VINATT to maximum value and clear FIFO */
-    ADC0->SINGLECTRLX |= _ADC_SINGLECTRLX_VINATT_MASK;
-    ADC0->SINGLEFIFOCLEAR = ADC_SINGLEFIFOCLEAR_SINGLEFIFOCLEAR;
-}
-
-static uint32_t randomUint32Get(void)
-{
-    uint8_t  tmp;
-    uint32_t random = 0;
-
-    for (int i = 0; i < 4; i++)
-    {
-        tmp = 0;
-
-        for (int j = 0; j < 3; j++)
-        {
-            ADC_Start(ADC0, adcStartSingle);
-
-            while ((ADC0->IF & ADC_IF_SINGLE) == 0)
-                ;
-
-            tmp |= ((ADC_DataSingleGet(ADC0) & 0x07) << (j * 3));
-        }
-
-        random |= (tmp & 0xff) << (i * 8);
-    }
-
-    return random;
-}
-
-otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
-
-    for (uint16_t length = 0; length < aOutputLength; length++)
-    {
-        aOutput[length] = (uint8_t)randomUint32Get();
-    }
-
-exit:
-    return error;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/fem-control.c b/third_party/openthread/repo/examples/platforms/efr32mg1/fem-control.c
deleted file mode 100644 (file)
index f66415c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "hal-config.h"
-
-#if (HAL_FEM_ENABLE)
-#include "util/plugin/plugin-common/fem-control/fem-control.c"
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/flash.c b/third_party/openthread/repo/examples/platforms/efr32mg1/flash.c
deleted file mode 100644 (file)
index 4f35969..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the non-volatile storage.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#if OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE // Use OT NV system
-
-#include "em_msc.h"
-#include <string.h>
-#include <openthread/instance.h>
-
-#define FLASH_PAGE_NUM 2
-#define FLASH_DATA_END_ADDR (FLASH_BASE + FLASH_SIZE)
-#define FLASH_DATA_START_ADDR (FLASH_DATA_END_ADDR - (FLASH_PAGE_SIZE * FLASH_PAGE_NUM))
-#define FLASH_SWAP_PAGE_NUM (FLASH_PAGE_NUM / 2)
-#define FLASH_SWAP_SIZE (FLASH_PAGE_SIZE * FLASH_SWAP_PAGE_NUM)
-
-static inline uint32_t mapAddress(uint8_t aSwapIndex, uint32_t aOffset)
-{
-    uint32_t address;
-
-    address = FLASH_DATA_START_ADDR + aOffset;
-
-    if (aSwapIndex)
-    {
-        address += FLASH_SWAP_SIZE;
-    }
-
-    return address;
-}
-
-void otPlatFlashInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return FLASH_SWAP_SIZE;
-}
-
-void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint32_t address = mapAddress(aSwapIndex, 0);
-
-    for (uint32_t n = 0; n < FLASH_SWAP_PAGE_NUM; n++, address += FLASH_PAGE_SIZE)
-    {
-        MSC_ErasePage((uint32_t *)address);
-    }
-}
-
-void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    MSC_WriteWord((uint32_t *)mapAddress(aSwapIndex, aOffset), aData, aSize);
-}
-
-void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    memcpy(aData, (const uint8_t *)mapAddress(aSwapIndex, aOffset), aSize);
-}
-
-#else // Defaults to Silabs nvm3 system
-
-#include "nvm3.h"
-#include "nvm3_default.h"
-#include <string.h>
-#include <openthread/platform/settings.h>
-#include "common/code_utils.hpp"
-#include "common/logging.hpp"
-
-#define NVM3KEY_DOMAIN_OPENTHREAD 0x20000U
-#define NUM_INDEXED_SETTINGS \
-    OPENTHREAD_CONFIG_MLE_MAX_CHILDREN // Indexed key types are only supported for kKeyChildInfo (=='child table').
-#define ENUM_NVM3_KEY_LIST_SIZE 4      // List size used when enumerating nvm3 keys.
-
-static otError          addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength);
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index);
-static otError          mapNvm3Error(Ecode_t nvm3Res);
-
-void otPlatSettingsInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    if (mapNvm3Error(nvm3_open(nvm3_defaultHandle, nvm3_defaultInit)) != OT_ERROR_NONE)
-    {
-        otLogDebgPlat("Error initializing nvm3 instance");
-    }
-}
-
-void otPlatSettingsDeinit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    nvm3_close(nvm3_defaultHandle);
-}
-
-otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index', then reads the nvm3 data into the destination buffer.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError  err;
-    uint16_t valueLength = 0;
-
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if (idx == aIndex)
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    valueLength = objLen;
-
-                    // Only perform read if an input buffer was passed in.
-                    if ((aValue != NULL) && (aValueLength != NULL))
-                    {
-                        // Read all nvm3 obj bytes into a tmp buffer, then copy the required
-                        // number of bytes to the read destination buffer.
-                        uint8_t *buf = malloc(valueLength);
-                        err          = mapNvm3Error(nvm3_readData(nvm3_defaultHandle, nvm3Key, buf, valueLength));
-                        if (err == OT_ERROR_NONE)
-                        {
-                            memcpy(aValue, buf, (valueLength < *aValueLength) ? valueLength : *aValueLength);
-                        }
-                        free(buf);
-                        SuccessOrExit(err);
-                    }
-                }
-                idxFound = true;
-                break;
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    if (aValueLength != NULL)
-    {
-        *aValueLength = valueLength; // always return actual nvm3 object length.
-    }
-
-    return err;
-}
-
-otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError err;
-
-    // Delete all nvm3 objects matching the input key (i.e. the 'setting indexes' of the key).
-    err = otPlatSettingsDelete(aInstance, aKey, -1);
-    if ((err == OT_ERROR_NONE) || (err == OT_ERROR_NOT_FOUND))
-    {
-        // Add new setting object (i.e. 'index0' of the key).
-        err = addSetting(aKey, aValue, aValueLength);
-        SuccessOrExit(err);
-    }
-
-exit:
-    return err;
-}
-
-otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    return addSetting(aKey, aValue, aValueLength);
-}
-
-otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index' (or index = -1 to delete all), then deletes the nvm3 object.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError          err;
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if ((idx == aIndex) || (aIndex == -1))
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    // Delete the nvm3 object.
-                    err = mapNvm3Error(nvm3_deleteObject(nvm3_defaultHandle, nvm3Key));
-                    SuccessOrExit(err);
-                }
-                if (aIndex != -1)
-                {
-                    idxFound = true;
-                    break;
-                }
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    return err;
-}
-
-void otPlatSettingsWipe(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // Delete nvm3 objects for all OT Settings keys (and any of their associated 'indexes').
-    // Note- any OT User nvm3 objects in the OT nvm3 area are NOT be erased.
-    for (uint16_t aKey = 0; aKey < 8; ++aKey)
-    {
-        otPlatSettingsDelete(NULL, aKey, -1);
-    }
-}
-
-// Local functions..
-
-static otError addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    // Helper function- writes input buffer data to a NEW nvm3 object.
-    // nvm3 object is created at the first available Key + index.
-
-    otError err;
-
-    if ((aValueLength == 0) || (aValue == NULL))
-    {
-        err = OT_ERROR_INVALID_ARGS;
-    }
-    else
-    {
-        for (int idx = 0; idx <= NUM_INDEXED_SETTINGS; ++idx)
-        {
-            nvm3_ObjectKey_t nvm3Key;
-            nvm3Key = makeNvm3ObjKey(aKey, idx);
-
-            uint32_t objType;
-            size_t   objLen;
-            err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-            if (err == OT_ERROR_NOT_FOUND)
-            {
-                // Use this index for the new nvm3 object.
-                // Write the binary data to nvm3 (Creates nvm3 object if required).
-                err = mapNvm3Error(nvm3_writeData(nvm3_defaultHandle, nvm3Key, aValue, aValueLength));
-                break;
-            }
-            else if (err != OT_ERROR_NONE)
-            {
-                break;
-            }
-        }
-    }
-
-    return err;
-}
-
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index)
-{
-    return (NVM3KEY_DOMAIN_OPENTHREAD | (otSettingsKey << 8) | (index & 0xFF));
-}
-
-static otError mapNvm3Error(Ecode_t nvm3Res)
-{
-    otError err;
-
-    switch (nvm3Res)
-    {
-    case ECODE_NVM3_OK:
-        err = OT_ERROR_NONE;
-        break;
-
-    case ECODE_NVM3_ERR_KEY_NOT_FOUND:
-        err = OT_ERROR_NOT_FOUND;
-        break;
-
-    default:
-        err = OT_ERROR_FAILED;
-        break;
-    }
-
-    return err;
-}
-
-#endif // OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/logging.c b/third_party/openthread/repo/examples/platforms/efr32mg1/logging.c
deleted file mode 100644 (file)
index fa0a4dd..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file logging.c
- * Platform abstraction for the logging
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/logging.h>
-
-#include <utils/logging_rtt.h>
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-void efr32LogInit(void)
-{
-    utilsLogRttInit();
-}
-
-void efr32LogDeinit(void)
-{
-    utilsLogRttDeinit();
-}
-
-OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    va_list ap;
-
-    va_start(ap, aFormat);
-
-    utilsLogRttOutput(aLogLevel, aLogRegion, aFormat, ap);
-
-    va_end(ap);
-}
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/misc.c b/third_party/openthread/repo/examples/platforms/efr32mg1/misc.c
deleted file mode 100644 (file)
index 4b2076f..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for miscellaneous behaviors.
- */
-
-#include <openthread/platform/misc.h>
-
-#include "em_rmu.h"
-#include "platform-efr32.h"
-
-static uint32_t sResetCause;
-
-void efr32MiscInit(void)
-{
-    // Read the cause of last reset.
-    sResetCause = RMU_ResetCauseGet();
-
-    // Clear the register, as the causes cumulate over resets.
-    RMU_ResetCauseClear();
-}
-
-void otPlatReset(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    NVIC_SystemReset();
-}
-
-otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otPlatResetReason reason;
-
-    if (sResetCause & RMU_RSTCAUSE_PORST)
-    {
-        reason = OT_PLAT_RESET_REASON_POWER_ON;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_SYSREQRST)
-    {
-        reason = OT_PLAT_RESET_REASON_SOFTWARE;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_WDOGRST)
-    {
-        reason = OT_PLAT_RESET_REASON_WATCHDOG;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_EXTRST)
-    {
-        reason = OT_PLAT_RESET_REASON_EXTERNAL;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_LOCKUPRST)
-    {
-        reason = OT_PLAT_RESET_REASON_FAULT;
-    }
-    else if ((sResetCause & RMU_RSTCAUSE_AVDDBOD) || (sResetCause & RMU_RSTCAUSE_DECBOD) ||
-             (sResetCause & RMU_RSTCAUSE_DVDDBOD) || (sResetCause & RMU_RSTCAUSE_EM4RST))
-    {
-        reason = OT_PLAT_RESET_REASON_ASSERT;
-    }
-    else
-    {
-        reason = OT_PLAT_RESET_REASON_UNKNOWN;
-    }
-
-    return reason;
-}
-
-void otPlatWakeHost(void)
-{
-    // TODO: implement an operation to wake the host from sleep state.
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/openthread-core-efr32-config-check.h b/third_party/openthread/repo/examples/platforms/efr32mg1/openthread-core-efr32-config-check.h
deleted file mode 100644 (file)
index cf112c9..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-
-#include "board_config.h"
-
-#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
-#error "Platform efr32mg1 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
-#endif
-
-#ifndef RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
-#error "Platform efr32mg1 not configured to support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
-#endif
-#endif
-
-#endif /* OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_ */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/openthread-core-efr32-config.h b/third_party/openthread/repo/examples/platforms/efr32mg1/openthread-core-efr32-config.h
deleted file mode 100644 (file)
index d1cbde6..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes efr32 compile-time configuration constants
- *   for OpenThread.
- */
-
-#include "board_config.h"
-#include "em_msc.h"
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_H_
-
-/**
- * @def OPENTHREAD_CONFIG_LOG_OUTPUT
- *
- * The efr32 platform provides an otPlatLog() function.
- */
-#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT /* allow command line override */
-#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
-#endif
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
- *
- * Define to 1 if you want to enable physical layer to support OQPSK modulation in 915MHz band.
- *
- */
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 1
-#else
-#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 0
-#endif
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
- *
- * Define to 1 if you want to enable physical layer to support OQPSK modulation in 2.4GHz band.
- *
- */
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1
-#else
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 0
-#endif
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_INFO
- *
- * The platform-specific string to insert into the OpenThread version string.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_INFO "EFR32"
-
-/*
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
- *
- * Define to 1 if you want to enable software retransmission logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
- *
- * Define to 1 if you want to enable software CSMA-CA backoff logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
- *
- * Define to 1 if you want to enable software transmission security logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE
- *
- * Define to 1 if you want to enable software energy scanning logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
- *
- * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
- *
- * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
- *
- * Define to 1 to enable NCP UART support.
- *
- */
-#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
-
-#endif // OPENTHREAD_CORE_EFR32_CONFIG_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/platform-band.h b/third_party/openthread/repo/examples/platforms/efr32mg1/platform-band.h
deleted file mode 100644 (file)
index 7c4d912..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file defines the frequency band configuration structure for efr32.
- *
- */
-
-#ifndef PLATFORM_BAND_H_
-#define PLATFORM_BAND_H_
-
-#include <openthread/platform/radio.h>
-
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-#define RAIL_TX_FIFO_SIZE (OT_RADIO_FRAME_MAX_SIZE + 1)
-
-#define RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SLIP_TIME 500000UL
-#define RADIO_SCHEDULER_TX_PRIORITY 100
-#define RADIO_SCHEDULER_TX_SLIP_TIME 500000UL
-
-#define RADIO_TIMING_CSMA_OVERHEAD_US 500
-#define RADIO_TIMING_DEFAULT_BYTETIME_US 32   // only used if RAIL_GetBitRate returns 0
-#define RADIO_TIMING_DEFAULT_SYMBOLTIME_US 16 // only used if RAIL_GetSymbolRate returns 0
-
-typedef struct efr32RadioCounters
-{
-    uint64_t mRailPlatTxTriggered;
-    uint64_t mRailPlatRadioReceiveDoneCbCount;
-    uint64_t mRailPlatRadioEnergyScanDoneCbCount;
-    uint64_t mRailPlatRadioTxDoneCbCount;
-    uint64_t mRailTxStarted;
-    uint64_t mRailTxStartFailed;
-    uint64_t mRailEventConfigScheduled;
-    uint64_t mRailEventConfigUnScheduled;
-    uint64_t mRailEventPacketSent;
-    uint64_t mRailEventChannelBusy;
-    uint64_t mRailEventEnergyScanCompleted;
-    uint64_t mRailEventCalNeeded;
-    uint64_t mRailEventPacketReceived;
-    uint64_t mRailEventNoAck;
-    uint64_t mRailEventTxAbort;
-    uint64_t mRailEventSchedulerStatusError;
-    uint64_t mRailEventsSchedulerStatusTransmitBusy;
-    uint32_t mRailEventsSchedulerStatusLastStatus;
-} efr32RadioCounters;
-
-typedef struct efr32CommonConfig
-{
-    RAIL_Config_t mRailConfig;
-#if RADIO_CONFIG_DMP_SUPPORT
-    RAILSched_Config_t railSchedState;
-#endif
-    uint8_t
-        mRailTxFifo[RAIL_TX_FIFO_SIZE]; // must be 2 power between 64 and 4096, and bigger than OT_RADIO_FRAME_MAX_SIZE
-} efr32CommonConfig;
-
-typedef struct efr32BandConfig
-{
-    const RAIL_ChannelConfig_t *mChannelConfig;
-    uint8_t                     mChannelMin;
-    uint8_t                     mChannelMax;
-} efr32BandConfig;
-
-#endif // PLATFORM_BAND_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/platform-efr32.h b/third_party/openthread/repo/examples/platforms/efr32mg1/platform-efr32.h
deleted file mode 100644 (file)
index 5ec48e2..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes the platform-specific initializers.
- *
- */
-
-#ifndef PLATFORM_EFR32_H_
-#define PLATFORM_EFR32_H_
-
-#include <openthread/instance.h>
-
-#include "em_device.h"
-#include "em_system.h"
-
-#include "core_cm4.h"
-#include "rail.h"
-
-// Global OpenThread instance structure
-extern otInstance *sInstance;
-
-// Global reference to rail handle
-extern RAIL_Handle_t gRailHandle;
-
-/**
- * This function initializes the alarm service used by OpenThread.
- *
- */
-void efr32AlarmInit(void);
-
-/**
- * This function performs alarm driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32AlarmProcess(otInstance *aInstance);
-
-/**
- * This function initializes the radio service used by OpenThead.
- *
- */
-void efr32RadioInit(void);
-
-/**
- * This function deinitializes the radio service used by OpenThead.
- *
- */
-void efr32RadioDeinit(void);
-
-/**
- * This function performs radio driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32RadioProcess(otInstance *aInstance);
-
-/**
- * This function performs UART driver processing.
- *
- */
-void efr32UartProcess(void);
-
-/**
- * Initialization of Misc module.
- *
- */
-void efr32MiscInit(void);
-
-/**
- * Initialization of ADC module for random number generator.
- *
- */
-void efr32RandomInit(void);
-
-/**
- * Initialization of Logger driver.
- *
- */
-void efr32LogInit(void);
-
-/**
- * Deinitialization of Logger driver.
- *
- */
-void efr32LogDeinit(void);
-
-/**
- * Registers the sleep callback handler.  The callback is used to check that
- * the application has no work pending and that it is safe to put the EFR32
- * into a low energy sleep mode.
- *
- * The callback should return true if it is ok to enter sleep mode. Note
- * that the callback itself is run with interrupts disabled and so should
- * be kept as short as possible.  Anny interrupt including those from timers
- * will wake the EFR32 out of sleep mode.
- *
- * @param[in]  aCallback  Callback function.
- *
- */
-void efr32SetSleepCallback(bool (*aCallback)(void));
-
-/**
- * Put the EFR32 into a low power mode.  Before sleeping it will call a callback
- * in the application registered with efr32SetSleepCallback to ensure that there
- * is no outstanding work in the application to do.
- */
-void efr32Sleep(void);
-
-#endif // PLATFORM_EFR32_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/radio.c b/third_party/openthread/repo/examples/platforms/efr32mg1/radio.c
deleted file mode 100644 (file)
index ad2ce79..0000000
+++ /dev/null
@@ -1,1175 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for radio communication.
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-
-#include "openthread-system.h"
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include <openthread/platform/radio.h>
-
-#include "common/logging.hpp"
-#include "utils/code_utils.h"
-
-#include "utils/soft_source_match_table.h"
-
-#include "board_config.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "pa_conversions_efr32.h"
-#include "platform-band.h"
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-enum
-{
-    IEEE802154_MIN_LENGTH = 5,
-    IEEE802154_MAX_LENGTH = 127,
-    IEEE802154_ACK_LENGTH = 5,
-
-    // FCF + DSN + dest PANID + dest addr + src PANID + src addr (without security header)
-    IEEE802154_MAX_MHR_LENGTH = 2 + 1 + 2 + 8 + 2 + 8,
-
-    IEEE802154_FRAME_TYPE_MASK        = 0x7,
-    IEEE802154_FRAME_TYPE_ACK         = 0x2,
-    IEEE802154_FRAME_TYPE_MAC_COMMAND = 0x3,
-    IEEE802154_ACK_REQUEST            = 1 << 5,
-    IEEE802154_DSN_OFFSET             = 2,
-    IEEE802154_FCF_OFFSET             = 0,
-};
-
-enum
-{
-    EFR32_RECEIVE_SENSITIVITY    = -100, // dBm
-    EFR32_RSSI_AVERAGING_TIME    = 16,   // us
-    EFR32_RSSI_AVERAGING_TIMEOUT = 300,  // us
-};
-
-enum
-{
-    EFR32_SCHEDULER_SAMPLE_RSSI_PRIORITY = 10, // High priority
-    EFR32_SCHEDULER_TX_PRIORITY          = 10, // High priority
-    EFR32_SCHEDULER_RX_PRIORITY          = 20, // Low priority
-};
-
-enum
-{
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT && RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-    EFR32_NUM_BAND_CONFIGS = 2,
-#else
-    EFR32_NUM_BAND_CONFIGS = 1,
-#endif
-};
-
-typedef enum
-{
-    ENERGY_SCAN_STATUS_IDLE,
-    ENERGY_SCAN_STATUS_IN_PROGRESS,
-    ENERGY_SCAN_STATUS_COMPLETED
-} energyScanStatus;
-
-typedef enum
-{
-    ENERGY_SCAN_MODE_SYNC,
-    ENERGY_SCAN_MODE_ASYNC
-} energyScanMode;
-
-RAIL_Handle_t gRailHandle;
-
-static volatile bool sTransmitBusy = false;
-static bool          sPromiscuous  = false;
-static otRadioState  sState        = OT_RADIO_STATE_DISABLED;
-
-enum
-{
-    ACKED_WITH_FP_MATCH_LENGTH = 1 + IEEE802154_MAX_MHR_LENGTH, // PHR and MHR
-    ACKED_WITH_FP_SLOTS = 16, // maximum number of Data Request packets in the RX FIFO. Length should be a power of 2.
-};
-
-typedef struct efr32AckedWithFP
-{
-    uint8_t mLength;
-    uint8_t mPacket[ACKED_WITH_FP_MATCH_LENGTH];
-} efr32AckedWithFP;
-static bool              sIsSrcMatchEnabled = false;
-static efr32AckedWithFP  sAckedWithFPFifo[ACKED_WITH_FP_SLOTS];
-static uint32_t          sAckedWithFPReadIndex;
-static volatile uint32_t sAckedWithFPWriteIndex;
-
-static uint8_t      sReceivePsdu[IEEE802154_MAX_LENGTH];
-static otRadioFrame sReceiveFrame;
-static otError      sReceiveError;
-
-static otRadioFrame     sTransmitFrame;
-static uint8_t          sTransmitPsdu[IEEE802154_MAX_LENGTH];
-static volatile otError sTransmitError;
-
-static efr32CommonConfig sCommonConfig;
-static efr32BandConfig   sBandConfigs[EFR32_NUM_BAND_CONFIGS];
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-static efr32RadioCounters sRailDebugCounters;
-#endif
-
-static volatile energyScanStatus sEnergyScanStatus;
-static volatile int8_t           sEnergyScanResultDbm;
-static energyScanMode            sEnergyScanMode;
-
-#define QUARTER_DBM_IN_DBM 4
-#define US_IN_MS 1000
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents);
-
-static const RAIL_IEEE802154_Config_t sRailIeee802154Config = {
-    .addresses = NULL,
-    .ackConfig =
-        {
-            .enable     = true,
-            .ackTimeout = 864,
-            .rxTransitions =
-                {
-                    .success = RAIL_RF_STATE_RX,
-                    .error   = RAIL_RF_STATE_RX,
-                },
-            .txTransitions =
-                {
-                    .success = RAIL_RF_STATE_RX,
-                    .error   = RAIL_RF_STATE_RX,
-                },
-        },
-    .timings =
-        {
-            .idleToRx            = 100,
-            .txToRx              = 192 - 10,
-            .idleToTx            = 100,
-            .rxToTx              = 192,
-            .rxSearchTimeout     = 0,
-            .txToRxSearchTimeout = 0,
-        },
-    .framesMask       = RAIL_IEEE802154_ACCEPT_STANDARD_FRAMES,
-    .promiscuousMode  = false,
-    .isPanCoordinator = false,
-};
-
-#if RADIO_CONFIG_PA_USES_DCDC
-RAIL_DECLARE_TX_POWER_DCDC_CURVES(piecewiseSegments, curvesSg, curves24Hp, curves24Lp);
-#else
-RAIL_DECLARE_TX_POWER_VBAT_CURVES(piecewiseSegments, curvesSg, curves24Hp, curves24Lp);
-#endif
-
-static int8_t sTxPowerDbm = OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER;
-
-static int8_t sCcaThresholdDbm = -75; // default -75dBm energy detect threshold
-
-static efr32BandConfig *sCurrentBandConfig = NULL;
-
-static RAIL_Handle_t efr32RailInit(efr32CommonConfig *aCommonConfig)
-{
-    RAIL_Status_t status;
-    RAIL_Handle_t handle;
-
-    handle = RAIL_Init(&aCommonConfig->mRailConfig, NULL);
-    assert(handle != NULL);
-
-    status = RAIL_ConfigCal(handle, RAIL_CAL_ALL);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_IEEE802154_Init(handle, &sRailIeee802154Config);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_ConfigEvents(handle, RAIL_EVENTS_ALL,
-                               RAIL_EVENT_RX_ACK_TIMEOUT |                      //
-                                   RAIL_EVENTS_TX_COMPLETION |                  //
-                                   RAIL_EVENT_RX_PACKET_RECEIVED |              //
-                                   RAIL_EVENT_RSSI_AVERAGE_DONE |               //
-                                   RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND | //
-                                   RAIL_EVENT_CAL_NEEDED |                      //
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-                                   RAIL_EVENT_CONFIG_SCHEDULED |   //
-                                   RAIL_EVENT_CONFIG_UNSCHEDULED | //
-#endif
-                                   RAIL_EVENT_SCHEDULER_STATUS //
-    );
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    uint16_t actualLenth = RAIL_SetTxFifo(handle, aCommonConfig->mRailTxFifo, 0, sizeof(aCommonConfig->mRailTxFifo));
-    assert(actualLenth == sizeof(aCommonConfig->mRailTxFifo));
-
-    return handle;
-}
-
-static void efr32RailConfigLoad(efr32BandConfig *aBandConfig)
-{
-    RAIL_Status_t status;
-#if HAL_PA_2P4_LOWPOWER == 1
-    RAIL_TxPowerConfig_t txPowerConfig = {RAIL_TX_POWER_MODE_2P4_LP, HAL_PA_VOLTAGE, 10};
-#else
-    RAIL_TxPowerConfig_t txPowerConfig = {RAIL_TX_POWER_MODE_2P4_HP, HAL_PA_VOLTAGE, 10};
-#endif
-    if (aBandConfig->mChannelConfig != NULL)
-    {
-        uint16_t firstChannel = RAIL_ConfigChannels(gRailHandle, aBandConfig->mChannelConfig, NULL);
-        assert(firstChannel == aBandConfig->mChannelMin);
-
-        txPowerConfig.mode = RAIL_TX_POWER_MODE_SUBGIG;
-    }
-    else
-    {
-        status = RAIL_IEEE802154_Config2p4GHzRadio(gRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-    status = RAIL_ConfigTxPower(gRailHandle, &txPowerConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-static void efr32RadioSetTxPower(int8_t aPowerDbm)
-{
-    RAIL_Status_t              status;
-    RAIL_TxPowerCurvesConfig_t txPowerCurvesConfig = {curves24Hp, curvesSg, curves24Lp, piecewiseSegments};
-
-    status = RAIL_InitTxPowerCurves(&txPowerCurvesConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPowerDbm) * 10);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-static efr32BandConfig *efr32RadioGetBandConfig(uint8_t aChannel)
-{
-    efr32BandConfig *config = NULL;
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        if ((sBandConfigs[i].mChannelMin <= aChannel) && (aChannel <= sBandConfigs[i].mChannelMax))
-        {
-            config = &sBandConfigs[i];
-            break;
-        }
-    }
-
-    return config;
-}
-
-static void efr32ConfigInit(void (*aEventCallback)(RAIL_Handle_t railHandle, RAIL_Events_t events))
-{
-    sCommonConfig.mRailConfig.eventsCallback = aEventCallback;
-    sCommonConfig.mRailConfig.protocol       = NULL; // only used by Bluetooth stack
-#if RADIO_CONFIG_DMP_SUPPORT
-    sCommonConfig.mRailConfig.scheduler = &(sCommonConfig.railSchedState);
-#else
-    sCommonConfig.mRailConfig.scheduler = NULL; // only needed for DMP
-#endif
-
-    uint8_t index = 0;
-
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-    sBandConfigs[index].mChannelConfig = NULL;
-    sBandConfigs[index].mChannelMin    = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN;
-    sBandConfigs[index].mChannelMax    = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX;
-
-    index++;
-#endif
-
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-    sBandConfigs[index].mChannelConfig = channelConfigs[0];
-    sBandConfigs[index].mChannelMin    = OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN;
-    sBandConfigs[index].mChannelMax    = OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX;
-#endif
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    memset(&sRailDebugCounters, 0x00, sizeof(efr32RadioCounters));
-#endif
-
-    gRailHandle = efr32RailInit(&sCommonConfig);
-    assert(gRailHandle != NULL);
-    efr32RailConfigLoad(&(sBandConfigs[0]));
-}
-
-void efr32RadioInit(void)
-{
-    RAIL_Status_t status;
-
-    // check if RAIL_TX_FIFO_SIZE is power of two..
-    assert((RAIL_TX_FIFO_SIZE & (RAIL_TX_FIFO_SIZE - 1)) == 0);
-
-    // check the limits of the RAIL_TX_FIFO_SIZE.
-    assert((RAIL_TX_FIFO_SIZE >= 64) || (RAIL_TX_FIFO_SIZE <= 4096));
-
-    efr32ConfigInit(RAILCb_Generic);
-
-    CMU_ClockEnable(cmuClock_PRS, true);
-
-    status = RAIL_ConfigSleep(gRailHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sReceiveFrame.mLength  = 0;
-    sReceiveFrame.mPsdu    = sReceivePsdu;
-    sTransmitFrame.mLength = 0;
-    sTransmitFrame.mPsdu   = sTransmitPsdu;
-
-    sCurrentBandConfig = efr32RadioGetBandConfig(OPENTHREAD_CONFIG_DEFAULT_CHANNEL);
-    assert(sCurrentBandConfig != NULL);
-
-    memset(sAckedWithFPFifo, 0, sizeof(sAckedWithFPFifo));
-    sAckedWithFPWriteIndex = 0;
-    sAckedWithFPReadIndex  = 0;
-
-    efr32RadioSetTxPower(sTxPowerDbm);
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-    sTransmitError    = OT_ERROR_NONE;
-    sTransmitBusy     = false;
-
-    otLogInfoPlat("Initialized", NULL);
-}
-
-void efr32RadioDeinit(void)
-{
-    RAIL_Status_t status;
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE_ABORT, true);
-    status = RAIL_ConfigEvents(gRailHandle, RAIL_EVENTS_ALL, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sCurrentBandConfig = NULL;
-}
-
-static otError efr32StartEnergyScan(energyScanMode aMode, uint16_t aChannel, RAIL_Time_t aAveragingTimeUs)
-{
-    RAIL_Status_t    status;
-    otError          error  = OT_ERROR_NONE;
-    efr32BandConfig *config = NULL;
-
-    otEXPECT_ACTION(sEnergyScanStatus == ENERGY_SCAN_STATUS_IDLE, error = OT_ERROR_BUSY);
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IN_PROGRESS;
-    sEnergyScanMode   = aMode;
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-
-    config = efr32RadioGetBandConfig(aChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    if (sCurrentBandConfig != config)
-    {
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    RAIL_SchedulerInfo_t scanSchedulerInfo = {.priority        = RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY,
-                                              .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-                                              .transactionTime = aAveragingTimeUs};
-
-    status = RAIL_StartAverageRssi(gRailHandle, aChannel, aAveragingTimeUs, &scanSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-exit:
-    return error;
-}
-
-void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint64_t eui64;
-    uint8_t *eui64Ptr = NULL;
-
-    eui64    = SYSTEM_GetUnique();
-    eui64Ptr = (uint8_t *)&eui64;
-
-    for (uint8_t i = 0; i < OT_EXT_ADDRESS_SIZE; i++)
-    {
-        aIeeeEui64[i] = eui64Ptr[(OT_EXT_ADDRESS_SIZE - 1) - i];
-    }
-}
-
-void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("PANID=%X", aPanId);
-
-    utilsSoftSrcMatchSetPanId(aPanId);
-
-    status = RAIL_IEEE802154_SetPanId(gRailHandle, aPanId, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], aAddress->m8[4],
-                  aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]);
-
-    status = RAIL_IEEE802154_SetLongAddress(gRailHandle, (uint8_t *)aAddress->m8, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ShortAddr=%X", aAddress);
-
-    status = RAIL_IEEE802154_SetShortAddress(gRailHandle, aAddress, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-bool otPlatRadioIsEnabled(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return (sState != OT_RADIO_STATE_DISABLED);
-}
-
-otError otPlatRadioEnable(otInstance *aInstance)
-{
-    otEXPECT(!otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioDisable(otInstance *aInstance)
-{
-    otEXPECT(otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_DISABLED", NULL);
-    sState = OT_RADIO_STATE_DISABLED;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioSleep(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED),
-                    error = OT_ERROR_INVALID_STATE);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
-{
-    otError          error = OT_ERROR_NONE;
-    RAIL_Status_t    status;
-    efr32BandConfig *config;
-
-    OT_UNUSED_VARIABLE(aInstance);
-    otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    if (sCurrentBandConfig != config)
-    {
-        RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    RAIL_SchedulerInfo_t bgRxSchedulerInfo = {
-        .priority = RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY,
-        // sliptime/transaction time is not used for bg rx
-    };
-
-    status = RAIL_StartRx(gRailHandle, aChannel, &bgRxSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_RECEIVE", NULL);
-    sState                 = OT_RADIO_STATE_RECEIVE;
-    sReceiveFrame.mChannel = aChannel;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
-{
-    otError           error      = OT_ERROR_NONE;
-    RAIL_CsmaConfig_t csmaConfig = RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA;
-    RAIL_TxOptions_t  txOptions  = RAIL_TX_OPTIONS_DEFAULT;
-    efr32BandConfig * config;
-    RAIL_Status_t     status;
-    uint8_t           frameLength;
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    sRailDebugCounters.mRailPlatTxTriggered++;
-#endif
-
-    assert(sTransmitBusy == false);
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_DISABLED) && (sState != OT_RADIO_STATE_TRANSMIT),
-                    error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aFrame->mChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    sState         = OT_RADIO_STATE_TRANSMIT;
-    sTransmitError = OT_ERROR_NONE;
-    sTransmitBusy  = true;
-
-    if (sCurrentBandConfig != config)
-    {
-        RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    frameLength = (uint8_t)aFrame->mLength;
-    RAIL_WriteTxFifo(gRailHandle, &frameLength, sizeof frameLength, true);
-    RAIL_WriteTxFifo(gRailHandle, aFrame->mPsdu, frameLength - 2, false);
-
-    RAIL_SchedulerInfo_t txSchedulerInfo = {
-        .priority        = RADIO_SCHEDULER_TX_PRIORITY,
-        .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-        .transactionTime = 0, // will be calculated later if DMP is used
-    };
-
-    if (aFrame->mPsdu[0] & IEEE802154_ACK_REQUEST)
-    {
-        txOptions |= RAIL_TX_OPTION_WAIT_FOR_ACK;
-
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time we wait for ACK
-        if (RAIL_GetSymbolRate(gRailHandle) > 0)
-        {
-            txSchedulerInfo.transactionTime += 12 * 1e6 / RAIL_GetSymbolRate(gRailHandle);
-        }
-        else
-        {
-            txSchedulerInfo.transactionTime += 12 * RADIO_TIMING_DEFAULT_SYMBOLTIME_US;
-        }
-#endif
-    }
-
-#if RADIO_CONFIG_DMP_SUPPORT
-    // time needed for the frame itself
-    // 4B preamble, 1B SFD, 1B PHR is not counted in frameLength
-    if (RAIL_GetBitRate(gRailHandle) > 0)
-    {
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * 8 * 1e6 / RAIL_GetBitRate(gRailHandle);
-    }
-    else
-    { // assume 250kbps
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * RADIO_TIMING_DEFAULT_BYTETIME_US;
-    }
-#endif
-
-    if (aFrame->mInfo.mTxInfo.mCsmaCaEnabled)
-    {
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time needed for CSMA/CA
-        txSchedulerInfo.transactionTime += RADIO_TIMING_CSMA_OVERHEAD_US;
-#endif
-        csmaConfig.csmaTries    = aFrame->mInfo.mTxInfo.mMaxCsmaBackoffs;
-        csmaConfig.ccaThreshold = sCcaThresholdDbm;
-
-        status = RAIL_StartCcaCsmaTx(gRailHandle, aFrame->mChannel, txOptions, &csmaConfig, &txSchedulerInfo);
-    }
-    else
-    {
-        status = RAIL_StartTx(gRailHandle, aFrame->mChannel, txOptions, &txSchedulerInfo);
-    }
-
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStarted++;
-#endif
-        otPlatRadioTxStarted(aInstance, aFrame);
-    }
-    else
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStartFailed++;
-#endif
-        sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-        sTransmitBusy  = false;
-        otSysEventSignalPending();
-    }
-
-exit:
-    return error;
-}
-
-otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return &sTransmitFrame;
-}
-
-int8_t otPlatRadioGetRssi(otInstance *aInstance)
-{
-    otError  error;
-    uint32_t start;
-    int8_t   rssi = OT_RADIO_RSSI_INVALID;
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    error = efr32StartEnergyScan(ENERGY_SCAN_MODE_SYNC, sReceiveFrame.mChannel, EFR32_RSSI_AVERAGING_TIME);
-    otEXPECT(error == OT_ERROR_NONE);
-
-    start = RAIL_GetTime();
-
-    // waiting for the event RAIL_EVENT_RSSI_AVERAGE_DONE
-    while (sEnergyScanStatus == ENERGY_SCAN_STATUS_IN_PROGRESS &&
-           ((RAIL_GetTime() - start) < EFR32_RSSI_AVERAGING_TIMEOUT))
-        ;
-
-    if (sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        rssi = sEnergyScanResultDbm;
-    }
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-exit:
-    return rssi;
-}
-
-otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_ENERGY_SCAN;
-}
-
-bool otPlatRadioGetPromiscuous(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return sPromiscuous;
-}
-
-void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    sPromiscuous = aEnable;
-
-    status = RAIL_IEEE802154_SetPromiscuousMode(gRailHandle, aEnable);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // set Frame Pending bit for all outgoing ACKs if aEnable is false
-    sIsSrcMatchEnabled = aEnable;
-}
-
-static bool sAckedWithFPFifoIsFull(void)
-{
-    return (uint32_t)(sAckedWithFPWriteIndex - sAckedWithFPReadIndex) == otARRAY_LENGTH(sAckedWithFPFifo);
-}
-
-static bool sAckedWithFPFifoIsEmpty(void)
-{
-    return (uint32_t)(sAckedWithFPWriteIndex - sAckedWithFPReadIndex) == 0;
-}
-
-static efr32AckedWithFP *sAckedWithFPFifoGetWriteSlot(void)
-{
-    uint32_t idx = sAckedWithFPWriteIndex & (otARRAY_LENGTH(sAckedWithFPFifo) - 1);
-    return &sAckedWithFPFifo[idx];
-}
-
-static const efr32AckedWithFP *sAckedWithFPFifoGetReadSlot(void)
-{
-    uint32_t idx = sAckedWithFPReadIndex & (otARRAY_LENGTH(sAckedWithFPFifo) - 1);
-    return &sAckedWithFPFifo[idx];
-}
-
-static void insertIeee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
-{
-    assert(!sAckedWithFPFifoIsFull());
-    efr32AckedWithFP *const slot = sAckedWithFPFifoGetWriteSlot();
-
-    RAIL_RxPacketInfo_t packetInfo;
-
-    RAIL_GetRxIncomingPacketInfo(aRailHandle, &packetInfo);
-    assert(packetInfo.packetBytes >= 4); // PHR + FCF + DSN
-
-    if (packetInfo.packetBytes > sizeof(slot->mPacket))
-    {
-        packetInfo.packetBytes = sizeof(slot->mPacket);
-        if (packetInfo.firstPortionBytes >= sizeof(slot->mPacket))
-        {
-            packetInfo.firstPortionBytes = sizeof(slot->mPacket);
-            packetInfo.lastPortionData   = NULL;
-        }
-    }
-    slot->mLength = packetInfo.packetBytes;
-    RAIL_CopyRxPacket(slot->mPacket, &packetInfo);
-
-    ++sAckedWithFPWriteIndex;
-}
-
-static bool wasAckedWithFramePending(const uint8_t *aPsdu, uint8_t aPsduLength)
-{
-    bool     ackedWithFramePending = false;
-    uint16_t fcf                   = aPsdu[IEEE802154_FCF_OFFSET] | (aPsdu[IEEE802154_FCF_OFFSET + 1] << 8);
-
-    otEXPECT((fcf & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_MAC_COMMAND);
-
-    while (!(ackedWithFramePending || sAckedWithFPFifoIsEmpty()))
-    {
-        const efr32AckedWithFP *const slot = sAckedWithFPFifoGetReadSlot();
-        if ((slot->mPacket[0] == aPsduLength) && (memcmp(slot->mPacket + 1, aPsdu, slot->mLength - 1) == 0))
-        {
-            ackedWithFramePending = true;
-        }
-        ++sAckedWithFPReadIndex;
-    }
-
-exit:
-    return ackedWithFramePending;
-}
-
-static void processNextRxPacket(otInstance *aInstance)
-{
-    RAIL_RxPacketHandle_t  packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    RAIL_RxPacketInfo_t    packetInfo;
-    RAIL_RxPacketDetails_t packetDetails;
-    RAIL_Status_t          status;
-    uint16_t               length;
-
-    packetHandle = RAIL_GetRxPacketInfo(gRailHandle, RAIL_RX_PACKET_HANDLE_OLDEST, &packetInfo);
-
-    otEXPECT_ACTION(packetHandle != RAIL_RX_PACKET_HANDLE_INVALID &&
-                        packetInfo.packetStatus == RAIL_RX_PACKET_READY_SUCCESS,
-                    packetHandle = RAIL_RX_PACKET_HANDLE_INVALID);
-
-    status = RAIL_GetRxPacketDetailsAlt(gRailHandle, packetHandle, &packetDetails);
-    otEXPECT(status == RAIL_STATUS_NO_ERROR);
-
-    length = packetInfo.packetBytes + 1;
-
-    // check the length in recv packet info structure; RAIL should take care of this.
-    assert(length == packetInfo.firstPortionData[0]);
-
-    // check the length validity of recv packet; RAIL should take care of this.
-    assert(length >= IEEE802154_MIN_LENGTH && length <= IEEE802154_MAX_LENGTH);
-
-    otLogInfoPlat("Received data:%d", length);
-
-    // skip length byte
-    assert(packetInfo.firstPortionBytes > 0);
-    packetInfo.firstPortionData++;
-    packetInfo.firstPortionBytes--;
-    packetInfo.packetBytes--;
-
-    // read packet
-    RAIL_CopyRxPacket(sReceiveFrame.mPsdu, &packetInfo);
-
-    status = RAIL_ReleaseRxPacket(gRailHandle, packetHandle);
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-        packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    }
-
-    sReceiveFrame.mLength = length;
-
-    if (packetDetails.isAck)
-    {
-        assert((length == IEEE802154_ACK_LENGTH) &&
-               (sReceiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK);
-
-        RAIL_YieldRadio(gRailHandle);
-        sTransmitBusy = false;
-
-        if (sReceiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET])
-        {
-            sTransmitError = OT_ERROR_NONE;
-        }
-        else
-        {
-            sTransmitError = OT_ERROR_NO_ACK;
-        }
-    }
-    else
-    {
-        // signal MAC layer for each received frame if promiscuous is enabled
-        // otherwise only signal MAC layer for non-ACK frame
-        otEXPECT(sPromiscuous || (length != IEEE802154_ACK_LENGTH));
-
-        sReceiveError = OT_ERROR_NONE;
-
-        sReceiveFrame.mInfo.mRxInfo.mRssi = packetDetails.rssi;
-        sReceiveFrame.mInfo.mRxInfo.mLqi  = packetDetails.lqi;
-
-        // Get the timestamp when the SFD was received
-        assert(packetDetails.timeReceived.timePosition != RAIL_PACKET_TIME_INVALID);
-        packetDetails.timeReceived.totalPacketBytes = length + 1;
-
-        status = RAIL_GetRxTimeSyncWordEndAlt(gRailHandle, &packetDetails);
-        assert(status == RAIL_STATUS_NO_ERROR);
-        sReceiveFrame.mInfo.mRxInfo.mTimestamp = packetDetails.timeReceived.packetTime;
-
-        // Set this flag only when the packet is really acknowledged with frame pending set.
-        sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending =
-            wasAckedWithFramePending(sReceiveFrame.mPsdu, sReceiveFrame.mLength);
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-        }
-        else
-#endif
-        {
-            otLogInfoPlat("Received %d bytes", sReceiveFrame.mLength);
-            otPlatRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailPlatRadioReceiveDoneCbCount++;
-#endif
-        }
-    }
-
-    otSysEventSignalPending();
-
-exit:
-
-    if (packetHandle != RAIL_RX_PACKET_HANDLE_INVALID)
-    {
-        RAIL_ReleaseRxPacket(gRailHandle, packetHandle);
-    }
-}
-
-static void ieee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
-{
-    RAIL_Status_t status;
-
-    if (sIsSrcMatchEnabled)
-    {
-        RAIL_IEEE802154_Address_t sourceAddress;
-
-        status = RAIL_IEEE802154_GetAddress(aRailHandle, &sourceAddress);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-        if ((sourceAddress.length == RAIL_IEEE802154_LongAddress &&
-             utilsSoftSrcMatchExtFindEntry((otExtAddress *)sourceAddress.longAddress) >= 0) ||
-            (sourceAddress.length == RAIL_IEEE802154_ShortAddress &&
-             utilsSoftSrcMatchShortFindEntry(sourceAddress.shortAddress) >= 0))
-        {
-            status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-            assert(status == RAIL_STATUS_NO_ERROR);
-            insertIeee802154DataRequestCommand(aRailHandle);
-        }
-    }
-    else
-    {
-        status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-        insertIeee802154DataRequestCommand(aRailHandle);
-    }
-}
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents)
-{
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    if (aEvents & RAIL_EVENT_CONFIG_SCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigScheduled++;
-    }
-    if (aEvents & RAIL_EVENT_CONFIG_UNSCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigUnScheduled++;
-    }
-#endif
-    if (aEvents & RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND)
-    {
-        ieee802154DataRequestCommand(aRailHandle);
-    }
-
-    if (aEvents & RAIL_EVENTS_TX_COMPLETION)
-    {
-        if (aEvents & RAIL_EVENT_TX_PACKET_SENT)
-        {
-            if ((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0)
-            {
-                RAIL_YieldRadio(aRailHandle);
-                sTransmitError = OT_ERROR_NONE;
-                sTransmitBusy  = false;
-            }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventPacketSent++;
-#endif
-        }
-        else if (aEvents & RAIL_EVENT_TX_CHANNEL_BUSY)
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventChannelBusy++;
-#endif
-        }
-        else
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventTxAbort++;
-#endif
-        }
-    }
-
-    if (aEvents & RAIL_EVENT_RX_ACK_TIMEOUT)
-    {
-        RAIL_YieldRadio(aRailHandle);
-        sTransmitError = OT_ERROR_NO_ACK;
-        sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventNoAck++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RX_PACKET_RECEIVED)
-    {
-        RAIL_HoldRxPacket(aRailHandle);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventPacketReceived++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_CAL_NEEDED)
-    {
-        RAIL_Status_t status;
-
-        status = RAIL_Calibrate(aRailHandle, NULL, RAIL_CAL_ALL_PENDING);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventCalNeeded++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RSSI_AVERAGE_DONE)
-    {
-        const int16_t energyScanResultQuarterDbm = RAIL_GetAverageRssi(aRailHandle);
-        RAIL_YieldRadio(aRailHandle);
-
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_COMPLETED;
-
-        if (energyScanResultQuarterDbm == RAIL_RSSI_INVALID)
-        {
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-        else
-        {
-            sEnergyScanResultDbm = energyScanResultQuarterDbm / QUARTER_DBM_IN_DBM;
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioEnergyScanDoneCbCount++;
-#endif
-    }
-    if (aEvents & RAIL_EVENT_SCHEDULER_STATUS)
-    {
-        RAIL_SchedulerStatus_t status = RAIL_GetSchedulerStatus(aRailHandle);
-
-        assert(status != RAIL_SCHEDULER_STATUS_INTERNAL_ERROR);
-
-        if (status == RAIL_SCHEDULER_STATUS_CCA_CSMA_TX_FAIL || status == RAIL_SCHEDULER_STATUS_SINGLE_TX_FAIL ||
-            status == RAIL_SCHEDULER_STATUS_SCHEDULED_TX_FAIL ||
-            (status == RAIL_SCHEDULER_STATUS_SCHEDULE_FAIL && sTransmitBusy) ||
-            (status == RAIL_SCHEDULER_STATUS_EVENT_INTERRUPTED && sTransmitBusy))
-        {
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventSchedulerStatusError++;
-#endif
-        }
-        else if (status == RAIL_SCHEDULER_STATUS_AVERAGE_RSSI_FAIL)
-        {
-            sEnergyScanStatus    = ENERGY_SCAN_STATUS_COMPLETED;
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        else if (sTransmitBusy)
-        {
-            sRailDebugCounters.mRailEventsSchedulerStatusLastStatus = status;
-            sRailDebugCounters.mRailEventsSchedulerStatusTransmitBusy++;
-        }
-#endif
-    }
-
-    otSysEventSignalPending();
-}
-
-otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return efr32StartEnergyScan(ENERGY_SCAN_MODE_ASYNC, aScanChannel, (RAIL_Time_t)aScanDuration * US_IN_MS);
-}
-
-void efr32RadioProcess(otInstance *aInstance)
-{
-    // We should process the received packet first. Adding it at the end of this function,
-    // will delay the stack notification until the next call to efr32RadioProcess()
-    processNextRxPacket(aInstance);
-
-    if (sState == OT_RADIO_STATE_TRANSMIT && sTransmitBusy == false)
-    {
-        if (sTransmitError != OT_ERROR_NONE)
-        {
-            otLogDebgPlat("Transmit failed ErrorCode=%d", sTransmitError);
-        }
-
-        sState = OT_RADIO_STATE_RECEIVE;
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioTransmitDone(aInstance, &sTransmitFrame, sTransmitError);
-        }
-        else
-#endif
-            if (((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) || (sTransmitError != OT_ERROR_NONE))
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, sTransmitError);
-        }
-        else
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, &sReceiveFrame, sTransmitError);
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioTxDoneCbCount++;
-#endif
-
-        otSysEventSignalPending();
-    }
-    else if (sEnergyScanMode == ENERGY_SCAN_MODE_ASYNC && sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-        otPlatRadioEnergyScanDone(aInstance, sEnergyScanResultDbm);
-        otSysEventSignalPending();
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventEnergyScanCompleted++;
-#endif
-    }
-}
-
-otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
-    *aPower = sTxPowerDbm;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPower) * 10);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sTxPowerDbm = aPower;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-    otEXPECT_ACTION(aThreshold != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    *aThreshold = sCcaThresholdDbm;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sCcaThresholdDbm = aThreshold;
-
-    return OT_ERROR_NONE;
-}
-
-int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return EFR32_RECEIVE_SENSITIVITY;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/rail_config.h b/third_party/openthread/repo/examples/platforms/efr32mg1/rail_config.h
deleted file mode 100644 (file)
index 5a62825..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __RAIL_CONFIG_H__
-#define __RAIL_CONFIG_H__
-
-#include "board_config.h"
-#include "rail_types.h"
-#include <stdint.h>
-
-#define RADIO_CONFIG_XTAL_FREQUENCY 38400000UL
-
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-extern const RAIL_ChannelConfig_t *channelConfigs[];
-#endif
-
-#endif // __RAIL_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/startup-gcc.c b/third_party/openthread/repo/examples/platforms/efr32mg1/startup-gcc.c
deleted file mode 100644 (file)
index 85c9e2a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements gcc-specific startup code for the efr32.
- */
-
-__extension__ typedef int __guard __attribute__((mode(__DI__)));
-
-int __cxa_guard_acquire(__guard *g)
-{
-    return !*(char *)(g);
-}
-
-void __cxa_guard_release(__guard *g)
-{
-    *(char *)g = 1;
-}
-
-void __cxa_guard_abort(__guard *g)
-{
-    (void)g;
-}
-
-void __cxa_pure_virtual(void)
-{
-    while (1)
-        ;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/system.c b/third_party/openthread/repo/examples/platforms/efr32mg1/system.c
deleted file mode 100644 (file)
index 2b5087b..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief
- *   This file includes the platform-specific initializers.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-#include <string.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "common/logging.hpp"
-
-#include "bsp.h"
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_emu.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "rail.h"
-#include "sl_mpu.h"
-#include "sl_sleeptimer.h"
-
-#include "platform-efr32.h"
-
-#if (HAL_FEM_ENABLE)
-#include "fem-control.h"
-#endif
-
-#define USE_EFR32_LOG (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-
-void halInitChipSpecific(void);
-
-otInstance *sInstance;
-static bool (*sCanSleepCallback)(void);
-
-void otSysInit(int argc, char *argv[])
-{
-    OT_UNUSED_VARIABLE(argc);
-    OT_UNUSED_VARIABLE(argv);
-    sl_status_t status;
-
-    __disable_irq();
-
-#undef FIXED_EXCEPTION
-#define FIXED_EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler)
-#define EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler, priorityLevel, subpriority) \
-    NVIC_SetPriority(deviceIrqn, NVIC_EncodePriority(PRIGROUP_POSITION, priorityLevel, subpriority));
-#include NVIC_CONFIG
-#undef EXCEPTION
-
-    NVIC_SetPriorityGrouping(PRIGROUP_POSITION);
-    CHIP_Init();
-    halInitChipSpecific();
-    BSP_Init(BSP_INIT_BCC);
-
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFRCO);
-    CMU_ClockEnable(cmuClock_CORELE, true);
-    CMU_ClockEnable(cmuClock_RTCC, true);
-    status = sl_sleeptimer_init();
-    assert(status == SL_STATUS_OK);
-
-#if (HAL_FEM_ENABLE)
-    initFem();
-    wakeupFem();
-#endif
-
-    __enable_irq();
-
-#if USE_EFR32_LOG
-    efr32LogInit();
-#endif
-    efr32RadioInit();
-    efr32AlarmInit();
-    efr32MiscInit();
-    efr32RandomInit();
-}
-
-bool otSysPseudoResetWasRequested(void)
-{
-    return false;
-}
-
-void otSysDeinit(void)
-{
-    efr32RadioDeinit();
-
-#if USE_EFR32_LOG
-    efr32LogDeinit();
-#endif
-}
-
-void efr32SetSleepCallback(bool (*aCallback)(void))
-{
-    sCanSleepCallback = aCallback;
-}
-
-void efr32Sleep(void)
-{
-    bool canDeepSleep      = false;
-    int  wakeupProcessTime = 1000;
-    CORE_DECLARE_IRQ_STATE;
-
-    if (RAIL_Sleep(wakeupProcessTime, &canDeepSleep) == RAIL_STATUS_NO_ERROR)
-    {
-        if (canDeepSleep)
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM2(true);
-            }
-            CORE_EXIT_ATOMIC();
-            // TODO OT will handle an interrupt here and it mustn't call any RAIL APIs
-
-            while (RAIL_Wake(0) != RAIL_STATUS_NO_ERROR)
-            {
-            }
-        }
-        else
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM1();
-            }
-            CORE_EXIT_ATOMIC();
-        }
-    }
-}
-
-void otSysProcessDrivers(otInstance *aInstance)
-{
-    sInstance = aInstance;
-
-    // should sleep and wait for interrupts here
-
-    efr32UartProcess();
-    efr32RadioProcess(aInstance);
-    efr32AlarmProcess(aInstance);
-}
-
-__WEAK void otSysEventSignalPending(void)
-{
-    // Intentionally empty
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg1/uart.c b/third_party/openthread/repo/examples/platforms/efr32mg1/uart.c
deleted file mode 100644 (file)
index f93f75f..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for UART communication.
- *
- */
-
-#include <stddef.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "uartdrv.h"
-
-#include "hal-config.h"
-
-enum
-{
-    kReceiveFifoSize = 128,
-};
-
-#define USART_INIT                                                                               \
-    {                                                                                            \
-        USART0,                                               /* USART port */                   \
-            115200,                                           /* Baud rate */                    \
-            BSP_SERIAL_APP_TX_LOC,                            /* USART Tx pin location number */ \
-            BSP_SERIAL_APP_RX_LOC,                            /* USART Rx pin location number */ \
-            (USART_Stopbits_TypeDef)USART_FRAME_STOPBITS_ONE, /* Stop bits */                    \
-            (USART_Parity_TypeDef)USART_FRAME_PARITY_NONE,    /* Parity */                       \
-            (USART_OVS_TypeDef)USART_CTRL_OVS_X16,            /* Oversampling mode*/             \
-            false,                                            /* Majority vote disable */        \
-            HAL_SERIAL_APP_FLOW_CONTROL,                      /* Flow control */                 \
-            BSP_SERIAL_APP_CTS_PORT,                          /* CTS port number */              \
-            BSP_SERIAL_APP_CTS_PIN,                           /* CTS pin number */               \
-            BSP_SERIAL_APP_RTS_PORT,                          /* RTS port number */              \
-            BSP_SERIAL_APP_RTS_PIN,                           /* RTS pin number */               \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartRxQueue,      /* RX operation queue */           \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartTxQueue,      /* TX operation queue */           \
-            BSP_SERIAL_APP_CTS_LOC,                           /* CTS location */                 \
-            BSP_SERIAL_APP_RTS_LOC                            /* RTS location */                 \
-    }
-
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_RX_BUFS, sUartRxQueue);
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_TX_BUFS, sUartTxQueue);
-
-static UARTDRV_HandleData_t sUartHandleData;
-static UARTDRV_Handle_t     sUartHandle = &sUartHandleData;
-static uint8_t              sReceiveBuffer[2];
-static const uint8_t *      sTransmitBuffer = NULL;
-static volatile uint16_t    sTransmitLength = 0;
-
-typedef struct ReceiveFifo_t
-{
-    // The data buffer
-    uint8_t mBuffer[kReceiveFifoSize];
-    // The offset of the first item written to the list.
-    volatile uint16_t mHead;
-    // The offset of the next item to be written to the list.
-    volatile uint16_t mTail;
-} ReceiveFifo_t;
-
-static ReceiveFifo_t sReceiveFifo;
-
-static void processReceive(void);
-
-static void receiveDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    // We can only write if incrementing mTail doesn't equal mHead
-    if (sReceiveFifo.mHead != (sReceiveFifo.mTail + 1) % kReceiveFifoSize)
-    {
-        sReceiveFifo.mBuffer[sReceiveFifo.mTail] = aData[0];
-        sReceiveFifo.mTail                       = (sReceiveFifo.mTail + 1) % kReceiveFifoSize;
-    }
-
-    UARTDRV_Receive(aHandle, aData, 1, receiveDone);
-    otSysEventSignalPending();
-}
-
-static void transmitDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    sTransmitLength = 0;
-    otSysEventSignalPending();
-}
-
-static void processReceive(void)
-{
-    // Copy tail to prevent multiple reads
-    uint16_t tail = sReceiveFifo.mTail;
-
-    // If the data wraps around, process the first part
-    if (sReceiveFifo.mHead > tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, kReceiveFifoSize - sReceiveFifo.mHead);
-
-        // Reset the buffer mHead back to zero.
-        sReceiveFifo.mHead = 0;
-    }
-
-    // For any data remaining, process it
-    if (sReceiveFifo.mHead != tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, tail - sReceiveFifo.mHead);
-
-        // Set mHead to the local tail we have cached
-        sReceiveFifo.mHead = tail;
-    }
-}
-
-otError otPlatUartFlush(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-static void processTransmit(void)
-{
-    if (sTransmitBuffer != NULL && sTransmitLength == 0)
-    {
-        sTransmitBuffer = NULL;
-        otPlatUartSendDone();
-    }
-}
-
-otError otPlatUartEnable(void)
-{
-    UARTDRV_Init_t uartInit = USART_INIT;
-
-    sReceiveFifo.mHead = 0;
-    sReceiveFifo.mTail = 0;
-
-    UARTDRV_Init(sUartHandle, &uartInit);
-
-    for (uint8_t i = 0; i < sizeof(sReceiveBuffer); i++)
-    {
-        UARTDRV_Receive(sUartHandle, &sReceiveBuffer[i], sizeof(sReceiveBuffer[i]), receiveDone);
-    }
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatUartDisable(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(sTransmitBuffer == NULL, error = OT_ERROR_BUSY);
-
-    sTransmitBuffer = aBuf;
-    sTransmitLength = aBufLength;
-
-    UARTDRV_Transmit(sUartHandle, (uint8_t *)sTransmitBuffer, sTransmitLength, transmitDone);
-
-exit:
-    return error;
-}
-
-void efr32UartProcess(void)
-{
-    processReceive();
-    processTransmit();
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg12/Makefile.am
deleted file mode 100644 (file)
index 6243d9e..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-
-lib_LIBRARIES = libopenthread-efr32mg12.a
-
-# Do not enable -Wconversion for rail
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-# Do not enable -pedantic-errors for rail
-override CFLAGS   := $(filter-out -pedantic-errors,$(CFLAGS))
-override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
-
-# Do not enable -Wundef for rail
-override CFLAGS   := $(filter-out -Wundef,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-libopenthread_efr32mg12_a_CPPFLAGS                                            = \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -Wno-sign-compare                                                           \
-    -DCORTEXM3                                                                  \
-    -DPHY=EMBER_PHY_RAIL                                                        \
-    -DMICRO=EMBER_MICRO_CORTEXM3_EFR32                                          \
-    -DCORTEXM3_EFM32_MICRO                                                      \
-    -DPLAT=EMBER_PLATFORM_CORTEXM3                                              \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg12/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)                                                            \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG12_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG12P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/inc                                    \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/config                                 \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-PLATFORM_SOURCES                                                              = \
-    alarm.c                                                                     \
-    diag.c                                                                      \
-    entropy.c                                                                   \
-    fem-control.c                                                               \
-    flash.c                                                                     \
-    logging.c                                                                   \
-    misc.c                                                                      \
-    openthread-core-efr32-config.h                                              \
-    openthread-core-efr32-config-check.h                                        \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    radio.c                                                                     \
-    rail_config.h                                                               \
-    startup-gcc.c                                                               \
-    system.c                                                                    \
-    uart.c                                                                      \
-    $(NULL)
-
-noinst_HEADERS                                                                = \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    $(NULL)
-
-libopenthread_efr32mg12_a_SOURCES                                             = \
-    $(PLATFORM_SOURCES)                                                         \
-    $(NULL)
-
-Dash = -
-libopenthread_efr32mg12_a_LIBADD                                                                     = \
-    $(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")             \
-    $(shell find $(top_builddir)/third_party/jlink/SEGGER_RTT_V640/RTT $(Dash)type f $(Dash)name "*.o")
-
-DIST_SUBDIRS                                                                  = \
-    sleepy-demo                                                                 \
-    $(NULL)
-
-SUBDIRS                                                                       = \
-    sleepy-demo                                                                 \
-    $(NULL)
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/Makefile.platform.am b/third_party/openthread/repo/examples/platforms/efr32mg12/Makefile.platform.am
deleted file mode 100644 (file)
index fc31052..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# efr32mg12 platform-specific Makefile
-#
-
-LIBRAIL = $(shell                                                                \
-if [ "$(DMP)" = "1" ]; then                                                      \
-    echo "librail_multiprotocol_efr32xg12_gcc_release.a";                        \
-else                                                                             \
-    echo "librail_efr32xg12_gcc_release.a";                                      \
-fi )
-
-LDADD_COMMON                                                                  += \
-    $(top_builddir)/examples/platforms/efr32mg12/libopenthread-efr32mg12.a       \
-    $(top_builddir)/third_party/silabs/libsilabs-efr32mg12-sdk.a                 \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/autogen/librail_release/$(LIBRAIL) \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emdrv/nvm3/lib/libnvm3_CM4_gcc.a \
-    $(NULL)
-
-LDFLAGS_COMMON                                                                += \
-    -T $(top_srcdir)/examples/platforms/efr32mg12/efr32mg12.ld                   \
-    $(NULL)
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/README.md b/third_party/openthread/repo/examples/platforms/efr32mg12/README.md
deleted file mode 100644 (file)
index 1e978df..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-# OpenThread on EFR32MG12 Example
-
-This directory contains example platform drivers for the [Silicon Labs EFR32MG12][efr32mg12] based on [EFR32™ Mighty Gecko Wireless Starter Kit][slwstk6000b] or [Thunderboard™ Sense 2 Sensor-to-Cloud Advanced IoT Development Kit][sltb004a].
-
-[efr32mg]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc
-[slwstk6000b]: http://www.silabs.com/products/development-tools/wireless/mesh-networking/mighty-gecko-starter-kit
-[sltb004a]: https://www.silabs.com/products/development-tools/thunderboard/thunderboard-sense-two-kit
-
-The example platform drivers are intended to present the minimal code necessary to support OpenThread. [EFR32MG12P SoC][efr32mg12p] has rich memory and peripheral resources which can support all OpenThread capabilities. See the "Run the example with EFR32MG12 boards" section below for an example using basic OpenThread capabilities.
-
-See [sleepy-demo/README.md](sleepy-demo/README.md) for instructions for an example that uses the low-energy modes of the EFR32MG12 when running as a Sleepy End Device.
-
-[efr32mg12p]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc/device.EFR32MG12P432F1024GL125
-
-## Toolchain
-
-Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
-
-[gnu-toolchain]: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
-
-In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
-
-```bash
-$ cd <path-to-openthread>
-$ ./script/bootstrap
-```
-
-## Build Examples
-
-1. Download and install the [Simplicity Studio][simplicity_studio].
-
-[simplicity_studio]: http://www.silabs.com/products/development-tools/software/simplicity-studio
-
-2. Install Flex (Gecko) SDK including RAIL Library from Simplicity Studio.
-   - Connect EFR32MG12P Wireless Starter Kit to Simplicity Studio.
-   - Find Flex SDK v2.7 in the Software Update page and click Install.
-   - Flex SDK v2.7 will be installed in the path: `/SimplicityStudio_v4/developer/sdks/gecko_sdk_suite`.
-
-For more information on configuring, building, and installing applications for the Wireless Gecko (EFR32) portfolio using FLEX, see [Getting Started with the Silicon Labs Flex Software Development Kit for the Wireless Gecko (EFR32™) Portfolio][qsg138]. For more information on RAIL, see [Radio Abstraction Interface Layer][rail].
-
-[qsg138]: https://www.silabs.com/documents/public/quick-start-guides/qsg138-flex-efr32.pdf
-[rail]: http://www.silabs.com/products/development-tools/software/radio-abstraction-interface-layer-sdk
-
-3. Configure the path to Flex SDK source code.
-
-```bash
-$ cd <path-to-openthread>/third_party
-$ mkdir silabs
-$ cd <path-to-Simplicity-Studio>/developer/sdks
-$ cp -rf gecko_sdk_suite <path-to-openthread>/third_party/silabs/
-```
-
-Alternatively create a symbolic link to the Flex SDK source code.
-
-```bash
-$ cd <path-to-openthread>/third_party
-$ mkdir silabs
-$ ln -s <path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite silabs/gecko_sdk_suite
-```
-
-4. Build OpenThread Firmware (CLI example) on EFR32 platform.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-```
-
-For EFR32MG12™ Mighty Gecko Wireless Starter Kit:
-
-```bash
-$ make -f examples/Makefile-efr32mg12 BOARD=BRD4161A
-```
-
-or alternatively for the Thunderboard™ Sense 2:
-
-```bash
-$ make -f examples/Makefile-efr32mg12 BOARD=BRD4166A
-```
-
-After a successful build, the `elf` files are found in `<path-to-openthread>/output/efr32mg12/bin`.
-
-## Flash Binaries
-
-Compiled binaries may be flashed onto the EFR32 using [JLinkGDBServer][jlinkgdbserver]. EFR32 Starter kit mainboard integrates an on-board SEGGER J-Link debugger.
-
-[jlinkgdbserver]: https://www.segger.com/jlink-gdb-server.html
-
-```bash
-$ cd <path-to-JLinkGDBServer>
-$ sudo ./JLinkGDBServer -if swd -device EFR32MG12PxxxF1024
-$ cd <path-to-openthread>/output/efr32/bin
-$ arm-none-eabi-gdb ot-cli-ftd
-$ (gdb) target remote 127.0.0.1:2331
-$ (gdb) load
-$ (gdb) monitor reset
-$ (gdb) c
-```
-
-Note: Support for the "EFR32MG12PxxxF1024" device was added to JLinkGDBServer V6.14d.
-
-Or Compiled binaries also may be flashed onto the specified EFR32 dev board using [J-Link Commander][j-link-commander].
-
-[j-link-commander]: https://www.segger.com/products/debug-probes/j-link/tools/j-link-commander/
-
-```bash
-$ cd <path-to-openthread>/output/efr32mg12/bin
-$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex
-$ JLinkExe -device EFR32MG12PxxxF1024 -speed 4000 -if SWD -autoconnect 1 -SelectEmuBySN <SerialNo>
-$ J-Link>loadfile ot-cli-ftd.hex
-$ J-Link>r
-$ J-Link>q
-```
-
-Note: SerialNo is J-Link serial number. Use the following command to get the serial number of the connected J-Link.
-
-```bash
-$ JLinkExe
-```
-
-Alternatively Simplicity Commander provides a graphical interface for J-Link Commander.
-
-```bash
-$ cd <path-to-openthread>/output/efr32mg12/bin
-$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.ihex
-$ <path-to-simplicity-studio>/developer/adapter_packs/commander/commander
-```
-
-In the J-Link Device drop-down list select the serial number of the device to flash. Click the Adapter Connect button. Ensure the Debug Interface drop-down list is set to SWD and click the Target Connect button. Click on the Flash icon on the left side of the window to switch to the flash page. In the Flash MCU pane enter the path of the ot-cli-ftd.s37 file or choose the file with the Browse... button. Click the Flash button located under the Browse... button.
-
-## Run the example with EFR32MG12 boards
-
-1. Flash two EFR32 boards with the `CLI example` firmware (as shown above).
-2. Open terminal to first device `/dev/ttyACM0` (serial port settings: 115200 8-N-1). Type `help` for a list of commands.
-
-   ```bash
-   > help
-   help
-   channel
-   childtimeout
-   contextreusedelay
-   extaddr
-   extpanid
-   ipaddr
-   keysequence
-   leaderweight
-   masterkey
-   mode
-   netdataregister
-   networkidtimeout
-   networkname
-   panid
-   ping
-   prefix
-   releaserouterid
-   rloc16
-   route
-   routerupgradethreshold
-   scan
-   start
-   state
-   stop
-   whitelist
-   ```
-
-3. Start a Thread network as Leader.
-
-   ```bash
-   > dataset init new
-   Done
-   > dataset
-   Active Timestamp: 1
-   Channel: 13
-   Channel Mask: 0x07fff800
-   Ext PAN ID: d63e8e3e495ebbc3
-   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
-   Master Key: dfd34f0f05cad978ec4e32b0413038ff
-   Network Name: OpenThread-8f28
-   PAN ID: 0x8f28
-   PSKc: c23a76e98f1a6483639b1ac1271e2e27
-   Security Policy: 0, onrcb
-   Done
-   > dataset commit active
-   Done
-   > ifconfig up
-   Done
-   > thread start
-   Done
-
-   wait a couple of seconds...
-
-   > state
-   leader
-   Done
-   ```
-
-4. Open terminal to second device `/dev/ttyACM1` (serial port settings: 115200 8-N-1) and attach it to the Thread network as a Router.
-
-   ```bash
-   > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
-   Done
-   > dataset commit active
-   Done
-   > routerselectionjitter 1
-   Done
-   > ifconfig up
-   Done
-   > thread start
-   Done
-
-   wait a couple of seconds...
-
-   > state
-   router
-   Done
-   ```
-
-5. List all IPv6 addresses of Leader.
-
-   ```bash
-   > ipaddr
-   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
-   fd3d:b50b:f96d:722d:0:ff:fe00:c00
-   fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-   fe80:0:0:0:6c41:9001:f3d6:4148
-   Done
-   ```
-
-6. Send an ICMPv6 ping to Leader's Mesh-EID IPv6 address.
-
-   ```bash
-   > ping fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-   16 bytes from fd3d:b50b:f96d:722d:558:f56b:d688:799: icmp_seq=1 hlim=64 time=24ms
-   ```
-
-The above example demonstrates basic OpenThread capabilities. Enable more features/roles (e.g. commissioner, joiner, DHCPv6 Server/Client, etc.) by assigning compile-options before compiling.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-$ make -f examples/Makefile-efr32mg12 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1
-```
-
-For a list of all available commands, visit [OpenThread CLI Reference README.md][cli].
-
-[cli]: https://github.com/openthread/openthread/blob/master/src/cli/README.md
-
-## Verification
-
-The following toolchain has been used for testing and verification:
-
-- gcc version 7.3.1
-
-The EFR32 example has been verified with following Flex SDK/RAIL Library version:
-
-- Flex SDK version 2.7.0.0
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/alarm.c b/third_party/openthread/repo/examples/platforms/efr32mg12/alarm.c
deleted file mode 100644 (file)
index 71a39c0..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the alarm.
- *
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "openthread-system.h"
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include "common/logging.hpp"
-
-#include "platform-efr32.h"
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "rail.h"
-#include "sl_sleeptimer.h"
-
-#define XTAL_ACCURACY 200
-
-static sl_sleeptimer_timer_handle_t sl_handle;
-static uint32_t                     sAlarm     = 0;
-static bool                         sIsRunning = false;
-
-static void AlarmCallback(sl_sleeptimer_timer_handle_t *aHandle, void *aData)
-{
-    otSysEventSignalPending();
-}
-
-void efr32AlarmInit(void)
-{
-    memset(&sl_handle, 0, sizeof sl_handle);
-}
-
-uint32_t otPlatAlarmMilliGetNow(void)
-{
-    uint64_t    ticks;
-    uint64_t    now;
-    sl_status_t status;
-
-    ticks  = sl_sleeptimer_get_tick_count64();
-    status = sl_sleeptimer_tick64_to_ms(ticks, &now);
-    assert(status == SL_STATUS_OK);
-    return (uint32_t)now;
-}
-
-uint32_t otPlatTimeGetXtalAccuracy(void)
-{
-    return XTAL_ACCURACY;
-}
-
-void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    sl_status_t status;
-    int32_t     remaining;
-    uint32_t    ticks;
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-
-    sAlarm     = aT0 + aDt;
-    remaining  = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-    sIsRunning = true;
-
-    if (remaining <= 0)
-    {
-        otSysEventSignalPending();
-    }
-    else
-    {
-        status = sl_sleeptimer_ms32_to_tick(remaining, &ticks);
-        assert(status == SL_STATUS_OK);
-
-        status = sl_sleeptimer_start_timer(&sl_handle, ticks, AlarmCallback, NULL, 0,
-                                           SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG);
-        assert(status == SL_STATUS_OK);
-    }
-}
-
-void otPlatAlarmMilliStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-    sIsRunning = false;
-}
-
-void efr32AlarmProcess(otInstance *aInstance)
-{
-    int32_t remaining;
-
-    if (sIsRunning)
-    {
-        remaining = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-
-        if (remaining <= 0)
-        {
-            sIsRunning = false;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-            if (otPlatDiagModeGet())
-            {
-                otPlatDiagAlarmFired(aInstance);
-            }
-            else
-#endif
-            {
-                otPlatAlarmMilliFired(aInstance);
-            }
-        }
-    }
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4161a/board_config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4161a/board_config.h
deleted file mode 100644 (file)
index d798d52..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes dev borad compile-time configuration constants for efr32.
- *
- */
-
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-
-#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
-#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 0 /// Dev board doesn't support OQPSK modulation in 915MHz band.
-
-#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
-#endif
-
-#ifndef RADIO_CONFIG_DMP_SUPPORT
-#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
-#endif
-
-#define RADIO_CONFIG_PA_USES_DCDC 0 /// The PA(s) is(are) fed from VBAT
-
-#endif // __BOARD_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4161a/hal-config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4161a/hal-config.h
deleted file mode 100644 (file)
index 24a9a5e..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-#ifndef HAL_CONFIG_H
-#define HAL_CONFIG_H
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-// This file is auto-generated by Hardware Configurator in Simplicity Studio.
-// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
-// Content outside these regions will be preserved.
-
-// $[ACMP0]
-// [ACMP0]$
-
-// $[ACMP1]
-// [ACMP1]$
-
-// $[ADC0]
-// [ADC0]$
-
-// $[ANTDIV]
-// [ANTDIV]$
-
-// $[BATTERYMON]
-// [BATTERYMON]$
-
-// $[BTL_BUTTON]
-// [BTL_BUTTON]$
-
-// $[BULBPWM]
-// [BULBPWM]$
-
-// $[BULBPWM_COLOR]
-// [BULBPWM_COLOR]$
-
-// $[BUTTON]
-#define BSP_BUTTON_PRESENT (1)
-
-#define BSP_BUTTON0_PIN (6U)
-#define BSP_BUTTON0_PORT (gpioPortF)
-
-#define BSP_BUTTON1_PIN (7U)
-#define BSP_BUTTON1_PORT (gpioPortF)
-
-#define BSP_BUTTON_COUNT (2U)
-#define BSP_BUTTON_INIT                                                            \
-    {                                                                              \
-        {BSP_BUTTON0_PORT, BSP_BUTTON0_PIN}, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } \
-    }
-#define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
-#define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
-// [BUTTON]$
-
-// $[CMU]
-#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
-#define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_LFXO_PRESENT (1)
-#define BSP_CLK_HFXO_PRESENT (1)
-#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
-#define BSP_CLK_LFXO_CTUNE (0)
-#define BSP_CLK_LFXO_FREQ (32768U)
-#define HAL_CLK_LFACLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_HFXO_FREQ (38400000UL)
-#define BSP_CLK_HFXO_CTUNE (338)
-#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
-#define BSP_CLK_HFXO_CTUNE_TOKEN (0)
-#define HAL_CLK_HFXO_AUTOSTART (HAL_CLK_HFXO_AUTOSTART_NONE)
-// [CMU]$
-
-// $[COEX]
-// [COEX]$
-
-// $[CS5463]
-// [CS5463]$
-
-// $[CSEN0]
-// [CSEN0]$
-
-// $[DCDC]
-#define BSP_DCDC_PRESENT (1)
-
-#define HAL_DCDC_BYPASS (0)
-#define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
-// [DCDC]$
-
-// $[EMU]
-// [EMU]$
-
-// $[EXTFLASH]
-// [EXTFLASH]$
-
-// $[EZRADIOPRO]
-// [EZRADIOPRO]$
-
-// $[GPIO]
-#define PORTIO_GPIO_SWCLKTCK_PIN (0)
-#define PORTIO_GPIO_SWCLKTCK_PORT (gpioPortF)
-#define PORTIO_GPIO_DBGROUTE_LOC (0)
-
-#define PORTIO_GPIO_SWDIOTMS_PIN (1)
-#define PORTIO_GPIO_SWDIOTMS_PORT (gpioPortF)
-
-#define PORTIO_GPIO_SWV_PIN (2)
-#define PORTIO_GPIO_SWV_PORT (gpioPortF)
-#define PORTIO_GPIO_SWV_LOC (0)
-
-#define PORTIO_GPIO_TCLK_PIN (8)
-#define PORTIO_GPIO_TCLK_PORT (gpioPortF)
-#define PORTIO_GPIO_TCLK_LOC (0)
-
-#define PORTIO_GPIO_TD0_PIN (9)
-#define PORTIO_GPIO_TD0_PORT (gpioPortF)
-#define PORTIO_GPIO_TD0_LOC (0)
-
-#define PORTIO_GPIO_TD1_PIN (10)
-#define PORTIO_GPIO_TD1_PORT (gpioPortF)
-#define PORTIO_GPIO_TD1_LOC (0)
-
-#define PORTIO_GPIO_TD2_PIN (11)
-#define PORTIO_GPIO_TD2_PORT (gpioPortF)
-#define PORTIO_GPIO_TD2_LOC (0)
-
-#define PORTIO_GPIO_TD3_PIN (12)
-#define PORTIO_GPIO_TD3_PORT (gpioPortF)
-#define PORTIO_GPIO_TD3_LOC (0)
-
-// [GPIO]$
-
-// $[I2C0]
-#define PORTIO_I2C0_SCL_PIN (10)
-#define PORTIO_I2C0_SCL_PORT (gpioPortC)
-#define PORTIO_I2C0_SCL_LOC (14)
-
-#define PORTIO_I2C0_SDA_PIN (11)
-#define PORTIO_I2C0_SDA_PORT (gpioPortC)
-#define PORTIO_I2C0_SDA_LOC (16)
-
-// [I2C0]$
-
-// $[I2C1]
-// [I2C1]$
-
-// $[I2CSENSOR]
-// [I2CSENSOR]$
-
-// $[IDAC0]
-// [IDAC0]$
-
-// $[IOEXP]
-// [IOEXP]$
-
-// $[LED]
-#define BSP_LED_PRESENT (1)
-
-#define BSP_LED0_PIN (4)
-#define BSP_LED0_PORT (gpioPortF)
-
-#define BSP_LED1_PIN (5)
-#define BSP_LED1_PORT (gpioPortF)
-
-#define HAL_LED_ENABLE \
-    {                  \
-        0, 1           \
-    }
-#define HAL_LED_COUNT (2)
-#define BSP_LED_COUNT (2)
-#define BSP_LED_INIT                                                   \
-    {                                                                  \
-        {BSP_LED0_PORT, BSP_LED0_PIN}, { BSP_LED1_PORT, BSP_LED1_PIN } \
-    }
-// [LED]$
-
-// $[LESENSE]
-// [LESENSE]$
-
-// $[LETIMER0]
-// [LETIMER0]$
-
-// $[LEUART0]
-// [LEUART0]$
-
-// $[LFXO]
-// [LFXO]$
-
-// $[LNA]
-// [LNA]$
-
-// $[PA]
-#define HAL_PA_ENABLE (1)
-
-#define HAL_PA_RAMP (10)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252)
-#define HAL_PA_VOLTAGE (3300)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-// [PA]$
-
-// $[PCNT0]
-// [PCNT0]$
-
-// $[PCNT1]
-// [PCNT1]$
-
-// $[PCNT2]
-// [PCNT2]$
-
-// $[PORTIO]
-// [PORTIO]$
-
-// $[PRS]
-#define PORTIO_PRS_CH4_PIN (13)
-#define PORTIO_PRS_CH4_PORT (gpioPortD)
-#define PORTIO_PRS_CH4_LOC (4)
-
-// [PRS]$
-
-// $[PTI]
-#define PORTIO_PTI_DFRAME_PIN (13)
-#define PORTIO_PTI_DFRAME_PORT (gpioPortB)
-#define PORTIO_PTI_DFRAME_LOC (6)
-
-#define PORTIO_PTI_DOUT_PIN (12)
-#define PORTIO_PTI_DOUT_PORT (gpioPortB)
-#define PORTIO_PTI_DOUT_LOC (6)
-
-#define HAL_PTI_ENABLE (1)
-
-#define BSP_PTI_DFRAME_PIN (13)
-#define BSP_PTI_DFRAME_PORT (gpioPortB)
-#define BSP_PTI_DFRAME_LOC (6)
-
-#define BSP_PTI_DOUT_PIN (12)
-#define BSP_PTI_DOUT_PORT (gpioPortB)
-#define BSP_PTI_DOUT_LOC (6)
-
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000)
-// [PTI]$
-
-// $[PYD1698]
-// [PYD1698]$
-
-// $[SERIAL]
-#define HAL_SERIAL_USART0_ENABLE (0)
-#define HAL_SERIAL_LEUART0_ENABLE (0)
-#define HAL_SERIAL_USART1_ENABLE (0)
-#define HAL_SERIAL_USART2_ENABLE (0)
-#define HAL_SERIAL_USART3_ENABLE (0)
-#define HAL_SERIAL_RXWAKE_ENABLE (0)
-#define BSP_SERIAL_APP_CTS_PIN (2)
-#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_CTS_LOC (30)
-
-#define BSP_SERIAL_APP_RX_PIN (1)
-#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RX_LOC (0)
-
-#define BSP_SERIAL_APP_TX_PIN (0)
-#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_TX_LOC (0)
-
-#define BSP_SERIAL_APP_RTS_PIN (3)
-#define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RTS_LOC (30)
-
-#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_BAUD_RATE (115200)
-#define HAL_SERIAL_APP_RXSTOP (16)
-#define HAL_SERIAL_APP_RXSTART (16)
-#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [SERIAL]$
-
-// $[SPIDISPLAY]
-// [SPIDISPLAY]$
-
-// $[SPINCP]
-// [SPINCP]$
-
-// $[TIMER0]
-// [TIMER0]$
-
-// $[TIMER1]
-// [TIMER1]$
-
-// $[UARTNCP]
-// [UARTNCP]$
-
-// $[USART0]
-#define PORTIO_USART0_CTS_PIN (2)
-#define PORTIO_USART0_CTS_PORT (gpioPortA)
-#define PORTIO_USART0_CTS_LOC (30)
-
-#define PORTIO_USART0_RTS_PIN (3)
-#define PORTIO_USART0_RTS_PORT (gpioPortA)
-#define PORTIO_USART0_RTS_LOC (30)
-
-#define PORTIO_USART0_RX_PIN (1)
-#define PORTIO_USART0_RX_PORT (gpioPortA)
-#define PORTIO_USART0_RX_LOC (0)
-
-#define PORTIO_USART0_TX_PIN (0)
-#define PORTIO_USART0_TX_PORT (gpioPortA)
-#define PORTIO_USART0_TX_LOC (0)
-
-#define HAL_USART0_ENABLE (1)
-
-#define BSP_USART0_CTS_PIN (2)
-#define BSP_USART0_CTS_PORT (gpioPortA)
-#define BSP_USART0_CTS_LOC (30)
-
-#define BSP_USART0_RX_PIN (1)
-#define BSP_USART0_RX_PORT (gpioPortA)
-#define BSP_USART0_RX_LOC (0)
-
-#define BSP_USART0_TX_PIN (0)
-#define BSP_USART0_TX_PORT (gpioPortA)
-#define BSP_USART0_TX_LOC (0)
-
-#define BSP_USART0_RTS_PIN (3)
-#define BSP_USART0_RTS_PORT (gpioPortA)
-#define BSP_USART0_RTS_LOC (30)
-
-#define HAL_USART0_RX_QUEUE_SIZE (128)
-#define HAL_USART0_BAUD_RATE (115200)
-#define HAL_USART0_RXSTOP (16)
-#define HAL_USART0_RXSTART (16)
-#define HAL_USART0_TX_QUEUE_SIZE (128)
-#define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
-// [USART0]$
-
-// $[USART1]
-#define PORTIO_USART1_CLK_PIN (8)
-#define PORTIO_USART1_CLK_PORT (gpioPortC)
-#define PORTIO_USART1_CLK_LOC (11)
-
-#define PORTIO_USART1_CS_PIN (9)
-#define PORTIO_USART1_CS_PORT (gpioPortC)
-#define PORTIO_USART1_CS_LOC (11)
-
-#define PORTIO_USART1_RX_PIN (7)
-#define PORTIO_USART1_RX_PORT (gpioPortC)
-#define PORTIO_USART1_RX_LOC (11)
-
-#define PORTIO_USART1_TX_PIN (6)
-#define PORTIO_USART1_TX_PORT (gpioPortC)
-#define PORTIO_USART1_TX_LOC (11)
-
-// [USART1]$
-
-// $[USART2]
-#define PORTIO_USART2_CLK_PIN (8)
-#define PORTIO_USART2_CLK_PORT (gpioPortA)
-#define PORTIO_USART2_CLK_LOC (1)
-
-#define PORTIO_USART2_CS_PIN (9)
-#define PORTIO_USART2_CS_PORT (gpioPortA)
-#define PORTIO_USART2_CS_LOC (1)
-
-#define PORTIO_USART2_RX_PIN (7)
-#define PORTIO_USART2_RX_PORT (gpioPortA)
-#define PORTIO_USART2_RX_LOC (1)
-
-#define PORTIO_USART2_TX_PIN (6)
-#define PORTIO_USART2_TX_PORT (gpioPortA)
-#define PORTIO_USART2_TX_LOC (1)
-
-// [USART2]$
-
-// $[USART3]
-#define PORTIO_USART3_CTS_PIN (8)
-#define PORTIO_USART3_CTS_PORT (gpioPortD)
-#define PORTIO_USART3_CTS_LOC (28)
-
-#define PORTIO_USART3_RTS_PIN (9)
-#define PORTIO_USART3_RTS_PORT (gpioPortD)
-#define PORTIO_USART3_RTS_LOC (28)
-
-#define PORTIO_USART3_RX_PIN (7)
-#define PORTIO_USART3_RX_PORT (gpioPortB)
-#define PORTIO_USART3_RX_LOC (10)
-
-#define PORTIO_USART3_TX_PIN (6)
-#define PORTIO_USART3_TX_PORT (gpioPortB)
-#define PORTIO_USART3_TX_LOC (10)
-
-// [USART3]$
-
-// $[VCOM]
-// [VCOM]$
-
-// $[VDAC0]
-// [VDAC0]$
-
-// $[VUART]
-// [VUART]$
-
-// $[WDOG]
-// [WDOG]$
-
-// $[WTIMER0]
-// [WTIMER0]$
-
-// $[WTIMER1]
-// [WTIMER1]$
-
-#endif /* HAL_CONFIG_H */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4166a/board_config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4166a/board_config.h
deleted file mode 100644 (file)
index 1f9b939..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes dev borad compile-time configuration constants for efr32.
- *
- */
-
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-
-#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
-#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 0 /// Dev board doesn't support OQPSK modulation in 915MHz band.
-
-#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
-#endif
-
-#ifndef RADIO_CONFIG_DMP_SUPPORT
-#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
-#endif
-
-#define RADIO_CONFIG_PA_USES_DCDC 1 /// The PA(s) is(are) fed from the DCDC
-
-#endif // __BOARD_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4166a/hal-config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4166a/hal-config.h
deleted file mode 100644 (file)
index e65e777..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-#ifndef HAL_CONFIG_H
-#define HAL_CONFIG_H
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-// This file is auto-generated by Hardware Configurator in Simplicity Studio.
-// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
-// Content outside these regions will be preserved.
-
-// $[ACMP0]
-// [ACMP0]$
-
-// $[ACMP1]
-// [ACMP1]$
-
-// $[ADC0]
-// [ADC0]$
-
-// $[ANTDIV]
-// [ANTDIV]$
-
-// $[BATTERYMON]
-// [BATTERYMON]$
-
-// $[BTL_BUTTON]
-// [BTL_BUTTON]$
-
-// $[BULBPWM]
-// [BULBPWM]$
-
-// $[BULBPWM_COLOR]
-// [BULBPWM_COLOR]$
-
-// $[BUTTON]
-#define BSP_BUTTON_PRESENT (1)
-
-#define BSP_BUTTON0_PIN (14U)
-#define BSP_BUTTON0_PORT (gpioPortD)
-
-#define BSP_BUTTON1_PIN (15U)
-#define BSP_BUTTON1_PORT (gpioPortD)
-
-#define BSP_BUTTON_COUNT (2U)
-#define BSP_BUTTON_INIT                                                            \
-    {                                                                              \
-        {BSP_BUTTON0_PORT, BSP_BUTTON0_PIN}, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } \
-    }
-#define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
-#define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
-// [BUTTON]$
-
-// $[CMU]
-#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
-#define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_LFXO_PRESENT (1)
-#define BSP_CLK_HFXO_PRESENT (1)
-#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
-#define BSP_CLK_LFXO_CTUNE (32U)
-#define BSP_CLK_LFXO_FREQ (32768U)
-#define HAL_CLK_LFACLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_HFXO_FREQ (38400000UL)
-#define BSP_CLK_HFXO_CTUNE (332)
-#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
-#define BSP_CLK_HFXO_CTUNE_TOKEN (0)
-#define HAL_CLK_HFXO_AUTOSTART (HAL_CLK_HFXO_AUTOSTART_NONE)
-// [CMU]$
-
-// $[COEX]
-// [COEX]$
-
-// $[CS5463]
-// [CS5463]$
-
-// $[CSEN0]
-// [CSEN0]$
-
-// $[DCDC]
-#define BSP_DCDC_PRESENT (1)
-
-#define HAL_DCDC_BYPASS (0)
-#define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
-// [DCDC]$
-
-// $[EMU]
-// [EMU]$
-
-// $[EXTFLASH]
-// [EXTFLASH]$
-
-// $[EZRADIOPRO]
-// [EZRADIOPRO]$
-
-// $[GPIO]
-#define PORTIO_GPIO_SWCLKTCK_PIN (0)
-#define PORTIO_GPIO_SWCLKTCK_PORT (gpioPortF)
-#define PORTIO_GPIO_DBGROUTE_LOC (0)
-
-#define PORTIO_GPIO_SWDIOTMS_PIN (1)
-#define PORTIO_GPIO_SWDIOTMS_PORT (gpioPortF)
-
-#define PORTIO_GPIO_SWV_PIN (2)
-#define PORTIO_GPIO_SWV_PORT (gpioPortF)
-#define PORTIO_GPIO_SWV_LOC (0)
-
-#define PORTIO_GPIO_TCLK_PIN (8)
-#define PORTIO_GPIO_TCLK_PORT (gpioPortF)
-#define PORTIO_GPIO_TCLK_LOC (0)
-
-#define PORTIO_GPIO_TD0_PIN (9)
-#define PORTIO_GPIO_TD0_PORT (gpioPortF)
-#define PORTIO_GPIO_TD0_LOC (0)
-
-#define PORTIO_GPIO_TD1_PIN (10)
-#define PORTIO_GPIO_TD1_PORT (gpioPortF)
-#define PORTIO_GPIO_TD1_LOC (0)
-
-#define PORTIO_GPIO_TD2_PIN (11)
-#define PORTIO_GPIO_TD2_PORT (gpioPortF)
-#define PORTIO_GPIO_TD2_LOC (0)
-
-#define PORTIO_GPIO_TD3_PIN (12)
-#define PORTIO_GPIO_TD3_PORT (gpioPortF)
-#define PORTIO_GPIO_TD3_LOC (0)
-
-// [GPIO]$
-
-// $[I2C0]
-#define PORTIO_I2C0_SCL_PIN (10)
-#define PORTIO_I2C0_SCL_PORT (gpioPortC)
-#define PORTIO_I2C0_SCL_LOC (14)
-
-#define PORTIO_I2C0_SDA_PIN (11)
-#define PORTIO_I2C0_SDA_PORT (gpioPortC)
-#define PORTIO_I2C0_SDA_LOC (16)
-
-// [I2C0]$
-
-// $[I2C1]
-// [I2C1]$
-
-// $[I2CSENSOR]
-// [I2CSENSOR]$
-
-// $[IDAC0]
-// [IDAC0]$
-
-// $[IOEXP]
-// [IOEXP]$
-
-// $[LED]
-#define BSP_LED_PRESENT (1)
-
-#define BSP_LED0_PIN (8)
-#define BSP_LED0_PORT (gpioPortD)
-
-#define BSP_LED1_PIN (9)
-#define BSP_LED1_PORT (gpioPortD)
-
-#define HAL_LED_ENABLE \
-    {                  \
-        0, 1           \
-    }
-#define HAL_LED_COUNT (2)
-#define BSP_LED_COUNT (2)
-#define BSP_LED_INIT                                                   \
-    {                                                                  \
-        {BSP_LED0_PORT, BSP_LED0_PIN}, { BSP_LED1_PORT, BSP_LED1_PIN } \
-    }
-// [LED]$
-
-// $[LESENSE]
-// [LESENSE]$
-
-// $[LETIMER0]
-// [LETIMER0]$
-
-// $[LEUART0]
-// [LEUART0]$
-
-// $[LFXO]
-// [LFXO]$
-
-// $[LNA]
-// [LNA]$
-
-// $[PA]
-#define HAL_PA_ENABLE (1)
-
-#define HAL_PA_RAMP (10)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252)
-#define HAL_PA_VOLTAGE (3300)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-// [PA]$
-
-// $[PCNT0]
-// [PCNT0]$
-
-// $[PCNT1]
-// [PCNT1]$
-
-// $[PCNT2]
-// [PCNT2]$
-
-// $[PORTIO]
-// [PORTIO]$
-
-// $[PRS]
-#define PORTIO_PRS_CH4_PIN (13)
-#define PORTIO_PRS_CH4_PORT (gpioPortD)
-#define PORTIO_PRS_CH4_LOC (4)
-
-// [PRS]$
-
-// $[PTI]
-#define PORTIO_PTI_DFRAME_PIN (13)
-#define PORTIO_PTI_DFRAME_PORT (gpioPortB)
-#define PORTIO_PTI_DFRAME_LOC (6)
-
-#define PORTIO_PTI_DOUT_PIN (12)
-#define PORTIO_PTI_DOUT_PORT (gpioPortB)
-#define PORTIO_PTI_DOUT_LOC (6)
-
-#define HAL_PTI_ENABLE (1)
-
-#define BSP_PTI_DFRAME_PIN (13)
-#define BSP_PTI_DFRAME_PORT (gpioPortB)
-#define BSP_PTI_DFRAME_LOC (6)
-
-#define BSP_PTI_DOUT_PIN (12)
-#define BSP_PTI_DOUT_PORT (gpioPortB)
-#define BSP_PTI_DOUT_LOC (6)
-
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000)
-// [PTI]$
-
-// $[PYD1698]
-// [PYD1698]$
-
-// $[SERIAL]
-#define HAL_SERIAL_USART0_ENABLE (0)
-#define HAL_SERIAL_LEUART0_ENABLE (0)
-#define HAL_SERIAL_USART1_ENABLE (0)
-#define HAL_SERIAL_USART2_ENABLE (0)
-#define HAL_SERIAL_USART3_ENABLE (0)
-#define HAL_SERIAL_RXWAKE_ENABLE (0)
-#define BSP_SERIAL_APP_CTS_PIN (2)
-#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_CTS_LOC (30)
-
-#define BSP_SERIAL_APP_RX_PIN (1)
-#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RX_LOC (0)
-
-#define BSP_SERIAL_APP_TX_PIN (0)
-#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_TX_LOC (0)
-
-#define BSP_SERIAL_APP_RTS_PIN (3)
-#define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RTS_LOC (30)
-
-#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_BAUD_RATE (115200)
-#define HAL_SERIAL_APP_RXSTOP (16)
-#define HAL_SERIAL_APP_RXSTART (16)
-#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
-// [SERIAL]$
-
-// $[SPIDISPLAY]
-// [SPIDISPLAY]$
-
-// $[SPINCP]
-// [SPINCP]$
-
-// $[TIMER0]
-// [TIMER0]$
-
-// $[TIMER1]
-// [TIMER1]$
-
-// $[UARTNCP]
-// [UARTNCP]$
-
-// $[USART0]
-#define PORTIO_USART0_CTS_PIN (2)
-#define PORTIO_USART0_CTS_PORT (gpioPortA)
-#define PORTIO_USART0_CTS_LOC (30)
-
-#define PORTIO_USART0_RTS_PIN (3)
-#define PORTIO_USART0_RTS_PORT (gpioPortA)
-#define PORTIO_USART0_RTS_LOC (30)
-
-#define PORTIO_USART0_RX_PIN (1)
-#define PORTIO_USART0_RX_PORT (gpioPortA)
-#define PORTIO_USART0_RX_LOC (0)
-
-#define PORTIO_USART0_TX_PIN (0)
-#define PORTIO_USART0_TX_PORT (gpioPortA)
-#define PORTIO_USART0_TX_LOC (0)
-
-#define HAL_USART0_ENABLE (1)
-
-#define BSP_USART0_CTS_PIN (2)
-#define BSP_USART0_CTS_PORT (gpioPortA)
-#define BSP_USART0_CTS_LOC (30)
-
-#define BSP_USART0_RX_PIN (1)
-#define BSP_USART0_RX_PORT (gpioPortA)
-#define BSP_USART0_RX_LOC (0)
-
-#define BSP_USART0_TX_PIN (0)
-#define BSP_USART0_TX_PORT (gpioPortA)
-#define BSP_USART0_TX_LOC (0)
-
-#define BSP_USART0_RTS_PIN (3)
-#define BSP_USART0_RTS_PORT (gpioPortA)
-#define BSP_USART0_RTS_LOC (30)
-
-#define HAL_USART0_RX_QUEUE_SIZE (128)
-#define HAL_USART0_BAUD_RATE (115200)
-#define HAL_USART0_RXSTOP (16)
-#define HAL_USART0_RXSTART (16)
-#define HAL_USART0_TX_QUEUE_SIZE (128)
-#define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
-// [USART0]$
-
-// $[USART1]
-#define PORTIO_USART1_CLK_PIN (8)
-#define PORTIO_USART1_CLK_PORT (gpioPortC)
-#define PORTIO_USART1_CLK_LOC (11)
-
-#define PORTIO_USART1_CS_PIN (9)
-#define PORTIO_USART1_CS_PORT (gpioPortC)
-#define PORTIO_USART1_CS_LOC (11)
-
-#define PORTIO_USART1_RX_PIN (7)
-#define PORTIO_USART1_RX_PORT (gpioPortC)
-#define PORTIO_USART1_RX_LOC (11)
-
-#define PORTIO_USART1_TX_PIN (6)
-#define PORTIO_USART1_TX_PORT (gpioPortC)
-#define PORTIO_USART1_TX_LOC (11)
-
-// [USART1]$
-
-// $[USART2]
-#define PORTIO_USART2_CLK_PIN (8)
-#define PORTIO_USART2_CLK_PORT (gpioPortA)
-#define PORTIO_USART2_CLK_LOC (1)
-
-#define PORTIO_USART2_CS_PIN (9)
-#define PORTIO_USART2_CS_PORT (gpioPortA)
-#define PORTIO_USART2_CS_LOC (1)
-
-#define PORTIO_USART2_RX_PIN (7)
-#define PORTIO_USART2_RX_PORT (gpioPortA)
-#define PORTIO_USART2_RX_LOC (1)
-
-#define PORTIO_USART2_TX_PIN (6)
-#define PORTIO_USART2_TX_PORT (gpioPortA)
-#define PORTIO_USART2_TX_LOC (1)
-
-// [USART2]$
-
-// $[USART3]
-#define PORTIO_USART3_CTS_PIN (8)
-#define PORTIO_USART3_CTS_PORT (gpioPortD)
-#define PORTIO_USART3_CTS_LOC (28)
-
-#define PORTIO_USART3_RTS_PIN (9)
-#define PORTIO_USART3_RTS_PORT (gpioPortD)
-#define PORTIO_USART3_RTS_LOC (28)
-
-#define PORTIO_USART3_RX_PIN (7)
-#define PORTIO_USART3_RX_PORT (gpioPortB)
-#define PORTIO_USART3_RX_LOC (10)
-
-#define PORTIO_USART3_TX_PIN (6)
-#define PORTIO_USART3_TX_PORT (gpioPortB)
-#define PORTIO_USART3_TX_LOC (10)
-
-// [USART3]$
-
-// $[VCOM]
-// [VCOM]$
-
-// $[VDAC0]
-// [VDAC0]$
-
-// $[VUART]
-// [VUART]$
-
-// $[WDOG]
-// [WDOG]$
-
-// $[WTIMER0]
-// [WTIMER0]$
-
-// $[WTIMER1]
-// [WTIMER1]$
-
-#endif /* HAL_CONFIG_H */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4170a/board_config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4170a/board_config.h
deleted file mode 100644 (file)
index 2e946b9..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes dev borad compile-time configuration constants for efr32.
- *
- */
-
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-
-#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
-#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 915MHz band.
-
-#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
-#endif
-
-#ifndef RADIO_CONFIG_DMP_SUPPORT
-#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
-#endif
-
-#define RADIO_CONFIG_PA_USES_DCDC 0 /// The PA(s) is(are) fed from VBAT
-
-#endif // __BOARD_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4170a/hal-config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4170a/hal-config.h
deleted file mode 100644 (file)
index 30cc2d8..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-#ifndef HAL_CONFIG_H
-#define HAL_CONFIG_H
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-// This file is auto-generated by Hardware Configurator in Simplicity Studio.
-// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
-// Content outside these regions will be preserved.
-
-// $[ACMP0]
-// [ACMP0]$
-
-// $[ACMP1]
-// [ACMP1]$
-
-// $[ADC0]
-// [ADC0]$
-
-// $[ANTDIV]
-// [ANTDIV]$
-
-// $[BATTERYMON]
-// [BATTERYMON]$
-
-// $[BTL_BUTTON]
-// [BTL_BUTTON]$
-
-// $[BULBPWM]
-// [BULBPWM]$
-
-// $[BULBPWM_COLOR]
-// [BULBPWM_COLOR]$
-
-// $[BUTTON]
-#define BSP_BUTTON_PRESENT (1)
-
-#define BSP_BUTTON0_PIN (6U)
-#define BSP_BUTTON0_PORT (gpioPortF)
-
-#define BSP_BUTTON1_PIN (7U)
-#define BSP_BUTTON1_PORT (gpioPortF)
-
-#define BSP_BUTTON_COUNT (2U)
-#define BSP_BUTTON_INIT                                                            \
-    {                                                                              \
-        {BSP_BUTTON0_PORT, BSP_BUTTON0_PIN}, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } \
-    }
-#define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
-#define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
-#define HAL_BUTTON_ENABLE \
-    {                     \
-        0, 1              \
-    }
-#define HAL_BUTTON_COUNT (2U)
-// [BUTTON]$
-
-// $[CMU]
-#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
-#define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_LFXO_PRESENT (1)
-#define BSP_CLK_HFXO_PRESENT (1)
-#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
-#define BSP_CLK_LFXO_CTUNE (32U)
-#define BSP_CLK_LFXO_FREQ (32768U)
-#define HAL_CLK_LFACLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_HFXO_FREQ (38400000UL)
-#define BSP_CLK_HFXO_CTUNE (342)
-#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
-#define BSP_CLK_HFXO_CTUNE_TOKEN (0)
-#define HAL_CLK_HFXO_AUTOSTART (HAL_CLK_HFXO_AUTOSTART_NONE)
-// [CMU]$
-
-// $[COEX]
-// [COEX]$
-
-// $[CS5463]
-// [CS5463]$
-
-// $[CSEN]
-// [CSEN]$
-
-// $[DCDC]
-#define BSP_DCDC_PRESENT (1)
-
-#define HAL_DCDC_BYPASS (0)
-#define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
-// [DCDC]$
-
-// $[EMU]
-// [EMU]$
-
-// $[EXTFLASH]
-// [EXTFLASH]$
-
-// $[EZRADIOPRO]
-// [EZRADIOPRO]$
-
-// $[FEM]
-// [FEM]$
-
-// $[GPIO]
-// [GPIO]$
-
-// $[I2C0]
-// [I2C0]$
-
-// $[I2C1]
-// [I2C1]$
-
-// $[I2CSENSOR]
-// [I2CSENSOR]$
-
-// $[IDAC0]
-// [IDAC0]$
-
-// $[IOEXP]
-// [IOEXP]$
-
-// $[LED]
-#define BSP_LED_PRESENT (1)
-
-#define BSP_LED0_PIN (4U)
-#define BSP_LED0_PORT (gpioPortF)
-
-#define BSP_LED1_PIN (5U)
-#define BSP_LED1_PORT (gpioPortF)
-
-#define HAL_LED_ENABLE \
-    {                  \
-        0, 1           \
-    }
-#define HAL_LED_COUNT (2U)
-#define BSP_LED_COUNT (2U)
-#define BSP_LED_INIT                                                   \
-    {                                                                  \
-        {BSP_LED0_PORT, BSP_LED0_PIN}, { BSP_LED1_PORT, BSP_LED1_PIN } \
-    }
-// [LED]$
-
-// $[LESENSE]
-// [LESENSE]$
-
-// $[LETIMER0]
-// [LETIMER0]$
-
-// $[LEUART0]
-// [LEUART0]$
-
-// $[LFXO]
-// [LFXO]$
-
-// $[PA]
-#define HAL_PA_ENABLE (1)
-
-#define HAL_PA_RAMP (10UL)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252U)
-#define HAL_PA_VOLTAGE (3300U)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-// [PA]$
-
-// $[PCNT0]
-// [PCNT0]$
-
-// $[PCNT1]
-// [PCNT1]$
-
-// $[PCNT2]
-// [PCNT2]$
-
-// $[PORTIO]
-// [PORTIO]$
-
-// $[PRS]
-// [PRS]$
-
-// $[PTI]
-#define PORTIO_PTI_DCLK_PIN (11U)
-#define PORTIO_PTI_DCLK_PORT (gpioPortB)
-#define PORTIO_PTI_DCLK_LOC (6U)
-
-#define PORTIO_PTI_DFRAME_PIN (13U)
-#define PORTIO_PTI_DFRAME_PORT (gpioPortB)
-#define PORTIO_PTI_DFRAME_LOC (6U)
-
-#define PORTIO_PTI_DOUT_PIN (12U)
-#define PORTIO_PTI_DOUT_PORT (gpioPortB)
-#define PORTIO_PTI_DOUT_LOC (6U)
-
-#define HAL_PTI_ENABLE (1)
-
-#define BSP_PTI_DFRAME_PIN (13U)
-#define BSP_PTI_DFRAME_PORT (gpioPortB)
-#define BSP_PTI_DFRAME_LOC (6U)
-
-#define BSP_PTI_DOUT_PIN (12U)
-#define BSP_PTI_DOUT_PORT (gpioPortB)
-#define BSP_PTI_DOUT_LOC (6U)
-
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000UL)
-// [PTI]$
-
-// $[PYD1698]
-// [PYD1698]$
-
-// $[SERIAL]
-#define HAL_SERIAL_USART0_ENABLE (0)
-#define HAL_SERIAL_LEUART0_ENABLE (0)
-#define HAL_SERIAL_USART1_ENABLE (0)
-#define HAL_SERIAL_USART2_ENABLE (0)
-#define HAL_SERIAL_USART3_ENABLE (0)
-#define HAL_SERIAL_RXWAKE_ENABLE (0)
-#define HAL_SERIAL_IDLE_WAKE_ENABLE (1)
-#define BSP_SERIAL_APP_CTS_PIN (2U)
-#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_CTS_LOC (30U)
-
-#define BSP_SERIAL_APP_RX_PIN (1U)
-#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RX_LOC (0U)
-
-#define BSP_SERIAL_APP_TX_PIN (0U)
-#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_TX_LOC (0U)
-
-#define BSP_SERIAL_APP_RTS_PIN (3U)
-#define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RTS_LOC (30U)
-
-#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128UL)
-#define HAL_SERIAL_APP_BAUD_RATE (115200UL)
-#define HAL_SERIAL_APP_RXSTOP (16UL)
-#define HAL_SERIAL_APP_RXSTART (16UL)
-#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128UL)
-#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [SERIAL]$
-
-// $[SPIDISPLAY]
-// [SPIDISPLAY]$
-
-// $[SPINCP]
-// [SPINCP]$
-
-// $[TIMER0]
-// [TIMER0]$
-
-// $[TIMER1]
-// [TIMER1]$
-
-// $[UARTNCP]
-// [UARTNCP]$
-
-// $[USART0]
-#define PORTIO_USART0_CTS_PIN (2U)
-#define PORTIO_USART0_CTS_PORT (gpioPortA)
-#define PORTIO_USART0_CTS_LOC (30U)
-
-#define PORTIO_USART0_RTS_PIN (3U)
-#define PORTIO_USART0_RTS_PORT (gpioPortA)
-#define PORTIO_USART0_RTS_LOC (30U)
-
-#define PORTIO_USART0_RX_PIN (1U)
-#define PORTIO_USART0_RX_PORT (gpioPortA)
-#define PORTIO_USART0_RX_LOC (0U)
-
-#define PORTIO_USART0_TX_PIN (0U)
-#define PORTIO_USART0_TX_PORT (gpioPortA)
-#define PORTIO_USART0_TX_LOC (0U)
-
-#define HAL_USART0_ENABLE (1)
-
-#define BSP_USART0_CTS_PIN (2U)
-#define BSP_USART0_CTS_PORT (gpioPortA)
-#define BSP_USART0_CTS_LOC (30U)
-
-#define BSP_USART0_RX_PIN (1U)
-#define BSP_USART0_RX_PORT (gpioPortA)
-#define BSP_USART0_RX_LOC (0U)
-
-#define BSP_USART0_TX_PIN (0U)
-#define BSP_USART0_TX_PORT (gpioPortA)
-#define BSP_USART0_TX_LOC (0U)
-
-#define BSP_USART0_RTS_PIN (3U)
-#define BSP_USART0_RTS_PORT (gpioPortA)
-#define BSP_USART0_RTS_LOC (30U)
-
-#define HAL_USART0_RX_QUEUE_SIZE (128UL)
-#define HAL_USART0_BAUD_RATE (115200UL)
-#define HAL_USART0_RXSTOP (16UL)
-#define HAL_USART0_RXSTART (16UL)
-#define HAL_USART0_TX_QUEUE_SIZE (128UL)
-#define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
-// [USART0]$
-
-// $[USART1]
-// [USART1]$
-
-// $[USART2]
-// [USART2]$
-
-// $[USART3]
-// [USART3]$
-
-// $[VCOM]
-#define HAL_VCOM_ENABLE (1)
-
-#define BSP_VCOM_ENABLE_PIN (5U)
-#define BSP_VCOM_ENABLE_PORT (gpioPortA)
-
-// [VCOM]$
-
-// $[VDAC0]
-// [VDAC0]$
-
-// $[VUART]
-// [VUART]$
-
-// $[WDOG]
-// [WDOG]$
-
-// $[WTIMER0]
-// [WTIMER0]$
-
-// $[WTIMER1]
-// [WTIMER1]$
-
-#endif /* HAL_CONFIG_H */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4304a/board_config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4304a/board_config.h
deleted file mode 100644 (file)
index d798d52..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes dev borad compile-time configuration constants for efr32.
- *
- */
-
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-
-#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
-#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 0 /// Dev board doesn't support OQPSK modulation in 915MHz band.
-
-#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
-#endif
-
-#ifndef RADIO_CONFIG_DMP_SUPPORT
-#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
-#endif
-
-#define RADIO_CONFIG_PA_USES_DCDC 0 /// The PA(s) is(are) fed from VBAT
-
-#endif // __BOARD_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/brd4304a/hal-config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/brd4304a/hal-config.h
deleted file mode 100644 (file)
index a615567..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-#ifndef HAL_CONFIG_H
-#define HAL_CONFIG_H
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-// This file is auto-generated by Hardware Configurator in Simplicity Studio.
-// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
-// Content outside these regions will be preserved.
-
-// $[ACMP0]
-// [ACMP0]$
-
-// $[ACMP1]
-// [ACMP1]$
-
-// $[ADC0]
-// [ADC0]$
-
-// $[ANTDIV]
-// [ANTDIV]$
-
-// $[BATTERYMON]
-// [BATTERYMON]$
-
-// $[BTL_BUTTON]
-// [BTL_BUTTON]$
-
-// $[BULBPWM]
-// [BULBPWM]$
-
-// $[BULBPWM_COLOR]
-// [BULBPWM_COLOR]$
-
-// $[BUTTON]
-#define BSP_BUTTON_PRESENT (1)
-
-#define BSP_BUTTON0_PIN (6U)
-#define BSP_BUTTON0_PORT (gpioPortF)
-
-#define BSP_BUTTON1_PIN (7U)
-#define BSP_BUTTON1_PORT (gpioPortF)
-
-#define BSP_BUTTON_COUNT (2U)
-#define BSP_BUTTON_INIT                                                            \
-    {                                                                              \
-        {BSP_BUTTON0_PORT, BSP_BUTTON0_PIN}, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } \
-    }
-#define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
-#define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
-// [BUTTON]$
-
-// $[CMU]
-#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
-#define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_LFXO_PRESENT (1)
-#define BSP_CLK_HFXO_PRESENT (1)
-#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
-#define BSP_CLK_LFXO_CTUNE (0U)
-#define BSP_CLK_LFXO_FREQ (32768U)
-#define HAL_CLK_LFACLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_HFXO_FREQ (38400000UL)
-#define BSP_CLK_HFXO_CTUNE (285)
-#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
-#define BSP_CLK_HFXO_CTUNE_TOKEN (1)
-#define HAL_CLK_HFXO_AUTOSTART (HAL_CLK_HFXO_AUTOSTART_NONE)
-// [CMU]$
-
-// $[COEX]
-// [COEX]$
-
-// $[CS5463]
-// [CS5463]$
-
-// $[CSEN]
-// [CSEN]$
-
-// $[DCDC]
-#define BSP_DCDC_PRESENT (1)
-
-#define HAL_DCDC_BYPASS (0)
-#define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
-// [DCDC]$
-
-// $[EMU]
-// [EMU]$
-
-// $[EXTFLASH]
-// [EXTFLASH]$
-
-// $[EZRADIOPRO]
-// [EZRADIOPRO]$
-
-// $[FEM]
-#define HAL_FEM_ENABLE (1)
-
-#define BSP_FEM_RX_PIN (10U)
-#define BSP_FEM_RX_PORT (gpioPortD)
-#define BSP_FEM_RX_LOC (0U)
-
-#define BSP_FEM_SLEEP_PIN (11U)
-#define BSP_FEM_SLEEP_PORT (gpioPortD)
-#define BSP_FEM_SLEEP_LOC (13U)
-
-#define HAL_FEM_RX_ACTIVE (1)
-#define BSP_FEM_RX_CHANNEL (5)
-#define HAL_FEM_TX_ACTIVE (0)
-#define HAL_FEM_BYPASS_ENABLE (0)
-#define BSP_FEM_SLEEP_CHANNEL (6)
-#define HAL_FEM_TX_HIGH_POWER (0)
-// [FEM]$
-
-// $[GPIO]
-#define PORTIO_GPIO_SWV_PIN (2U)
-#define PORTIO_GPIO_SWV_PORT (gpioPortF)
-#define PORTIO_GPIO_SWV_LOC (0U)
-
-// [GPIO]$
-
-// $[I2C0]
-#define PORTIO_I2C0_SCL_PIN (11U)
-#define PORTIO_I2C0_SCL_PORT (gpioPortC)
-#define PORTIO_I2C0_SCL_LOC (15U)
-
-#define PORTIO_I2C0_SDA_PIN (10U)
-#define PORTIO_I2C0_SDA_PORT (gpioPortC)
-#define PORTIO_I2C0_SDA_LOC (15U)
-
-// [I2C0]$
-
-// $[I2C1]
-// [I2C1]$
-
-// $[I2CSENSOR]
-// [I2CSENSOR]$
-
-// $[IDAC0]
-// [IDAC0]$
-
-// $[IOEXP]
-// [IOEXP]$
-
-// $[LED]
-#define BSP_LED_PRESENT (1)
-
-#define BSP_LED0_PIN (6U)
-#define BSP_LED0_PORT (gpioPortF)
-
-#define BSP_LED1_PIN (7U)
-#define BSP_LED1_PORT (gpioPortF)
-
-#define HAL_LED_ENABLE \
-    {                  \
-        0, 1           \
-    }
-#define HAL_LED_COUNT (2U)
-#define BSP_LED_COUNT (2U)
-#define BSP_LED_INIT                                                   \
-    {                                                                  \
-        {BSP_LED0_PORT, BSP_LED0_PIN}, { BSP_LED1_PORT, BSP_LED1_PIN } \
-    }
-// [LED]$
-
-// $[LESENSE]
-// [LESENSE]$
-
-// $[LETIMER0]
-// [LETIMER0]$
-
-// $[LEUART0]
-// [LEUART0]$
-
-// $[LFXO]
-// [LFXO]$
-
-// $[PA]
-#define HAL_PA_ENABLE (1)
-
-#define HAL_PA_RAMP (10UL)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252U)
-#define HAL_PA_VOLTAGE (3300U)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-// [PA]$
-
-// $[PCNT0]
-// [PCNT0]$
-
-// $[PCNT1]
-// [PCNT1]$
-
-// $[PCNT2]
-// [PCNT2]$
-
-// $[PORTIO]
-// [PORTIO]$
-
-// $[PRS]
-#define PORTIO_PRS_CH4_PIN (13U)
-#define PORTIO_PRS_CH4_PORT (gpioPortD)
-#define PORTIO_PRS_CH4_LOC (4U)
-
-#define PORTIO_PRS_CH5_PIN (10U)
-#define PORTIO_PRS_CH5_PORT (gpioPortD)
-#define PORTIO_PRS_CH5_LOC (0U)
-
-#define PORTIO_PRS_CH6_PIN (11U)
-#define PORTIO_PRS_CH6_PORT (gpioPortD)
-#define PORTIO_PRS_CH6_LOC (13U)
-
-// [PRS]$
-
-// $[PTI]
-#define PORTIO_PTI_DFRAME_PIN (13U)
-#define PORTIO_PTI_DFRAME_PORT (gpioPortB)
-#define PORTIO_PTI_DFRAME_LOC (6U)
-
-#define PORTIO_PTI_DOUT_PIN (11U)
-#define PORTIO_PTI_DOUT_PORT (gpioPortB)
-#define PORTIO_PTI_DOUT_LOC (5U)
-
-#define HAL_PTI_ENABLE (1)
-
-#define BSP_PTI_DFRAME_PIN (13U)
-#define BSP_PTI_DFRAME_PORT (gpioPortB)
-#define BSP_PTI_DFRAME_LOC (6U)
-
-#define BSP_PTI_DOUT_PIN (11U)
-#define BSP_PTI_DOUT_PORT (gpioPortB)
-#define BSP_PTI_DOUT_LOC (5U)
-
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000UL)
-// [PTI]$
-
-// $[PYD1698]
-// [PYD1698]$
-
-// $[SERIAL]
-#define HAL_SERIAL_USART0_ENABLE (0)
-#define HAL_SERIAL_LEUART0_ENABLE (0)
-#define HAL_SERIAL_USART1_ENABLE (0)
-#define HAL_SERIAL_USART2_ENABLE (0)
-#define HAL_SERIAL_USART3_ENABLE (0)
-#define HAL_SERIAL_RXWAKE_ENABLE (0)
-#define BSP_SERIAL_APP_CTS_PIN (2U)
-#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_CTS_LOC (30U)
-
-#define BSP_SERIAL_APP_RX_PIN (1U)
-#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RX_LOC (0U)
-
-#define BSP_SERIAL_APP_TX_PIN (0U)
-#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_TX_LOC (0U)
-
-#define BSP_SERIAL_APP_RTS_PIN (3U)
-#define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RTS_LOC (30U)
-
-#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128UL)
-#define HAL_SERIAL_APP_BAUD_RATE (115200UL)
-#define HAL_SERIAL_APP_RXSTOP (16UL)
-#define HAL_SERIAL_APP_RXSTART (16UL)
-#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128UL)
-#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [SERIAL]$
-
-// $[SPIDISPLAY]
-// [SPIDISPLAY]$
-
-// $[SPINCP]
-// [SPINCP]$
-
-// $[TIMER0]
-// [TIMER0]$
-
-// $[TIMER1]
-// [TIMER1]$
-
-// $[UARTNCP]
-// [UARTNCP]$
-
-// $[USART0]
-#define PORTIO_USART0_CTS_PIN (2U)
-#define PORTIO_USART0_CTS_PORT (gpioPortA)
-#define PORTIO_USART0_CTS_LOC (30U)
-
-#define PORTIO_USART0_RTS_PIN (3U)
-#define PORTIO_USART0_RTS_PORT (gpioPortA)
-#define PORTIO_USART0_RTS_LOC (30U)
-
-#define PORTIO_USART0_RX_PIN (1U)
-#define PORTIO_USART0_RX_PORT (gpioPortA)
-#define PORTIO_USART0_RX_LOC (0U)
-
-#define PORTIO_USART0_TX_PIN (0U)
-#define PORTIO_USART0_TX_PORT (gpioPortA)
-#define PORTIO_USART0_TX_LOC (0U)
-
-#define HAL_USART0_ENABLE (1)
-
-#define BSP_USART0_CTS_PIN (2U)
-#define BSP_USART0_CTS_PORT (gpioPortA)
-#define BSP_USART0_CTS_LOC (30U)
-
-#define BSP_USART0_RX_PIN (1U)
-#define BSP_USART0_RX_PORT (gpioPortA)
-#define BSP_USART0_RX_LOC (0U)
-
-#define BSP_USART0_TX_PIN (0U)
-#define BSP_USART0_TX_PORT (gpioPortA)
-#define BSP_USART0_TX_LOC (0U)
-
-#define BSP_USART0_RTS_PIN (3U)
-#define BSP_USART0_RTS_PORT (gpioPortA)
-#define BSP_USART0_RTS_LOC (30U)
-
-#define HAL_USART0_RX_QUEUE_SIZE (128UL)
-#define HAL_USART0_BAUD_RATE (115200UL)
-#define HAL_USART0_RXSTOP (16UL)
-#define HAL_USART0_RXSTART (16UL)
-#define HAL_USART0_TX_QUEUE_SIZE (128UL)
-#define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [USART0]$
-
-// $[USART1]
-#define PORTIO_USART1_CLK_PIN (8U)
-#define PORTIO_USART1_CLK_PORT (gpioPortC)
-#define PORTIO_USART1_CLK_LOC (11U)
-
-#define PORTIO_USART1_CS_PIN (9U)
-#define PORTIO_USART1_CS_PORT (gpioPortC)
-#define PORTIO_USART1_CS_LOC (11U)
-
-#define PORTIO_USART1_RX_PIN (7U)
-#define PORTIO_USART1_RX_PORT (gpioPortC)
-#define PORTIO_USART1_RX_LOC (11U)
-
-#define PORTIO_USART1_TX_PIN (6U)
-#define PORTIO_USART1_TX_PORT (gpioPortC)
-#define PORTIO_USART1_TX_LOC (11U)
-
-// [USART1]$
-
-// $[USART2]
-// [USART2]$
-
-// $[USART3]
-// [USART3]$
-
-// $[VCOM]
-// [VCOM]$
-
-// $[VDAC0]
-// [VDAC0]$
-
-// $[VUART]
-// [VUART]$
-
-// $[WDOG]
-// [WDOG]$
-
-// $[WTIMER0]
-// [WTIMER0]$
-
-// $[WTIMER1]
-// [WTIMER1]$
-
-#endif /* HAL_CONFIG_H */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/crypto/efr32-mbedtls-config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/crypto/efr32-mbedtls-config.h
deleted file mode 100644 (file)
index 14f1d1c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EFR32_MBEDTLS_CONFIG_H
-#define EFR32_MBEDTLS_CONFIG_H
-
-#include "em_device.h"
-
-/**
- * \def MBEDTLS_AES_ALT
- *
- * Enable hardware acceleration for the AES block cipher
- *
- * Module:  sl_crypto/src/crypto_aes.c for devices with CRYPTO
- *          sl_crypto/src/aes_aes.c for devices with AES
- *
- * See MBEDTLS_AES_C for more information.
- */
-#define MBEDTLS_AES_ALT
-
-/**
- * \def MBEDTLS_ECP_INTERNAL_ALT
- * \def ECP_SHORTWEIERSTRASS
- * \def MBEDTLS_ECP_ADD_MIXED_ALT
- * \def MBEDTLS_ECP_DOUBLE_JAC_ALT
- * \def MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
- * \def MBEDTLS_ECP_NORMALIZE_JAC_ALT
- *
- * Enable hardware acceleration for the elliptic curve over GF(p) library.
- *
- * Module:  sl_crypto/src/crypto_ecp.c
- * Caller:  library/ecp.c
- *
- * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_ECP_C and at least one
- * MBEDTLS_ECP_DP_XXX_ENABLED and (CRYPTO_COUNT > 0)
- */
-#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
-#define MBEDTLS_ECP_INTERNAL_ALT
-#define ECP_SHORTWEIERSTRASS
-#define MBEDTLS_ECP_ADD_MIXED_ALT
-#define MBEDTLS_ECP_DOUBLE_JAC_ALT
-#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
-#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
-#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
-#endif
-
-/**
- * \def MBEDTLS_SHA256_ALT
- *
- * Enable hardware acceleration for the SHA-224 and SHA-256 cryptographic
- * hash algorithms.
- *
- * Module:  sl_crypto/src/crypto_sha.c
- * Caller:  library/entropy.c
- *          library/mbedtls_md.c
- *          library/ssl_cli.c
- *          library/ssl_srv.c
- *          library/ssl_tls.c
- *
- * Requires: MBEDTLS_SHA256_C and (CRYPTO_COUNT > 0)
- * See MBEDTLS_SHA256_C for more information.
- */
-#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
-#define MBEDTLS_SHA256_ALT
-#endif
-
-#endif // EFR32_MBEDTLS_CONFIG_H
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/diag.c b/third_party/openthread/repo/examples/platforms/efr32mg12/diag.c
deleted file mode 100644 (file)
index a7c3357..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the diagnostics.
- *
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/radio.h>
-
-#include "platform-efr32.h"
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-/**
- * Diagnostics mode variables.
- *
- */
-static bool sDiagMode = false;
-
-void otPlatDiagModeSet(bool aMode)
-{
-    sDiagMode = aMode;
-}
-
-bool otPlatDiagModeGet()
-{
-    return sDiagMode;
-}
-
-void otPlatDiagChannelSet(uint8_t aChannel)
-{
-    OT_UNUSED_VARIABLE(aChannel);
-}
-
-void otPlatDiagTxPowerSet(int8_t aTxPower)
-{
-    OT_UNUSED_VARIABLE(aTxPower);
-}
-
-void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aFrame);
-    OT_UNUSED_VARIABLE(aError);
-}
-
-void otPlatDiagAlarmCallback(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-#endif // #if OPENTHREAD_CONFIG_DIAG_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/efr32mg12.ld b/third_party/openthread/repo/examples/platforms/efr32mg12/efr32mg12.ld
deleted file mode 100644 (file)
index 7ba26f6..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
- /**
- * @file
- *   This file implements the OpenThread linker script for the
- *   Silicon Labs efr32mg12 platform.
- *
- */
-
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
-  RAM (rwx)  : ORIGIN = 0x20000000, LENGTH = 256K
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- *
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __copy_table_start__
- *   __copy_table_end__
- *   __zero_table_start__
- *   __zero_table_end__
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapBase
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- *   __Vectors_End
- *   __Vectors_Size
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-  .text :
-  {
-    KEEP(*(.vectors))
-    __Vectors_End = .;
-    __Vectors_Size = __Vectors_End - __Vectors;
-    __end__ = .;
-
-    *(.text*)
-
-    KEEP(*(.init))
-    KEEP(*(.fini))
-
-    /* .ctors */
-    *crtbegin.o(.ctors)
-    *crtbegin?.o(.ctors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-    *(SORT(.ctors.*))
-    *(.ctors)
-
-    /* .dtors */
-    *crtbegin.o(.dtors)
-    *crtbegin?.o(.dtors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-    *(SORT(.dtors.*))
-    *(.dtors)
-
-    *(.rodata*)
-
-    KEEP(*(.eh_frame*))
-  } > FLASH
-
-  .ARM.extab :
-  {
-    *(.ARM.extab* .gnu.linkonce.armextab.*)
-  } > FLASH
-
-  __exidx_start = .;
-  .ARM.exidx :
-  {
-    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-  } > FLASH
-  __exidx_end = .;
-
-  /* To copy multiple ROM to RAM sections,
-   * uncomment .copy.table section and,
-   * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .copy.table :
-  {
-    . = ALIGN(4);
-    __copy_table_start__ = .;
-    LONG (__etext)
-    LONG (__data_start__)
-    LONG (__data_end__ - __data_start__)
-    LONG (__etext2)
-    LONG (__data2_start__)
-    LONG (__data2_end__ - __data2_start__)
-    __copy_table_end__ = .;
-  } > FLASH
-  */
-
-  /* To clear multiple BSS sections,
-   * uncomment .zero.table section and,
-   * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .zero.table :
-  {
-    . = ALIGN(4);
-    __zero_table_start__ = .;
-    LONG (__bss_start__)
-    LONG (__bss_end__ - __bss_start__)
-    LONG (__bss2_start__)
-    LONG (__bss2_end__ - __bss2_start__)
-    __zero_table_end__ = .;
-  } > FLASH
-  */
-
-  __etext = .;
-
-  .data : AT (__etext)
-  {
-    __data_start__ = .;
-    *(vtable)
-    *(.data*)
-    . = ALIGN (4);
-    PROVIDE (__ram_func_section_start = .);
-    *(.ram)
-    PROVIDE (__ram_func_section_end = .);
-
-    . = ALIGN(4);
-    /* preinit data */
-    PROVIDE_HIDDEN (__preinit_array_start = .);
-    KEEP(*(.preinit_array))
-    PROVIDE_HIDDEN (__preinit_array_end = .);
-
-    . = ALIGN(4);
-    /* init data */
-    PROVIDE_HIDDEN (__init_array_start = .);
-    KEEP(*(SORT(.init_array.*)))
-    KEEP(*(.init_array))
-    PROVIDE_HIDDEN (__init_array_end = .);
-
-    . = ALIGN(4);
-    /* finit data */
-    PROVIDE_HIDDEN (__fini_array_start = .);
-    KEEP(*(SORT(.fini_array.*)))
-    KEEP(*(.fini_array))
-    PROVIDE_HIDDEN (__fini_array_end = .);
-
-    KEEP(*(.jcr*))
-    . = ALIGN(4);
-    /* All data end */
-    __data_end__ = .;
-
-  } > RAM
-
-  .bss :
-  {
-    . = ALIGN(4);
-    __bss_start__ = .;
-    *(.bss*)
-    *(COMMON)
-    . = ALIGN(4);
-    __bss_end__ = .;
-  } > RAM
-
-  .heap (COPY):
-  {
-    __HeapBase = .;
-    __end__ = .;
-    end = __end__;
-    _end = __end__;
-    KEEP(*(.heap*))
-    __HeapLimit = .;
-  } > RAM
-
-  /* .stack_dummy section doesn't contains any symbols. It is only
-   * used for linker to calculate size of stack sections, and assign
-   * values to stack symbols later */
-  .stack_dummy (COPY):
-  {
-    KEEP(*(.stack*))
-  } > RAM
-
-  /* Set stack top to end of RAM, and stack limit move down by
-   * size of stack_dummy section */
-  __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-  __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-  PROVIDE(__stack = __StackTop);
-
-  /*******************************************************************/
-  /* Define flash block for nvm3                                     */
-  .nvm (DSECT) : {
-    KEEP(*(.simee*))
-  } > FLASH
-
-  linker_nvm_end = ORIGIN(FLASH) + LENGTH(FLASH);
-  linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm);
-  linker_nvm_size = SIZEOF(.nvm);
-  __nvm3Base = linker_nvm_begin;
-  /*******************************************************************/
-
-  /* Check if data + heap + stack exceeds RAM limit */
-  ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-
-  /* Check if FLASH usage exceeds FLASH size */
-  ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/entropy.c b/third_party/openthread/repo/examples/platforms/efr32mg12/entropy.c
deleted file mode 100644 (file)
index 2b196bb..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements an entropy source based on ADC.
- *
- */
-
-#include <openthread/platform/entropy.h>
-
-#include "utils/code_utils.h"
-
-#include "em_adc.h"
-#include "em_cmu.h"
-
-enum
-{
-    EFR32_ADC_REF_CLOCK = 7000000,
-};
-
-void efr32RandomInit(void)
-{
-    /* Enable ADC Clock */
-    CMU_ClockEnable(cmuClock_ADC0, true);
-    ADC_Init_TypeDef       init       = ADC_INIT_DEFAULT;
-    ADC_InitSingle_TypeDef singleInit = ADC_INITSINGLE_DEFAULT;
-
-    /* Initialize the ADC with the required values */
-    init.timebase = ADC_TimebaseCalc(0);
-    init.prescale = ADC_PrescaleCalc(EFR32_ADC_REF_CLOCK, 0);
-    ADC_Init(ADC0, &init);
-
-    /* Initialize for single conversion specific to RNG */
-    singleInit.reference = adcRefVEntropy;
-    singleInit.diff      = true;
-    singleInit.posSel    = adcPosSelVSS;
-    singleInit.negSel    = adcNegSelVSS;
-    ADC_InitSingle(ADC0, &singleInit);
-
-    /* Set VINATT to maximum value and clear FIFO */
-    ADC0->SINGLECTRLX |= _ADC_SINGLECTRLX_VINATT_MASK;
-    ADC0->SINGLEFIFOCLEAR = ADC_SINGLEFIFOCLEAR_SINGLEFIFOCLEAR;
-}
-
-static uint32_t randomUint32Get(void)
-{
-    uint8_t  tmp;
-    uint32_t random = 0;
-
-    for (int i = 0; i < 4; i++)
-    {
-        tmp = 0;
-
-        for (int j = 0; j < 3; j++)
-        {
-            ADC_Start(ADC0, adcStartSingle);
-
-            while ((ADC0->IF & ADC_IF_SINGLE) == 0)
-                ;
-
-            tmp |= ((ADC_DataSingleGet(ADC0) & 0x07) << (j * 3));
-        }
-
-        random |= (tmp & 0xff) << (i * 8);
-    }
-
-    return random;
-}
-
-otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
-
-    for (uint16_t length = 0; length < aOutputLength; length++)
-    {
-        aOutput[length] = (uint8_t)randomUint32Get();
-    }
-
-exit:
-    return error;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/fem-control.c b/third_party/openthread/repo/examples/platforms/efr32mg12/fem-control.c
deleted file mode 100644 (file)
index f66415c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "hal-config.h"
-
-#if (HAL_FEM_ENABLE)
-#include "util/plugin/plugin-common/fem-control/fem-control.c"
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/flash.c b/third_party/openthread/repo/examples/platforms/efr32mg12/flash.c
deleted file mode 100644 (file)
index 4f35969..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the non-volatile storage.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#if OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE // Use OT NV system
-
-#include "em_msc.h"
-#include <string.h>
-#include <openthread/instance.h>
-
-#define FLASH_PAGE_NUM 2
-#define FLASH_DATA_END_ADDR (FLASH_BASE + FLASH_SIZE)
-#define FLASH_DATA_START_ADDR (FLASH_DATA_END_ADDR - (FLASH_PAGE_SIZE * FLASH_PAGE_NUM))
-#define FLASH_SWAP_PAGE_NUM (FLASH_PAGE_NUM / 2)
-#define FLASH_SWAP_SIZE (FLASH_PAGE_SIZE * FLASH_SWAP_PAGE_NUM)
-
-static inline uint32_t mapAddress(uint8_t aSwapIndex, uint32_t aOffset)
-{
-    uint32_t address;
-
-    address = FLASH_DATA_START_ADDR + aOffset;
-
-    if (aSwapIndex)
-    {
-        address += FLASH_SWAP_SIZE;
-    }
-
-    return address;
-}
-
-void otPlatFlashInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return FLASH_SWAP_SIZE;
-}
-
-void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint32_t address = mapAddress(aSwapIndex, 0);
-
-    for (uint32_t n = 0; n < FLASH_SWAP_PAGE_NUM; n++, address += FLASH_PAGE_SIZE)
-    {
-        MSC_ErasePage((uint32_t *)address);
-    }
-}
-
-void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    MSC_WriteWord((uint32_t *)mapAddress(aSwapIndex, aOffset), aData, aSize);
-}
-
-void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    memcpy(aData, (const uint8_t *)mapAddress(aSwapIndex, aOffset), aSize);
-}
-
-#else // Defaults to Silabs nvm3 system
-
-#include "nvm3.h"
-#include "nvm3_default.h"
-#include <string.h>
-#include <openthread/platform/settings.h>
-#include "common/code_utils.hpp"
-#include "common/logging.hpp"
-
-#define NVM3KEY_DOMAIN_OPENTHREAD 0x20000U
-#define NUM_INDEXED_SETTINGS \
-    OPENTHREAD_CONFIG_MLE_MAX_CHILDREN // Indexed key types are only supported for kKeyChildInfo (=='child table').
-#define ENUM_NVM3_KEY_LIST_SIZE 4      // List size used when enumerating nvm3 keys.
-
-static otError          addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength);
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index);
-static otError          mapNvm3Error(Ecode_t nvm3Res);
-
-void otPlatSettingsInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    if (mapNvm3Error(nvm3_open(nvm3_defaultHandle, nvm3_defaultInit)) != OT_ERROR_NONE)
-    {
-        otLogDebgPlat("Error initializing nvm3 instance");
-    }
-}
-
-void otPlatSettingsDeinit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    nvm3_close(nvm3_defaultHandle);
-}
-
-otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index', then reads the nvm3 data into the destination buffer.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError  err;
-    uint16_t valueLength = 0;
-
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if (idx == aIndex)
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    valueLength = objLen;
-
-                    // Only perform read if an input buffer was passed in.
-                    if ((aValue != NULL) && (aValueLength != NULL))
-                    {
-                        // Read all nvm3 obj bytes into a tmp buffer, then copy the required
-                        // number of bytes to the read destination buffer.
-                        uint8_t *buf = malloc(valueLength);
-                        err          = mapNvm3Error(nvm3_readData(nvm3_defaultHandle, nvm3Key, buf, valueLength));
-                        if (err == OT_ERROR_NONE)
-                        {
-                            memcpy(aValue, buf, (valueLength < *aValueLength) ? valueLength : *aValueLength);
-                        }
-                        free(buf);
-                        SuccessOrExit(err);
-                    }
-                }
-                idxFound = true;
-                break;
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    if (aValueLength != NULL)
-    {
-        *aValueLength = valueLength; // always return actual nvm3 object length.
-    }
-
-    return err;
-}
-
-otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError err;
-
-    // Delete all nvm3 objects matching the input key (i.e. the 'setting indexes' of the key).
-    err = otPlatSettingsDelete(aInstance, aKey, -1);
-    if ((err == OT_ERROR_NONE) || (err == OT_ERROR_NOT_FOUND))
-    {
-        // Add new setting object (i.e. 'index0' of the key).
-        err = addSetting(aKey, aValue, aValueLength);
-        SuccessOrExit(err);
-    }
-
-exit:
-    return err;
-}
-
-otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    return addSetting(aKey, aValue, aValueLength);
-}
-
-otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index' (or index = -1 to delete all), then deletes the nvm3 object.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError          err;
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if ((idx == aIndex) || (aIndex == -1))
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    // Delete the nvm3 object.
-                    err = mapNvm3Error(nvm3_deleteObject(nvm3_defaultHandle, nvm3Key));
-                    SuccessOrExit(err);
-                }
-                if (aIndex != -1)
-                {
-                    idxFound = true;
-                    break;
-                }
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    return err;
-}
-
-void otPlatSettingsWipe(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // Delete nvm3 objects for all OT Settings keys (and any of their associated 'indexes').
-    // Note- any OT User nvm3 objects in the OT nvm3 area are NOT be erased.
-    for (uint16_t aKey = 0; aKey < 8; ++aKey)
-    {
-        otPlatSettingsDelete(NULL, aKey, -1);
-    }
-}
-
-// Local functions..
-
-static otError addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    // Helper function- writes input buffer data to a NEW nvm3 object.
-    // nvm3 object is created at the first available Key + index.
-
-    otError err;
-
-    if ((aValueLength == 0) || (aValue == NULL))
-    {
-        err = OT_ERROR_INVALID_ARGS;
-    }
-    else
-    {
-        for (int idx = 0; idx <= NUM_INDEXED_SETTINGS; ++idx)
-        {
-            nvm3_ObjectKey_t nvm3Key;
-            nvm3Key = makeNvm3ObjKey(aKey, idx);
-
-            uint32_t objType;
-            size_t   objLen;
-            err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-            if (err == OT_ERROR_NOT_FOUND)
-            {
-                // Use this index for the new nvm3 object.
-                // Write the binary data to nvm3 (Creates nvm3 object if required).
-                err = mapNvm3Error(nvm3_writeData(nvm3_defaultHandle, nvm3Key, aValue, aValueLength));
-                break;
-            }
-            else if (err != OT_ERROR_NONE)
-            {
-                break;
-            }
-        }
-    }
-
-    return err;
-}
-
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index)
-{
-    return (NVM3KEY_DOMAIN_OPENTHREAD | (otSettingsKey << 8) | (index & 0xFF));
-}
-
-static otError mapNvm3Error(Ecode_t nvm3Res)
-{
-    otError err;
-
-    switch (nvm3Res)
-    {
-    case ECODE_NVM3_OK:
-        err = OT_ERROR_NONE;
-        break;
-
-    case ECODE_NVM3_ERR_KEY_NOT_FOUND:
-        err = OT_ERROR_NOT_FOUND;
-        break;
-
-    default:
-        err = OT_ERROR_FAILED;
-        break;
-    }
-
-    return err;
-}
-
-#endif // OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/logging.c b/third_party/openthread/repo/examples/platforms/efr32mg12/logging.c
deleted file mode 100644 (file)
index fa0a4dd..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file logging.c
- * Platform abstraction for the logging
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/logging.h>
-
-#include <utils/logging_rtt.h>
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-void efr32LogInit(void)
-{
-    utilsLogRttInit();
-}
-
-void efr32LogDeinit(void)
-{
-    utilsLogRttDeinit();
-}
-
-OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    va_list ap;
-
-    va_start(ap, aFormat);
-
-    utilsLogRttOutput(aLogLevel, aLogRegion, aFormat, ap);
-
-    va_end(ap);
-}
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/misc.c b/third_party/openthread/repo/examples/platforms/efr32mg12/misc.c
deleted file mode 100644 (file)
index 4b2076f..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for miscellaneous behaviors.
- */
-
-#include <openthread/platform/misc.h>
-
-#include "em_rmu.h"
-#include "platform-efr32.h"
-
-static uint32_t sResetCause;
-
-void efr32MiscInit(void)
-{
-    // Read the cause of last reset.
-    sResetCause = RMU_ResetCauseGet();
-
-    // Clear the register, as the causes cumulate over resets.
-    RMU_ResetCauseClear();
-}
-
-void otPlatReset(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    NVIC_SystemReset();
-}
-
-otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otPlatResetReason reason;
-
-    if (sResetCause & RMU_RSTCAUSE_PORST)
-    {
-        reason = OT_PLAT_RESET_REASON_POWER_ON;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_SYSREQRST)
-    {
-        reason = OT_PLAT_RESET_REASON_SOFTWARE;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_WDOGRST)
-    {
-        reason = OT_PLAT_RESET_REASON_WATCHDOG;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_EXTRST)
-    {
-        reason = OT_PLAT_RESET_REASON_EXTERNAL;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_LOCKUPRST)
-    {
-        reason = OT_PLAT_RESET_REASON_FAULT;
-    }
-    else if ((sResetCause & RMU_RSTCAUSE_AVDDBOD) || (sResetCause & RMU_RSTCAUSE_DECBOD) ||
-             (sResetCause & RMU_RSTCAUSE_DVDDBOD) || (sResetCause & RMU_RSTCAUSE_EM4RST))
-    {
-        reason = OT_PLAT_RESET_REASON_ASSERT;
-    }
-    else
-    {
-        reason = OT_PLAT_RESET_REASON_UNKNOWN;
-    }
-
-    return reason;
-}
-
-void otPlatWakeHost(void)
-{
-    // TODO: implement an operation to wake the host from sleep state.
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/openthread-core-efr32-config-check.h b/third_party/openthread/repo/examples/platforms/efr32mg12/openthread-core-efr32-config-check.h
deleted file mode 100644 (file)
index 2c722a6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-
-#include "board_config.h"
-
-#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
-#error "Platform efr32mg12 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
-#endif
-
-#ifndef RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
-#error "Platform efr32mg12 not configured to support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
-#endif
-#endif
-
-#endif /* OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_ */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/openthread-core-efr32-config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/openthread-core-efr32-config.h
deleted file mode 100644 (file)
index d1cbde6..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes efr32 compile-time configuration constants
- *   for OpenThread.
- */
-
-#include "board_config.h"
-#include "em_msc.h"
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_H_
-
-/**
- * @def OPENTHREAD_CONFIG_LOG_OUTPUT
- *
- * The efr32 platform provides an otPlatLog() function.
- */
-#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT /* allow command line override */
-#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
-#endif
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
- *
- * Define to 1 if you want to enable physical layer to support OQPSK modulation in 915MHz band.
- *
- */
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 1
-#else
-#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 0
-#endif
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
- *
- * Define to 1 if you want to enable physical layer to support OQPSK modulation in 2.4GHz band.
- *
- */
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1
-#else
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 0
-#endif
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_INFO
- *
- * The platform-specific string to insert into the OpenThread version string.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_INFO "EFR32"
-
-/*
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
- *
- * Define to 1 if you want to enable software retransmission logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
- *
- * Define to 1 if you want to enable software CSMA-CA backoff logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
- *
- * Define to 1 if you want to enable software transmission security logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE
- *
- * Define to 1 if you want to enable software energy scanning logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
- *
- * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
- *
- * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
- *
- * Define to 1 to enable NCP UART support.
- *
- */
-#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
-
-#endif // OPENTHREAD_CORE_EFR32_CONFIG_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/platform-band.h b/third_party/openthread/repo/examples/platforms/efr32mg12/platform-band.h
deleted file mode 100644 (file)
index 7c4d912..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file defines the frequency band configuration structure for efr32.
- *
- */
-
-#ifndef PLATFORM_BAND_H_
-#define PLATFORM_BAND_H_
-
-#include <openthread/platform/radio.h>
-
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-#define RAIL_TX_FIFO_SIZE (OT_RADIO_FRAME_MAX_SIZE + 1)
-
-#define RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SLIP_TIME 500000UL
-#define RADIO_SCHEDULER_TX_PRIORITY 100
-#define RADIO_SCHEDULER_TX_SLIP_TIME 500000UL
-
-#define RADIO_TIMING_CSMA_OVERHEAD_US 500
-#define RADIO_TIMING_DEFAULT_BYTETIME_US 32   // only used if RAIL_GetBitRate returns 0
-#define RADIO_TIMING_DEFAULT_SYMBOLTIME_US 16 // only used if RAIL_GetSymbolRate returns 0
-
-typedef struct efr32RadioCounters
-{
-    uint64_t mRailPlatTxTriggered;
-    uint64_t mRailPlatRadioReceiveDoneCbCount;
-    uint64_t mRailPlatRadioEnergyScanDoneCbCount;
-    uint64_t mRailPlatRadioTxDoneCbCount;
-    uint64_t mRailTxStarted;
-    uint64_t mRailTxStartFailed;
-    uint64_t mRailEventConfigScheduled;
-    uint64_t mRailEventConfigUnScheduled;
-    uint64_t mRailEventPacketSent;
-    uint64_t mRailEventChannelBusy;
-    uint64_t mRailEventEnergyScanCompleted;
-    uint64_t mRailEventCalNeeded;
-    uint64_t mRailEventPacketReceived;
-    uint64_t mRailEventNoAck;
-    uint64_t mRailEventTxAbort;
-    uint64_t mRailEventSchedulerStatusError;
-    uint64_t mRailEventsSchedulerStatusTransmitBusy;
-    uint32_t mRailEventsSchedulerStatusLastStatus;
-} efr32RadioCounters;
-
-typedef struct efr32CommonConfig
-{
-    RAIL_Config_t mRailConfig;
-#if RADIO_CONFIG_DMP_SUPPORT
-    RAILSched_Config_t railSchedState;
-#endif
-    uint8_t
-        mRailTxFifo[RAIL_TX_FIFO_SIZE]; // must be 2 power between 64 and 4096, and bigger than OT_RADIO_FRAME_MAX_SIZE
-} efr32CommonConfig;
-
-typedef struct efr32BandConfig
-{
-    const RAIL_ChannelConfig_t *mChannelConfig;
-    uint8_t                     mChannelMin;
-    uint8_t                     mChannelMax;
-} efr32BandConfig;
-
-#endif // PLATFORM_BAND_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/platform-efr32.h b/third_party/openthread/repo/examples/platforms/efr32mg12/platform-efr32.h
deleted file mode 100644 (file)
index 5ec48e2..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes the platform-specific initializers.
- *
- */
-
-#ifndef PLATFORM_EFR32_H_
-#define PLATFORM_EFR32_H_
-
-#include <openthread/instance.h>
-
-#include "em_device.h"
-#include "em_system.h"
-
-#include "core_cm4.h"
-#include "rail.h"
-
-// Global OpenThread instance structure
-extern otInstance *sInstance;
-
-// Global reference to rail handle
-extern RAIL_Handle_t gRailHandle;
-
-/**
- * This function initializes the alarm service used by OpenThread.
- *
- */
-void efr32AlarmInit(void);
-
-/**
- * This function performs alarm driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32AlarmProcess(otInstance *aInstance);
-
-/**
- * This function initializes the radio service used by OpenThead.
- *
- */
-void efr32RadioInit(void);
-
-/**
- * This function deinitializes the radio service used by OpenThead.
- *
- */
-void efr32RadioDeinit(void);
-
-/**
- * This function performs radio driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32RadioProcess(otInstance *aInstance);
-
-/**
- * This function performs UART driver processing.
- *
- */
-void efr32UartProcess(void);
-
-/**
- * Initialization of Misc module.
- *
- */
-void efr32MiscInit(void);
-
-/**
- * Initialization of ADC module for random number generator.
- *
- */
-void efr32RandomInit(void);
-
-/**
- * Initialization of Logger driver.
- *
- */
-void efr32LogInit(void);
-
-/**
- * Deinitialization of Logger driver.
- *
- */
-void efr32LogDeinit(void);
-
-/**
- * Registers the sleep callback handler.  The callback is used to check that
- * the application has no work pending and that it is safe to put the EFR32
- * into a low energy sleep mode.
- *
- * The callback should return true if it is ok to enter sleep mode. Note
- * that the callback itself is run with interrupts disabled and so should
- * be kept as short as possible.  Anny interrupt including those from timers
- * will wake the EFR32 out of sleep mode.
- *
- * @param[in]  aCallback  Callback function.
- *
- */
-void efr32SetSleepCallback(bool (*aCallback)(void));
-
-/**
- * Put the EFR32 into a low power mode.  Before sleeping it will call a callback
- * in the application registered with efr32SetSleepCallback to ensure that there
- * is no outstanding work in the application to do.
- */
-void efr32Sleep(void);
-
-#endif // PLATFORM_EFR32_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/radio.c b/third_party/openthread/repo/examples/platforms/efr32mg12/radio.c
deleted file mode 100644 (file)
index ad2ce79..0000000
+++ /dev/null
@@ -1,1175 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for radio communication.
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-
-#include "openthread-system.h"
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include <openthread/platform/radio.h>
-
-#include "common/logging.hpp"
-#include "utils/code_utils.h"
-
-#include "utils/soft_source_match_table.h"
-
-#include "board_config.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "pa_conversions_efr32.h"
-#include "platform-band.h"
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-enum
-{
-    IEEE802154_MIN_LENGTH = 5,
-    IEEE802154_MAX_LENGTH = 127,
-    IEEE802154_ACK_LENGTH = 5,
-
-    // FCF + DSN + dest PANID + dest addr + src PANID + src addr (without security header)
-    IEEE802154_MAX_MHR_LENGTH = 2 + 1 + 2 + 8 + 2 + 8,
-
-    IEEE802154_FRAME_TYPE_MASK        = 0x7,
-    IEEE802154_FRAME_TYPE_ACK         = 0x2,
-    IEEE802154_FRAME_TYPE_MAC_COMMAND = 0x3,
-    IEEE802154_ACK_REQUEST            = 1 << 5,
-    IEEE802154_DSN_OFFSET             = 2,
-    IEEE802154_FCF_OFFSET             = 0,
-};
-
-enum
-{
-    EFR32_RECEIVE_SENSITIVITY    = -100, // dBm
-    EFR32_RSSI_AVERAGING_TIME    = 16,   // us
-    EFR32_RSSI_AVERAGING_TIMEOUT = 300,  // us
-};
-
-enum
-{
-    EFR32_SCHEDULER_SAMPLE_RSSI_PRIORITY = 10, // High priority
-    EFR32_SCHEDULER_TX_PRIORITY          = 10, // High priority
-    EFR32_SCHEDULER_RX_PRIORITY          = 20, // Low priority
-};
-
-enum
-{
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT && RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-    EFR32_NUM_BAND_CONFIGS = 2,
-#else
-    EFR32_NUM_BAND_CONFIGS = 1,
-#endif
-};
-
-typedef enum
-{
-    ENERGY_SCAN_STATUS_IDLE,
-    ENERGY_SCAN_STATUS_IN_PROGRESS,
-    ENERGY_SCAN_STATUS_COMPLETED
-} energyScanStatus;
-
-typedef enum
-{
-    ENERGY_SCAN_MODE_SYNC,
-    ENERGY_SCAN_MODE_ASYNC
-} energyScanMode;
-
-RAIL_Handle_t gRailHandle;
-
-static volatile bool sTransmitBusy = false;
-static bool          sPromiscuous  = false;
-static otRadioState  sState        = OT_RADIO_STATE_DISABLED;
-
-enum
-{
-    ACKED_WITH_FP_MATCH_LENGTH = 1 + IEEE802154_MAX_MHR_LENGTH, // PHR and MHR
-    ACKED_WITH_FP_SLOTS = 16, // maximum number of Data Request packets in the RX FIFO. Length should be a power of 2.
-};
-
-typedef struct efr32AckedWithFP
-{
-    uint8_t mLength;
-    uint8_t mPacket[ACKED_WITH_FP_MATCH_LENGTH];
-} efr32AckedWithFP;
-static bool              sIsSrcMatchEnabled = false;
-static efr32AckedWithFP  sAckedWithFPFifo[ACKED_WITH_FP_SLOTS];
-static uint32_t          sAckedWithFPReadIndex;
-static volatile uint32_t sAckedWithFPWriteIndex;
-
-static uint8_t      sReceivePsdu[IEEE802154_MAX_LENGTH];
-static otRadioFrame sReceiveFrame;
-static otError      sReceiveError;
-
-static otRadioFrame     sTransmitFrame;
-static uint8_t          sTransmitPsdu[IEEE802154_MAX_LENGTH];
-static volatile otError sTransmitError;
-
-static efr32CommonConfig sCommonConfig;
-static efr32BandConfig   sBandConfigs[EFR32_NUM_BAND_CONFIGS];
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-static efr32RadioCounters sRailDebugCounters;
-#endif
-
-static volatile energyScanStatus sEnergyScanStatus;
-static volatile int8_t           sEnergyScanResultDbm;
-static energyScanMode            sEnergyScanMode;
-
-#define QUARTER_DBM_IN_DBM 4
-#define US_IN_MS 1000
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents);
-
-static const RAIL_IEEE802154_Config_t sRailIeee802154Config = {
-    .addresses = NULL,
-    .ackConfig =
-        {
-            .enable     = true,
-            .ackTimeout = 864,
-            .rxTransitions =
-                {
-                    .success = RAIL_RF_STATE_RX,
-                    .error   = RAIL_RF_STATE_RX,
-                },
-            .txTransitions =
-                {
-                    .success = RAIL_RF_STATE_RX,
-                    .error   = RAIL_RF_STATE_RX,
-                },
-        },
-    .timings =
-        {
-            .idleToRx            = 100,
-            .txToRx              = 192 - 10,
-            .idleToTx            = 100,
-            .rxToTx              = 192,
-            .rxSearchTimeout     = 0,
-            .txToRxSearchTimeout = 0,
-        },
-    .framesMask       = RAIL_IEEE802154_ACCEPT_STANDARD_FRAMES,
-    .promiscuousMode  = false,
-    .isPanCoordinator = false,
-};
-
-#if RADIO_CONFIG_PA_USES_DCDC
-RAIL_DECLARE_TX_POWER_DCDC_CURVES(piecewiseSegments, curvesSg, curves24Hp, curves24Lp);
-#else
-RAIL_DECLARE_TX_POWER_VBAT_CURVES(piecewiseSegments, curvesSg, curves24Hp, curves24Lp);
-#endif
-
-static int8_t sTxPowerDbm = OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER;
-
-static int8_t sCcaThresholdDbm = -75; // default -75dBm energy detect threshold
-
-static efr32BandConfig *sCurrentBandConfig = NULL;
-
-static RAIL_Handle_t efr32RailInit(efr32CommonConfig *aCommonConfig)
-{
-    RAIL_Status_t status;
-    RAIL_Handle_t handle;
-
-    handle = RAIL_Init(&aCommonConfig->mRailConfig, NULL);
-    assert(handle != NULL);
-
-    status = RAIL_ConfigCal(handle, RAIL_CAL_ALL);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_IEEE802154_Init(handle, &sRailIeee802154Config);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_ConfigEvents(handle, RAIL_EVENTS_ALL,
-                               RAIL_EVENT_RX_ACK_TIMEOUT |                      //
-                                   RAIL_EVENTS_TX_COMPLETION |                  //
-                                   RAIL_EVENT_RX_PACKET_RECEIVED |              //
-                                   RAIL_EVENT_RSSI_AVERAGE_DONE |               //
-                                   RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND | //
-                                   RAIL_EVENT_CAL_NEEDED |                      //
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-                                   RAIL_EVENT_CONFIG_SCHEDULED |   //
-                                   RAIL_EVENT_CONFIG_UNSCHEDULED | //
-#endif
-                                   RAIL_EVENT_SCHEDULER_STATUS //
-    );
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    uint16_t actualLenth = RAIL_SetTxFifo(handle, aCommonConfig->mRailTxFifo, 0, sizeof(aCommonConfig->mRailTxFifo));
-    assert(actualLenth == sizeof(aCommonConfig->mRailTxFifo));
-
-    return handle;
-}
-
-static void efr32RailConfigLoad(efr32BandConfig *aBandConfig)
-{
-    RAIL_Status_t status;
-#if HAL_PA_2P4_LOWPOWER == 1
-    RAIL_TxPowerConfig_t txPowerConfig = {RAIL_TX_POWER_MODE_2P4_LP, HAL_PA_VOLTAGE, 10};
-#else
-    RAIL_TxPowerConfig_t txPowerConfig = {RAIL_TX_POWER_MODE_2P4_HP, HAL_PA_VOLTAGE, 10};
-#endif
-    if (aBandConfig->mChannelConfig != NULL)
-    {
-        uint16_t firstChannel = RAIL_ConfigChannels(gRailHandle, aBandConfig->mChannelConfig, NULL);
-        assert(firstChannel == aBandConfig->mChannelMin);
-
-        txPowerConfig.mode = RAIL_TX_POWER_MODE_SUBGIG;
-    }
-    else
-    {
-        status = RAIL_IEEE802154_Config2p4GHzRadio(gRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-    status = RAIL_ConfigTxPower(gRailHandle, &txPowerConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-static void efr32RadioSetTxPower(int8_t aPowerDbm)
-{
-    RAIL_Status_t              status;
-    RAIL_TxPowerCurvesConfig_t txPowerCurvesConfig = {curves24Hp, curvesSg, curves24Lp, piecewiseSegments};
-
-    status = RAIL_InitTxPowerCurves(&txPowerCurvesConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPowerDbm) * 10);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-static efr32BandConfig *efr32RadioGetBandConfig(uint8_t aChannel)
-{
-    efr32BandConfig *config = NULL;
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        if ((sBandConfigs[i].mChannelMin <= aChannel) && (aChannel <= sBandConfigs[i].mChannelMax))
-        {
-            config = &sBandConfigs[i];
-            break;
-        }
-    }
-
-    return config;
-}
-
-static void efr32ConfigInit(void (*aEventCallback)(RAIL_Handle_t railHandle, RAIL_Events_t events))
-{
-    sCommonConfig.mRailConfig.eventsCallback = aEventCallback;
-    sCommonConfig.mRailConfig.protocol       = NULL; // only used by Bluetooth stack
-#if RADIO_CONFIG_DMP_SUPPORT
-    sCommonConfig.mRailConfig.scheduler = &(sCommonConfig.railSchedState);
-#else
-    sCommonConfig.mRailConfig.scheduler = NULL; // only needed for DMP
-#endif
-
-    uint8_t index = 0;
-
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-    sBandConfigs[index].mChannelConfig = NULL;
-    sBandConfigs[index].mChannelMin    = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN;
-    sBandConfigs[index].mChannelMax    = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX;
-
-    index++;
-#endif
-
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-    sBandConfigs[index].mChannelConfig = channelConfigs[0];
-    sBandConfigs[index].mChannelMin    = OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN;
-    sBandConfigs[index].mChannelMax    = OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX;
-#endif
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    memset(&sRailDebugCounters, 0x00, sizeof(efr32RadioCounters));
-#endif
-
-    gRailHandle = efr32RailInit(&sCommonConfig);
-    assert(gRailHandle != NULL);
-    efr32RailConfigLoad(&(sBandConfigs[0]));
-}
-
-void efr32RadioInit(void)
-{
-    RAIL_Status_t status;
-
-    // check if RAIL_TX_FIFO_SIZE is power of two..
-    assert((RAIL_TX_FIFO_SIZE & (RAIL_TX_FIFO_SIZE - 1)) == 0);
-
-    // check the limits of the RAIL_TX_FIFO_SIZE.
-    assert((RAIL_TX_FIFO_SIZE >= 64) || (RAIL_TX_FIFO_SIZE <= 4096));
-
-    efr32ConfigInit(RAILCb_Generic);
-
-    CMU_ClockEnable(cmuClock_PRS, true);
-
-    status = RAIL_ConfigSleep(gRailHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sReceiveFrame.mLength  = 0;
-    sReceiveFrame.mPsdu    = sReceivePsdu;
-    sTransmitFrame.mLength = 0;
-    sTransmitFrame.mPsdu   = sTransmitPsdu;
-
-    sCurrentBandConfig = efr32RadioGetBandConfig(OPENTHREAD_CONFIG_DEFAULT_CHANNEL);
-    assert(sCurrentBandConfig != NULL);
-
-    memset(sAckedWithFPFifo, 0, sizeof(sAckedWithFPFifo));
-    sAckedWithFPWriteIndex = 0;
-    sAckedWithFPReadIndex  = 0;
-
-    efr32RadioSetTxPower(sTxPowerDbm);
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-    sTransmitError    = OT_ERROR_NONE;
-    sTransmitBusy     = false;
-
-    otLogInfoPlat("Initialized", NULL);
-}
-
-void efr32RadioDeinit(void)
-{
-    RAIL_Status_t status;
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE_ABORT, true);
-    status = RAIL_ConfigEvents(gRailHandle, RAIL_EVENTS_ALL, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sCurrentBandConfig = NULL;
-}
-
-static otError efr32StartEnergyScan(energyScanMode aMode, uint16_t aChannel, RAIL_Time_t aAveragingTimeUs)
-{
-    RAIL_Status_t    status;
-    otError          error  = OT_ERROR_NONE;
-    efr32BandConfig *config = NULL;
-
-    otEXPECT_ACTION(sEnergyScanStatus == ENERGY_SCAN_STATUS_IDLE, error = OT_ERROR_BUSY);
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IN_PROGRESS;
-    sEnergyScanMode   = aMode;
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-
-    config = efr32RadioGetBandConfig(aChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    if (sCurrentBandConfig != config)
-    {
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    RAIL_SchedulerInfo_t scanSchedulerInfo = {.priority        = RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY,
-                                              .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-                                              .transactionTime = aAveragingTimeUs};
-
-    status = RAIL_StartAverageRssi(gRailHandle, aChannel, aAveragingTimeUs, &scanSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-exit:
-    return error;
-}
-
-void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint64_t eui64;
-    uint8_t *eui64Ptr = NULL;
-
-    eui64    = SYSTEM_GetUnique();
-    eui64Ptr = (uint8_t *)&eui64;
-
-    for (uint8_t i = 0; i < OT_EXT_ADDRESS_SIZE; i++)
-    {
-        aIeeeEui64[i] = eui64Ptr[(OT_EXT_ADDRESS_SIZE - 1) - i];
-    }
-}
-
-void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("PANID=%X", aPanId);
-
-    utilsSoftSrcMatchSetPanId(aPanId);
-
-    status = RAIL_IEEE802154_SetPanId(gRailHandle, aPanId, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], aAddress->m8[4],
-                  aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]);
-
-    status = RAIL_IEEE802154_SetLongAddress(gRailHandle, (uint8_t *)aAddress->m8, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ShortAddr=%X", aAddress);
-
-    status = RAIL_IEEE802154_SetShortAddress(gRailHandle, aAddress, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-bool otPlatRadioIsEnabled(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return (sState != OT_RADIO_STATE_DISABLED);
-}
-
-otError otPlatRadioEnable(otInstance *aInstance)
-{
-    otEXPECT(!otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioDisable(otInstance *aInstance)
-{
-    otEXPECT(otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_DISABLED", NULL);
-    sState = OT_RADIO_STATE_DISABLED;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioSleep(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED),
-                    error = OT_ERROR_INVALID_STATE);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
-{
-    otError          error = OT_ERROR_NONE;
-    RAIL_Status_t    status;
-    efr32BandConfig *config;
-
-    OT_UNUSED_VARIABLE(aInstance);
-    otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    if (sCurrentBandConfig != config)
-    {
-        RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    RAIL_SchedulerInfo_t bgRxSchedulerInfo = {
-        .priority = RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY,
-        // sliptime/transaction time is not used for bg rx
-    };
-
-    status = RAIL_StartRx(gRailHandle, aChannel, &bgRxSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_RECEIVE", NULL);
-    sState                 = OT_RADIO_STATE_RECEIVE;
-    sReceiveFrame.mChannel = aChannel;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
-{
-    otError           error      = OT_ERROR_NONE;
-    RAIL_CsmaConfig_t csmaConfig = RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA;
-    RAIL_TxOptions_t  txOptions  = RAIL_TX_OPTIONS_DEFAULT;
-    efr32BandConfig * config;
-    RAIL_Status_t     status;
-    uint8_t           frameLength;
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    sRailDebugCounters.mRailPlatTxTriggered++;
-#endif
-
-    assert(sTransmitBusy == false);
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_DISABLED) && (sState != OT_RADIO_STATE_TRANSMIT),
-                    error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aFrame->mChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    sState         = OT_RADIO_STATE_TRANSMIT;
-    sTransmitError = OT_ERROR_NONE;
-    sTransmitBusy  = true;
-
-    if (sCurrentBandConfig != config)
-    {
-        RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    frameLength = (uint8_t)aFrame->mLength;
-    RAIL_WriteTxFifo(gRailHandle, &frameLength, sizeof frameLength, true);
-    RAIL_WriteTxFifo(gRailHandle, aFrame->mPsdu, frameLength - 2, false);
-
-    RAIL_SchedulerInfo_t txSchedulerInfo = {
-        .priority        = RADIO_SCHEDULER_TX_PRIORITY,
-        .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-        .transactionTime = 0, // will be calculated later if DMP is used
-    };
-
-    if (aFrame->mPsdu[0] & IEEE802154_ACK_REQUEST)
-    {
-        txOptions |= RAIL_TX_OPTION_WAIT_FOR_ACK;
-
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time we wait for ACK
-        if (RAIL_GetSymbolRate(gRailHandle) > 0)
-        {
-            txSchedulerInfo.transactionTime += 12 * 1e6 / RAIL_GetSymbolRate(gRailHandle);
-        }
-        else
-        {
-            txSchedulerInfo.transactionTime += 12 * RADIO_TIMING_DEFAULT_SYMBOLTIME_US;
-        }
-#endif
-    }
-
-#if RADIO_CONFIG_DMP_SUPPORT
-    // time needed for the frame itself
-    // 4B preamble, 1B SFD, 1B PHR is not counted in frameLength
-    if (RAIL_GetBitRate(gRailHandle) > 0)
-    {
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * 8 * 1e6 / RAIL_GetBitRate(gRailHandle);
-    }
-    else
-    { // assume 250kbps
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * RADIO_TIMING_DEFAULT_BYTETIME_US;
-    }
-#endif
-
-    if (aFrame->mInfo.mTxInfo.mCsmaCaEnabled)
-    {
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time needed for CSMA/CA
-        txSchedulerInfo.transactionTime += RADIO_TIMING_CSMA_OVERHEAD_US;
-#endif
-        csmaConfig.csmaTries    = aFrame->mInfo.mTxInfo.mMaxCsmaBackoffs;
-        csmaConfig.ccaThreshold = sCcaThresholdDbm;
-
-        status = RAIL_StartCcaCsmaTx(gRailHandle, aFrame->mChannel, txOptions, &csmaConfig, &txSchedulerInfo);
-    }
-    else
-    {
-        status = RAIL_StartTx(gRailHandle, aFrame->mChannel, txOptions, &txSchedulerInfo);
-    }
-
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStarted++;
-#endif
-        otPlatRadioTxStarted(aInstance, aFrame);
-    }
-    else
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStartFailed++;
-#endif
-        sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-        sTransmitBusy  = false;
-        otSysEventSignalPending();
-    }
-
-exit:
-    return error;
-}
-
-otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return &sTransmitFrame;
-}
-
-int8_t otPlatRadioGetRssi(otInstance *aInstance)
-{
-    otError  error;
-    uint32_t start;
-    int8_t   rssi = OT_RADIO_RSSI_INVALID;
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    error = efr32StartEnergyScan(ENERGY_SCAN_MODE_SYNC, sReceiveFrame.mChannel, EFR32_RSSI_AVERAGING_TIME);
-    otEXPECT(error == OT_ERROR_NONE);
-
-    start = RAIL_GetTime();
-
-    // waiting for the event RAIL_EVENT_RSSI_AVERAGE_DONE
-    while (sEnergyScanStatus == ENERGY_SCAN_STATUS_IN_PROGRESS &&
-           ((RAIL_GetTime() - start) < EFR32_RSSI_AVERAGING_TIMEOUT))
-        ;
-
-    if (sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        rssi = sEnergyScanResultDbm;
-    }
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-exit:
-    return rssi;
-}
-
-otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_ENERGY_SCAN;
-}
-
-bool otPlatRadioGetPromiscuous(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return sPromiscuous;
-}
-
-void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    sPromiscuous = aEnable;
-
-    status = RAIL_IEEE802154_SetPromiscuousMode(gRailHandle, aEnable);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // set Frame Pending bit for all outgoing ACKs if aEnable is false
-    sIsSrcMatchEnabled = aEnable;
-}
-
-static bool sAckedWithFPFifoIsFull(void)
-{
-    return (uint32_t)(sAckedWithFPWriteIndex - sAckedWithFPReadIndex) == otARRAY_LENGTH(sAckedWithFPFifo);
-}
-
-static bool sAckedWithFPFifoIsEmpty(void)
-{
-    return (uint32_t)(sAckedWithFPWriteIndex - sAckedWithFPReadIndex) == 0;
-}
-
-static efr32AckedWithFP *sAckedWithFPFifoGetWriteSlot(void)
-{
-    uint32_t idx = sAckedWithFPWriteIndex & (otARRAY_LENGTH(sAckedWithFPFifo) - 1);
-    return &sAckedWithFPFifo[idx];
-}
-
-static const efr32AckedWithFP *sAckedWithFPFifoGetReadSlot(void)
-{
-    uint32_t idx = sAckedWithFPReadIndex & (otARRAY_LENGTH(sAckedWithFPFifo) - 1);
-    return &sAckedWithFPFifo[idx];
-}
-
-static void insertIeee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
-{
-    assert(!sAckedWithFPFifoIsFull());
-    efr32AckedWithFP *const slot = sAckedWithFPFifoGetWriteSlot();
-
-    RAIL_RxPacketInfo_t packetInfo;
-
-    RAIL_GetRxIncomingPacketInfo(aRailHandle, &packetInfo);
-    assert(packetInfo.packetBytes >= 4); // PHR + FCF + DSN
-
-    if (packetInfo.packetBytes > sizeof(slot->mPacket))
-    {
-        packetInfo.packetBytes = sizeof(slot->mPacket);
-        if (packetInfo.firstPortionBytes >= sizeof(slot->mPacket))
-        {
-            packetInfo.firstPortionBytes = sizeof(slot->mPacket);
-            packetInfo.lastPortionData   = NULL;
-        }
-    }
-    slot->mLength = packetInfo.packetBytes;
-    RAIL_CopyRxPacket(slot->mPacket, &packetInfo);
-
-    ++sAckedWithFPWriteIndex;
-}
-
-static bool wasAckedWithFramePending(const uint8_t *aPsdu, uint8_t aPsduLength)
-{
-    bool     ackedWithFramePending = false;
-    uint16_t fcf                   = aPsdu[IEEE802154_FCF_OFFSET] | (aPsdu[IEEE802154_FCF_OFFSET + 1] << 8);
-
-    otEXPECT((fcf & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_MAC_COMMAND);
-
-    while (!(ackedWithFramePending || sAckedWithFPFifoIsEmpty()))
-    {
-        const efr32AckedWithFP *const slot = sAckedWithFPFifoGetReadSlot();
-        if ((slot->mPacket[0] == aPsduLength) && (memcmp(slot->mPacket + 1, aPsdu, slot->mLength - 1) == 0))
-        {
-            ackedWithFramePending = true;
-        }
-        ++sAckedWithFPReadIndex;
-    }
-
-exit:
-    return ackedWithFramePending;
-}
-
-static void processNextRxPacket(otInstance *aInstance)
-{
-    RAIL_RxPacketHandle_t  packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    RAIL_RxPacketInfo_t    packetInfo;
-    RAIL_RxPacketDetails_t packetDetails;
-    RAIL_Status_t          status;
-    uint16_t               length;
-
-    packetHandle = RAIL_GetRxPacketInfo(gRailHandle, RAIL_RX_PACKET_HANDLE_OLDEST, &packetInfo);
-
-    otEXPECT_ACTION(packetHandle != RAIL_RX_PACKET_HANDLE_INVALID &&
-                        packetInfo.packetStatus == RAIL_RX_PACKET_READY_SUCCESS,
-                    packetHandle = RAIL_RX_PACKET_HANDLE_INVALID);
-
-    status = RAIL_GetRxPacketDetailsAlt(gRailHandle, packetHandle, &packetDetails);
-    otEXPECT(status == RAIL_STATUS_NO_ERROR);
-
-    length = packetInfo.packetBytes + 1;
-
-    // check the length in recv packet info structure; RAIL should take care of this.
-    assert(length == packetInfo.firstPortionData[0]);
-
-    // check the length validity of recv packet; RAIL should take care of this.
-    assert(length >= IEEE802154_MIN_LENGTH && length <= IEEE802154_MAX_LENGTH);
-
-    otLogInfoPlat("Received data:%d", length);
-
-    // skip length byte
-    assert(packetInfo.firstPortionBytes > 0);
-    packetInfo.firstPortionData++;
-    packetInfo.firstPortionBytes--;
-    packetInfo.packetBytes--;
-
-    // read packet
-    RAIL_CopyRxPacket(sReceiveFrame.mPsdu, &packetInfo);
-
-    status = RAIL_ReleaseRxPacket(gRailHandle, packetHandle);
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-        packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    }
-
-    sReceiveFrame.mLength = length;
-
-    if (packetDetails.isAck)
-    {
-        assert((length == IEEE802154_ACK_LENGTH) &&
-               (sReceiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK);
-
-        RAIL_YieldRadio(gRailHandle);
-        sTransmitBusy = false;
-
-        if (sReceiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET])
-        {
-            sTransmitError = OT_ERROR_NONE;
-        }
-        else
-        {
-            sTransmitError = OT_ERROR_NO_ACK;
-        }
-    }
-    else
-    {
-        // signal MAC layer for each received frame if promiscuous is enabled
-        // otherwise only signal MAC layer for non-ACK frame
-        otEXPECT(sPromiscuous || (length != IEEE802154_ACK_LENGTH));
-
-        sReceiveError = OT_ERROR_NONE;
-
-        sReceiveFrame.mInfo.mRxInfo.mRssi = packetDetails.rssi;
-        sReceiveFrame.mInfo.mRxInfo.mLqi  = packetDetails.lqi;
-
-        // Get the timestamp when the SFD was received
-        assert(packetDetails.timeReceived.timePosition != RAIL_PACKET_TIME_INVALID);
-        packetDetails.timeReceived.totalPacketBytes = length + 1;
-
-        status = RAIL_GetRxTimeSyncWordEndAlt(gRailHandle, &packetDetails);
-        assert(status == RAIL_STATUS_NO_ERROR);
-        sReceiveFrame.mInfo.mRxInfo.mTimestamp = packetDetails.timeReceived.packetTime;
-
-        // Set this flag only when the packet is really acknowledged with frame pending set.
-        sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending =
-            wasAckedWithFramePending(sReceiveFrame.mPsdu, sReceiveFrame.mLength);
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-        }
-        else
-#endif
-        {
-            otLogInfoPlat("Received %d bytes", sReceiveFrame.mLength);
-            otPlatRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailPlatRadioReceiveDoneCbCount++;
-#endif
-        }
-    }
-
-    otSysEventSignalPending();
-
-exit:
-
-    if (packetHandle != RAIL_RX_PACKET_HANDLE_INVALID)
-    {
-        RAIL_ReleaseRxPacket(gRailHandle, packetHandle);
-    }
-}
-
-static void ieee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
-{
-    RAIL_Status_t status;
-
-    if (sIsSrcMatchEnabled)
-    {
-        RAIL_IEEE802154_Address_t sourceAddress;
-
-        status = RAIL_IEEE802154_GetAddress(aRailHandle, &sourceAddress);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-        if ((sourceAddress.length == RAIL_IEEE802154_LongAddress &&
-             utilsSoftSrcMatchExtFindEntry((otExtAddress *)sourceAddress.longAddress) >= 0) ||
-            (sourceAddress.length == RAIL_IEEE802154_ShortAddress &&
-             utilsSoftSrcMatchShortFindEntry(sourceAddress.shortAddress) >= 0))
-        {
-            status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-            assert(status == RAIL_STATUS_NO_ERROR);
-            insertIeee802154DataRequestCommand(aRailHandle);
-        }
-    }
-    else
-    {
-        status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-        insertIeee802154DataRequestCommand(aRailHandle);
-    }
-}
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents)
-{
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    if (aEvents & RAIL_EVENT_CONFIG_SCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigScheduled++;
-    }
-    if (aEvents & RAIL_EVENT_CONFIG_UNSCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigUnScheduled++;
-    }
-#endif
-    if (aEvents & RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND)
-    {
-        ieee802154DataRequestCommand(aRailHandle);
-    }
-
-    if (aEvents & RAIL_EVENTS_TX_COMPLETION)
-    {
-        if (aEvents & RAIL_EVENT_TX_PACKET_SENT)
-        {
-            if ((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0)
-            {
-                RAIL_YieldRadio(aRailHandle);
-                sTransmitError = OT_ERROR_NONE;
-                sTransmitBusy  = false;
-            }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventPacketSent++;
-#endif
-        }
-        else if (aEvents & RAIL_EVENT_TX_CHANNEL_BUSY)
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventChannelBusy++;
-#endif
-        }
-        else
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventTxAbort++;
-#endif
-        }
-    }
-
-    if (aEvents & RAIL_EVENT_RX_ACK_TIMEOUT)
-    {
-        RAIL_YieldRadio(aRailHandle);
-        sTransmitError = OT_ERROR_NO_ACK;
-        sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventNoAck++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RX_PACKET_RECEIVED)
-    {
-        RAIL_HoldRxPacket(aRailHandle);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventPacketReceived++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_CAL_NEEDED)
-    {
-        RAIL_Status_t status;
-
-        status = RAIL_Calibrate(aRailHandle, NULL, RAIL_CAL_ALL_PENDING);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventCalNeeded++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RSSI_AVERAGE_DONE)
-    {
-        const int16_t energyScanResultQuarterDbm = RAIL_GetAverageRssi(aRailHandle);
-        RAIL_YieldRadio(aRailHandle);
-
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_COMPLETED;
-
-        if (energyScanResultQuarterDbm == RAIL_RSSI_INVALID)
-        {
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-        else
-        {
-            sEnergyScanResultDbm = energyScanResultQuarterDbm / QUARTER_DBM_IN_DBM;
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioEnergyScanDoneCbCount++;
-#endif
-    }
-    if (aEvents & RAIL_EVENT_SCHEDULER_STATUS)
-    {
-        RAIL_SchedulerStatus_t status = RAIL_GetSchedulerStatus(aRailHandle);
-
-        assert(status != RAIL_SCHEDULER_STATUS_INTERNAL_ERROR);
-
-        if (status == RAIL_SCHEDULER_STATUS_CCA_CSMA_TX_FAIL || status == RAIL_SCHEDULER_STATUS_SINGLE_TX_FAIL ||
-            status == RAIL_SCHEDULER_STATUS_SCHEDULED_TX_FAIL ||
-            (status == RAIL_SCHEDULER_STATUS_SCHEDULE_FAIL && sTransmitBusy) ||
-            (status == RAIL_SCHEDULER_STATUS_EVENT_INTERRUPTED && sTransmitBusy))
-        {
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventSchedulerStatusError++;
-#endif
-        }
-        else if (status == RAIL_SCHEDULER_STATUS_AVERAGE_RSSI_FAIL)
-        {
-            sEnergyScanStatus    = ENERGY_SCAN_STATUS_COMPLETED;
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        else if (sTransmitBusy)
-        {
-            sRailDebugCounters.mRailEventsSchedulerStatusLastStatus = status;
-            sRailDebugCounters.mRailEventsSchedulerStatusTransmitBusy++;
-        }
-#endif
-    }
-
-    otSysEventSignalPending();
-}
-
-otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return efr32StartEnergyScan(ENERGY_SCAN_MODE_ASYNC, aScanChannel, (RAIL_Time_t)aScanDuration * US_IN_MS);
-}
-
-void efr32RadioProcess(otInstance *aInstance)
-{
-    // We should process the received packet first. Adding it at the end of this function,
-    // will delay the stack notification until the next call to efr32RadioProcess()
-    processNextRxPacket(aInstance);
-
-    if (sState == OT_RADIO_STATE_TRANSMIT && sTransmitBusy == false)
-    {
-        if (sTransmitError != OT_ERROR_NONE)
-        {
-            otLogDebgPlat("Transmit failed ErrorCode=%d", sTransmitError);
-        }
-
-        sState = OT_RADIO_STATE_RECEIVE;
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioTransmitDone(aInstance, &sTransmitFrame, sTransmitError);
-        }
-        else
-#endif
-            if (((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) || (sTransmitError != OT_ERROR_NONE))
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, sTransmitError);
-        }
-        else
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, &sReceiveFrame, sTransmitError);
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioTxDoneCbCount++;
-#endif
-
-        otSysEventSignalPending();
-    }
-    else if (sEnergyScanMode == ENERGY_SCAN_MODE_ASYNC && sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-        otPlatRadioEnergyScanDone(aInstance, sEnergyScanResultDbm);
-        otSysEventSignalPending();
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventEnergyScanCompleted++;
-#endif
-    }
-}
-
-otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
-    *aPower = sTxPowerDbm;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPower) * 10);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sTxPowerDbm = aPower;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-    otEXPECT_ACTION(aThreshold != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    *aThreshold = sCcaThresholdDbm;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sCcaThresholdDbm = aThreshold;
-
-    return OT_ERROR_NONE;
-}
-
-int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return EFR32_RECEIVE_SENSITIVITY;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/rail_config.h b/third_party/openthread/repo/examples/platforms/efr32mg12/rail_config.h
deleted file mode 100644 (file)
index 5a62825..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __RAIL_CONFIG_H__
-#define __RAIL_CONFIG_H__
-
-#include "board_config.h"
-#include "rail_types.h"
-#include <stdint.h>
-
-#define RADIO_CONFIG_XTAL_FREQUENCY 38400000UL
-
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-extern const RAIL_ChannelConfig_t *channelConfigs[];
-#endif
-
-#endif // __RAIL_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/Makefile.am
deleted file mode 100644 (file)
index 9be5713..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-
-# Always package (e.g. for 'make dist') these subdirectories.
-
-DIST_SUBDIRS                            = \
-    sleepy-demo-mtd                       \
-    sleepy-demo-ftd                       \
-    $(NULL)
-
-# Always build (e.g. for 'make all') these subdirectories.
-
-SUBDIRS                                 = \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-SUBDIRS                                += sleepy-demo-mtd sleepy-demo-ftd
-endif
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/README.md b/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/README.md
deleted file mode 100644 (file)
index f386466..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# EFR32MG12 Sleepy Demo Example
-
-The EFR32 Sleepy applications demonstrates Sleepy End Device behavior using the EFR32's low power EM2 mode. The steps below will take you through the process of building and running the demo
-
-For setting up the build environment refer to [examples/platforms/efr32mg12/README.md](../README.md).
-
-## 1. Build
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-$ make -f examples/Makefile-efr32mg12 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BOARD=BRD4161A
-```
-
-Convert the resulting executables into S-Record format and append a s37 suffix.
-
-```bash
-$ cd output/efr32mg12/bin
-$ arm-none-eabi-objcopy -O srec sleepy-demo-mtd sleepy-demo-mtd.s37
-$ arm-none-eabi-objcopy -O srec sleepy-demo-ftd sleepy-demo-ftd.s37
-```
-
-In Silicon Labs Simplicity Studio flash one device with the sleepy-demo-mtd.s37 image and the other device with the sleepy-demo-ftd.s37 image.
-
-For instructions on flashing firmware see [examples/platforms/efr32mg12/README.md](../README.md#flash-binaries)
-
-## 2. Starting nodes
-
-For demonstration purposes the network settings are hardcoded within the source files. The devices start Thread and form a network within a few seconds of powering on. In a real-life application the devices should implement and go through a commissioning process to create a network and add devices.
-
-When the sleepy-demo-ftd device is started in the CLI the user shall see:
-
-```
-sleepy-demo-ftd started
-sleepy-demo-ftd changed to leader
-```
-
-When the sleepy-demo-mtd device starts it joins the pre-configured Thread network before disabling Rx-On-Idle to become a Sleepy-End-Device.
-
-Use the command "child table" in the FTD console and observe the R flag of the child is 0.
-
-```
-> child table
-| ID  | RLOC16 | Timeout    | Age        | LQ In | C_VN |R|S|D|N| Extended MAC     |
-+-----+--------+------------+------------+-------+------+-+-+-+-+------------------+
-|   1 | 0x8401 |        240 |          3 |     3 |    3 |0|1|0|0| 8e8582dbd78c243c |
-
-Done
-```
-
-## 3. Buttons on the MTD
-
-Pressing button 0 on the MTD toggles between operating as a Minimal End Device (MED) and a Sleepy End Device (SED) with the RX off when idle.
-
-Pressing button 1 on the MTD sends a multicast UDP message containing the string "mtd button". The FTD listens on the multicast address and will toggle LED 0 and display a message in the CLI showing "Message Received: mtd button".
-
-## 4. Buttons on the FTD
-
-Pressing either button 0 or 1 on the FTD will send a UDP message to the FTD containing the string "ftd button". The MTD must first send a multicast message by pressing the MTD's button 1 so that the FTD knows the address of the MTD to send messages to.
-
-This will toggle the state of LED0 on the MTD. If the MTD is operating as a sleepy end device then the MTD polls the parent every 5 seconds for messages and will update the LED state on the next poll.
-
-## 5. Monitoring power consumption of the MTD
-
-Open the Energy Profiler within Silicon Labs Simplicity Studio. Within the Quick Access menu select Start Energy Capture... and select the MTD device. When operating as a Sleepy End Device with no LEDs on the current should be under 20 microamps with occasional spikes during waking and polling the parent. With the LED on the MTD has a current consumption of approximately 1mA.
-
-When operating as a Minimal End Device with the Rx on Idle observe that the current is in the order of 10ma.
-
-With further configuration of GPIOs and peripherals it is possible to reduce the sleepy current consumption further.
-
-## 6. Notes on sleeping, sleepy callback and interrupts
-
-To allow the EFR32 to enter sleepy mode the application must register a callback with efr32SetSleepCallback. The return value of callback is used to indicate that the application has no further work to do and that it is safe to go into a low power mode. The callback is called with interrupts disabled so should do the minimum required to check if it can sleep.
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/Makefile.am
deleted file mode 100644 (file)
index 2443898..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-include $(top_srcdir)/examples/platforms/Makefile.platform.am
-
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-$(top_builddir)/examples/platforms/efr32mg12/libopenthread-efr32mg12.a:
-       (cd $(top_builddir)/examples/platforms/efr32mg12/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg12.a )
-
-bin_PROGRAMS                                                                  = \
-    $(NULL)
-
-CPPFLAGS_COMMON                                                              += \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -Wno-sign-compare                                                           \
-    -DCORTEXM3                                                                  \
-    -DPHY=EMBER_PHY_RAIL                                                        \
-    -DMICRO=EMBER_MICRO_CORTEXM3_EFR32                                          \
-    -DCORTEXM3_EFM32_MICRO                                                      \
-    -DPLAT=EMBER_PLATFORM_CORTEXM3                                              \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg12/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG12_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG12P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-LDADD_COMMON                                                                 += \
-    $(NULL)
-
-LDFLAGS_COMMON                                                               += \
-    $(NULL)
-
-LIBTOOLFLAGS_COMMON                                                          += \
-    $(NULL)
-
-SOURCES_COMMON                                                               += \
-    main.c                                                                      \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-LDADD_COMMON                                                                 += \
-    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                         \
-    $(NULL)
-endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-bin_PROGRAMS                                                                 += \
-    sleepy-demo-ftd                                                             \
-    $(NULL)
-endif
-
-sleepy_demo_ftd_CPPFLAGS                                                      = \
-    $(CPPFLAGS_COMMON)                                                          \
-    $(NULL)
-
-sleepy_demo_ftd_LDADD                                                         = \
-    $(top_builddir)/src/cli/libopenthread-cli-ftd.a                             \
-    $(top_builddir)/src/core/libopenthread-ftd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(top_builddir)/src/core/libopenthread-ftd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(NULL)
-
-sleepy_demo_ftd_LDFLAGS                                                       = \
-    $(LDFLAGS_COMMON)                                                           \
-    $(NULL)
-
-sleepy_demo_ftd_LIBTOOLFLAGS                                                  = \
-    $(LIBTOOLFLAGS_COMMON)                                                      \
-    $(NULL)
-
-sleepy_demo_ftd_SOURCES                                                       = \
-    $(SOURCES_COMMON)                                                           \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_LINKER_MAP
-sleepy_demo_ftd_LDFLAGS += -Wl,-Map=sleepy-demo-ftd.map
-endif
-
-if OPENTHREAD_BUILD_COVERAGE
-CPPFLAGS_COMMON                                                              += \
-    -DOPENTHREAD_ENABLE_COVERAGE                                                \
-    $(NULL)
-
-CLEANFILES = $(wildcard *.gcda *.gcno)
-endif # OPENTHREAD_BUILD_COVERAGE
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/main.c b/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/main.c
deleted file mode 100644 (file)
index 7a489b1..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "bsp.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "gpiointerrupt.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "openthread-system.h"
-#include <assert.h>
-#include <common/logging.hpp>
-#include <openthread-core-config.h>
-#include <string.h>
-#include <openthread/cli.h>
-#include <openthread/config.h>
-#include <openthread/dataset_ftd.h>
-#include <openthread/diag.h>
-#include <openthread/instance.h>
-#include <openthread/message.h>
-#include <openthread/tasklet.h>
-#include <openthread/thread.h>
-#include <openthread/udp.h>
-#include <openthread/platform/logging.h>
-
-// Constants
-#define MULTICAST_ADDR "ff03::1"
-#define MULTICAST_PORT 123
-#define RECV_PORT 234
-#define MTD_MESSAGE "mtd button"
-#define FTD_MESSAGE "ftd button"
-
-// Types
-typedef struct ButtonArray
-{
-    GPIO_Port_TypeDef port;
-    unsigned int      pin;
-} ButtonArray_t;
-
-// Prototypes
-void setNetworkConfiguration(otInstance *aInstance);
-void handleNetifStateChanged(uint32_t aFlags, void *aContext);
-void gpioInit(void (*gpioCallback)(uint8_t pin));
-void buttonCallback(uint8_t pin);
-void initUdp(void);
-void applicationTick(void);
-void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
-
-// Variables
-static otInstance *        instance;
-static otUdpSocket         sFtdSocket;
-static bool                sLedOn             = false;
-static bool                sHaveSwitchAddress = false;
-static otIp6Address        sSwitchAddress;
-static bool                sFtdButtonPressed              = false;
-static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
-
-void otTaskletsSignalPending(otInstance *aInstance)
-{
-    (void)aInstance;
-}
-
-int main(int argc, char *argv[])
-{
-    otSysInit(argc, argv);
-    gpioInit(buttonCallback);
-
-    instance = otInstanceInitSingle();
-    assert(instance);
-
-    otCliUartInit(instance);
-    otCliOutputFormat("sleepy-demo-ftd started\r\n");
-
-    setNetworkConfiguration(instance);
-    otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
-    initUdp();
-
-    otIp6SetEnabled(instance, true);
-    otThreadSetEnabled(instance, true);
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-        applicationTick();
-    }
-
-    otInstanceFinalize(instance);
-    return 0;
-}
-
-/*
- * Provide, if required an "otPlatLog()" function
- */
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-    OT_UNUSED_VARIABLE(aFormat);
-
-    va_list ap;
-    va_start(ap, aFormat);
-    otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
-    va_end(ap);
-}
-#endif
-
-/**
- * Override default network settings, such as panid, so the devices can join a network
- */
-void setNetworkConfiguration(otInstance *aInstance)
-{
-    static char          aNetworkName[] = "SleepyEFR32";
-    otOperationalDataset aDataset;
-
-    memset(&aDataset, 0, sizeof(otOperationalDataset));
-
-    /*
-     * Fields that can be configured in otOperationDataset to override defaults:
-     *     Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
-     *     Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
-     */
-    aDataset.mActiveTimestamp                      = 1;
-    aDataset.mComponents.mIsActiveTimestampPresent = true;
-
-    /* Set Channel to 15 */
-    aDataset.mChannel                      = 15;
-    aDataset.mComponents.mIsChannelPresent = true;
-
-    /* Set Pan ID to 2222 */
-    aDataset.mPanId                      = (otPanId)0x2222;
-    aDataset.mComponents.mIsPanIdPresent = true;
-
-    /* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
-    uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
-    aDataset.mComponents.mIsExtendedPanIdPresent = true;
-
-    /* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
-    uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
-    aDataset.mComponents.mIsMasterKeyPresent = true;
-
-    /* Set Network Name to SleepyEFR32 */
-    size_t length = strlen(aNetworkName);
-    assert(length <= OT_NETWORK_NAME_MAX_SIZE);
-    memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
-    aDataset.mComponents.mIsNetworkNamePresent = true;
-
-    otDatasetSetActive(aInstance, &aDataset);
-}
-
-void handleNetifStateChanged(uint32_t aFlags, void *aContext)
-{
-    if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
-    {
-        otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
-
-        switch (changedRole)
-        {
-        case OT_DEVICE_ROLE_LEADER:
-            otCliOutputFormat("sleepy-demo-ftd changed to leader\r\n");
-            break;
-        case OT_DEVICE_ROLE_ROUTER:
-            otCliOutputFormat("sleepy-demo-ftd changed to router\r\n");
-            break;
-
-        case OT_DEVICE_ROLE_CHILD:
-            break;
-
-        case OT_DEVICE_ROLE_DETACHED:
-        case OT_DEVICE_ROLE_DISABLED:
-            break;
-        }
-    }
-}
-
-void gpioInit(void (*callback)(uint8_t pin))
-{
-    // set up button GPIOs to input with pullups
-    for (int i = 0; i < BSP_BUTTON_COUNT; i++)
-    {
-        GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
-    }
-    // set up interrupt based callback function on falling edge
-    GPIOINT_Init();
-    GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
-    GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
-    GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
-    GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
-
-    BSP_LedsInit();
-    BSP_LedClear(0);
-    BSP_LedClear(1);
-}
-
-void initUdp(void)
-{
-    otError    error;
-    otSockAddr sockaddr;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-
-    otIp6AddressFromString(MULTICAST_ADDR, &sockaddr.mAddress);
-    sockaddr.mPort = MULTICAST_PORT;
-
-    error = otUdpOpen(instance, &sFtdSocket, sFtdReceiveCallback, NULL);
-    if (error != OT_ERROR_NONE)
-    {
-        otCliOutputFormat("FTD failed to open udp multicast\r\n");
-        return;
-    }
-
-    error = otUdpBind(instance, &sFtdSocket, &sockaddr);
-    if (error != OT_ERROR_NONE)
-    {
-        otUdpClose(instance, &sFtdSocket);
-        otCliOutputFormat("FTD failed to bind udp multicast\r\n");
-        return;
-    }
-}
-
-void buttonCallback(uint8_t pin)
-{
-    OT_UNUSED_VARIABLE(pin);
-    sFtdButtonPressed = true;
-}
-
-void applicationTick(void)
-{
-    otError       error = 0;
-    otMessageInfo messageInfo;
-    otMessage *   message = NULL;
-    char *        payload = FTD_MESSAGE;
-
-    if (sFtdButtonPressed == true)
-    {
-        sFtdButtonPressed = false;
-
-        if (sHaveSwitchAddress)
-        {
-            memset(&messageInfo, 0, sizeof(messageInfo));
-            memcpy(&messageInfo.mPeerAddr, &sSwitchAddress, sizeof messageInfo.mPeerAddr);
-            messageInfo.mPeerPort = RECV_PORT;
-
-            message = otUdpNewMessage(instance, NULL);
-
-            if (message != NULL)
-            {
-                error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
-
-                if (error == OT_ERROR_NONE)
-                {
-                    error = otUdpSend(instance, &sFtdSocket, message, &messageInfo);
-
-                    if (error == OT_ERROR_NONE)
-                    {
-                        return;
-                    }
-                }
-            }
-
-            if (message != NULL)
-            {
-                otMessageFree(message);
-            }
-        }
-    }
-}
-
-void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aMessage);
-    OT_UNUSED_VARIABLE(aMessageInfo);
-    uint8_t buf[1500];
-    int     length;
-
-    sLedOn = !sLedOn;
-
-    if (sLedOn)
-    {
-        BSP_LedSet(0);
-    }
-    else
-    {
-        BSP_LedClear(0);
-    }
-
-    length      = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
-    buf[length] = '\0';
-    otCliOutputFormat("Message Received: %s\r\n", buf);
-
-    sHaveSwitchAddress = true;
-    memcpy(&sSwitchAddress, &aMessageInfo->mPeerAddr, sizeof sSwitchAddress);
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/Makefile.am
deleted file mode 100644 (file)
index c72759b..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-include $(top_srcdir)/examples/platforms/Makefile.platform.am
-
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-$(top_builddir)/examples/platforms/efr32mg12/libopenthread-efr32mg12.a:
-       (cd $(top_builddir)/examples/platforms/efr32mg12/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg12.a )
-
-bin_PROGRAMS                                                                  = \
-    $(NULL)
-
-CPPFLAGS_COMMON                                                              += \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -Wno-sign-compare                                                           \
-    -DCORTEXM3                                                                  \
-    -DPHY=EMBER_PHY_RAIL                                                        \
-    -DMICRO=EMBER_MICRO_CORTEXM3_EFR32                                          \
-    -DCORTEXM3_EFM32_MICRO                                                      \
-    -DPLAT=EMBER_PLATFORM_CORTEXM3                                              \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg12/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG12_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG12P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-LDADD_COMMON                                                                 += \
-    $(NULL)
-
-LDFLAGS_COMMON                                                               += \
-    $(NULL)
-
-LIBTOOLFLAGS_COMMON                                                          += \
-    $(NULL)
-
-SOURCES_COMMON                                                               += \
-    main.c                                                                      \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-LDADD_COMMON                                                                 += \
-    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                         \
-    $(NULL)
-endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-bin_PROGRAMS                                                                 += \
-    sleepy-demo-mtd                                                             \
-    $(NULL)
-endif
-
-sleepy_demo_mtd_CPPFLAGS                                                      = \
-    $(CPPFLAGS_COMMON)                                                          \
-    $(NULL)
-
-sleepy_demo_mtd_LDADD                                                         = \
-    $(top_builddir)/src/cli/libopenthread-cli-mtd.a                             \
-    $(top_builddir)/src/core/libopenthread-mtd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(top_builddir)/src/core/libopenthread-mtd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(NULL)
-
-sleepy_demo_mtd_LDFLAGS                                                       = \
-    $(LDFLAGS_COMMON)                                                           \
-    $(NULL)
-
-sleepy_demo_mtd_LIBTOOLFLAGS                                                  = \
-    $(LIBTOOLFLAGS_COMMON)                                                      \
-    $(NULL)
-
-sleepy_demo_mtd_SOURCES                                                       = \
-    $(SOURCES_COMMON)                                                           \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_LINKER_MAP
-sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
-endif
-
-if OPENTHREAD_BUILD_COVERAGE
-CPPFLAGS_COMMON                                                              += \
-    -DOPENTHREAD_ENABLE_COVERAGE                                                \
-    $(NULL)
-
-CLEANFILES = $(wildcard *.gcda *.gcno)
-endif # OPENTHREAD_BUILD_COVERAGE
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/main.c b/third_party/openthread/repo/examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/main.c
deleted file mode 100644 (file)
index b1d34a3..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <string.h>
-
-#include "bsp.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "gpiointerrupt.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "openthread-system.h"
-#include "platform-efr32.h"
-#include <common/logging.hpp>
-#include <openthread-core-config.h>
-#include <openthread/cli.h>
-#include <openthread/config.h>
-#include <openthread/dataset_ftd.h>
-#include <openthread/diag.h>
-#include <openthread/instance.h>
-#include <openthread/link.h>
-#include <openthread/message.h>
-#include <openthread/tasklet.h>
-#include <openthread/thread.h>
-#include <openthread/udp.h>
-#include <openthread/platform/logging.h>
-
-// Constants
-#define MULTICAST_ADDR "ff03::1"
-#define MULTICAST_PORT 123
-#define RECV_PORT 234
-#define SLEEPY_POLL_PERIOD_MS 5000
-#define MTD_MESSAGE "mtd button"
-#define FTD_MESSAGE "ftd button"
-
-// Types
-typedef struct ButtonArray
-{
-    GPIO_Port_TypeDef port;
-    unsigned int      pin;
-} ButtonArray_t;
-
-// Prototypes
-bool sleepCb(void);
-void setNetworkConfiguration(otInstance *aInstance);
-void handleNetifStateChanged(uint32_t aFlags, void *aContext);
-void gpioInit(void (*gpioCallback)(uint8_t pin));
-void buttonCallback(uint8_t pin);
-void initUdp(void);
-void applicationTick(void);
-void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
-
-// Variables
-static otInstance *        instance;
-static otUdpSocket         sMtdSocket;
-static otSockAddr          sMulticastSockAddr;
-static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
-static bool                sButtonPressed                 = false;
-static bool                sRxOnIdleButtonPressed         = false;
-static bool                sLedOn                         = false;
-static bool                sAllowDeepSleep                = false;
-static bool                sTaskletsPendingSem            = true;
-
-int main(int argc, char *argv[])
-{
-    otLinkModeConfig config;
-
-    otSysInit(argc, argv);
-    gpioInit(buttonCallback);
-
-    instance = otInstanceInitSingle();
-    assert(instance);
-
-    otCliUartInit(instance);
-
-    otLinkSetPollPeriod(instance, SLEEPY_POLL_PERIOD_MS);
-    setNetworkConfiguration(instance);
-    otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
-
-    config.mRxOnWhenIdle       = true;
-    config.mSecureDataRequests = true;
-    config.mDeviceType         = 0;
-    config.mNetworkData        = 0;
-    otThreadSetLinkMode(instance, config);
-
-    initUdp();
-    otIp6SetEnabled(instance, true);
-    otThreadSetEnabled(instance, true);
-    efr32SetSleepCallback(sleepCb);
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-
-        applicationTick();
-
-        // Put the EFR32 into deep sleep if callback sleepCb permits.
-        efr32Sleep();
-    }
-
-    otInstanceFinalize(instance);
-    return 0;
-}
-
-/*
- * Callback from efr32Sleep to indicate if it is ok to go into sleep mode.
- * This runs with interrupts disabled.
- */
-bool sleepCb(void)
-{
-    bool allow;
-    allow               = (sAllowDeepSleep && !sTaskletsPendingSem);
-    sTaskletsPendingSem = false;
-    return allow;
-}
-
-void otTaskletsSignalPending(otInstance *aInstance)
-{
-    (void)aInstance;
-    sTaskletsPendingSem = true;
-}
-
-/*
- * Override default network settings, such as panid, so the devices can join a network
- */
-void setNetworkConfiguration(otInstance *aInstance)
-{
-    static char          aNetworkName[] = "SleepyEFR32";
-    otOperationalDataset aDataset;
-
-    memset(&aDataset, 0, sizeof(otOperationalDataset));
-
-    /*
-     * Fields that can be configured in otOperationDataset to override defaults:
-     *     Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
-     *     Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
-     */
-    aDataset.mActiveTimestamp                      = 1;
-    aDataset.mComponents.mIsActiveTimestampPresent = true;
-
-    /* Set Channel to 15 */
-    aDataset.mChannel                      = 15;
-    aDataset.mComponents.mIsChannelPresent = true;
-
-    /* Set Pan ID to 2222 */
-    aDataset.mPanId                      = (otPanId)0x2222;
-    aDataset.mComponents.mIsPanIdPresent = true;
-
-    /* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
-    uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
-    aDataset.mComponents.mIsExtendedPanIdPresent = true;
-
-    /* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
-    uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
-    aDataset.mComponents.mIsMasterKeyPresent = true;
-
-    /* Set Network Name to SleepyEFR32 */
-    size_t length = strlen(aNetworkName);
-    assert(length <= OT_NETWORK_NAME_MAX_SIZE);
-    memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
-    aDataset.mComponents.mIsNetworkNamePresent = true;
-
-    otDatasetSetActive(aInstance, &aDataset);
-}
-
-void handleNetifStateChanged(uint32_t aFlags, void *aContext)
-{
-    otLinkModeConfig config;
-
-    if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
-    {
-        otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
-
-        switch (changedRole)
-        {
-        case OT_DEVICE_ROLE_LEADER:
-        case OT_DEVICE_ROLE_ROUTER:
-            break;
-
-        case OT_DEVICE_ROLE_CHILD:
-            config.mRxOnWhenIdle       = 0;
-            config.mSecureDataRequests = true;
-            config.mDeviceType         = 0;
-            config.mNetworkData        = 0;
-            otThreadSetLinkMode(instance, config);
-            sAllowDeepSleep = true;
-            break;
-
-        case OT_DEVICE_ROLE_DETACHED:
-        case OT_DEVICE_ROLE_DISABLED:
-            break;
-        }
-    }
-}
-
-/*
- * Provide, if required an "otPlatLog()" function
- */
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-    OT_UNUSED_VARIABLE(aFormat);
-
-    va_list ap;
-    va_start(ap, aFormat);
-    otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
-    va_end(ap);
-}
-#endif
-
-void gpioInit(void (*callback)(uint8_t pin))
-{
-    // set up button GPIOs to input with pullups
-    for (int i = 0; i < BSP_BUTTON_COUNT; i++)
-    {
-        GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
-    }
-    // set up interrupt based callback function on falling edge
-    GPIOINT_Init();
-    GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
-    GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
-    GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
-    GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
-
-    BSP_LedsInit();
-    BSP_LedClear(0);
-    BSP_LedClear(1);
-}
-
-void initUdp(void)
-{
-    otError    error;
-    otSockAddr sockaddr;
-
-    memset(&sMulticastSockAddr, 0, sizeof sMulticastSockAddr);
-    otIp6AddressFromString(MULTICAST_ADDR, &sMulticastSockAddr.mAddress);
-    sMulticastSockAddr.mPort = MULTICAST_PORT;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-    sockaddr.mPort = RECV_PORT;
-
-    error = otUdpOpen(instance, &sMtdSocket, mtdReceiveCallback, NULL);
-
-    if (error != OT_ERROR_NONE)
-    {
-        return;
-    }
-
-    error = otUdpBind(instance, &sMtdSocket, &sockaddr);
-
-    if (error != OT_ERROR_NONE)
-    {
-        otUdpClose(instance, &sMtdSocket);
-        return;
-    }
-}
-
-void buttonCallback(uint8_t pin)
-{
-    if ((pin & 0x01) == 0x01)
-    {
-        sButtonPressed = true;
-    }
-    else if ((pin & 0x01) == 0x00)
-    {
-        sRxOnIdleButtonPressed = true;
-    }
-}
-
-void applicationTick(void)
-{
-    otError          error = 0;
-    otMessageInfo    messageInfo;
-    otMessage *      message = NULL;
-    char *           payload = MTD_MESSAGE;
-    otLinkModeConfig config;
-
-    if (sRxOnIdleButtonPressed == true)
-    {
-        sRxOnIdleButtonPressed     = false;
-        sAllowDeepSleep            = !sAllowDeepSleep;
-        config.mRxOnWhenIdle       = !sAllowDeepSleep;
-        config.mSecureDataRequests = true;
-        config.mDeviceType         = 0;
-        config.mNetworkData        = 0;
-        otThreadSetLinkMode(instance, config);
-    }
-
-    if (sButtonPressed == true)
-    {
-        sButtonPressed = false;
-
-        memset(&messageInfo, 0, sizeof(messageInfo));
-        memcpy(&messageInfo.mPeerAddr, &sMulticastSockAddr.mAddress, sizeof messageInfo.mPeerAddr);
-        messageInfo.mPeerPort = sMulticastSockAddr.mPort;
-
-        message = otUdpNewMessage(instance, NULL);
-
-        if (message != NULL)
-        {
-            error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
-
-            if (error == OT_ERROR_NONE)
-            {
-                error = otUdpSend(instance, &sMtdSocket, message, &messageInfo);
-
-                if (error == OT_ERROR_NONE)
-                {
-                    return;
-                }
-            }
-        }
-
-        if (message != NULL)
-        {
-            otMessageFree(message);
-        }
-    }
-}
-
-void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aMessage);
-    OT_UNUSED_VARIABLE(aMessageInfo);
-    uint8_t buf[1500];
-    int     length;
-
-    length      = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
-    buf[length] = '\0';
-
-    if (strcmp((char *)buf, FTD_MESSAGE) == 0)
-    {
-        sLedOn = !sLedOn;
-
-        if (sLedOn)
-        {
-            BSP_LedSet(0);
-        }
-        else
-        {
-            BSP_LedClear(0);
-        }
-    }
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/startup-gcc.c b/third_party/openthread/repo/examples/platforms/efr32mg12/startup-gcc.c
deleted file mode 100644 (file)
index 85c9e2a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements gcc-specific startup code for the efr32.
- */
-
-__extension__ typedef int __guard __attribute__((mode(__DI__)));
-
-int __cxa_guard_acquire(__guard *g)
-{
-    return !*(char *)(g);
-}
-
-void __cxa_guard_release(__guard *g)
-{
-    *(char *)g = 1;
-}
-
-void __cxa_guard_abort(__guard *g)
-{
-    (void)g;
-}
-
-void __cxa_pure_virtual(void)
-{
-    while (1)
-        ;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/system.c b/third_party/openthread/repo/examples/platforms/efr32mg12/system.c
deleted file mode 100644 (file)
index 2b5087b..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief
- *   This file includes the platform-specific initializers.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-#include <string.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "common/logging.hpp"
-
-#include "bsp.h"
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_emu.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "rail.h"
-#include "sl_mpu.h"
-#include "sl_sleeptimer.h"
-
-#include "platform-efr32.h"
-
-#if (HAL_FEM_ENABLE)
-#include "fem-control.h"
-#endif
-
-#define USE_EFR32_LOG (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-
-void halInitChipSpecific(void);
-
-otInstance *sInstance;
-static bool (*sCanSleepCallback)(void);
-
-void otSysInit(int argc, char *argv[])
-{
-    OT_UNUSED_VARIABLE(argc);
-    OT_UNUSED_VARIABLE(argv);
-    sl_status_t status;
-
-    __disable_irq();
-
-#undef FIXED_EXCEPTION
-#define FIXED_EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler)
-#define EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler, priorityLevel, subpriority) \
-    NVIC_SetPriority(deviceIrqn, NVIC_EncodePriority(PRIGROUP_POSITION, priorityLevel, subpriority));
-#include NVIC_CONFIG
-#undef EXCEPTION
-
-    NVIC_SetPriorityGrouping(PRIGROUP_POSITION);
-    CHIP_Init();
-    halInitChipSpecific();
-    BSP_Init(BSP_INIT_BCC);
-
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFRCO);
-    CMU_ClockEnable(cmuClock_CORELE, true);
-    CMU_ClockEnable(cmuClock_RTCC, true);
-    status = sl_sleeptimer_init();
-    assert(status == SL_STATUS_OK);
-
-#if (HAL_FEM_ENABLE)
-    initFem();
-    wakeupFem();
-#endif
-
-    __enable_irq();
-
-#if USE_EFR32_LOG
-    efr32LogInit();
-#endif
-    efr32RadioInit();
-    efr32AlarmInit();
-    efr32MiscInit();
-    efr32RandomInit();
-}
-
-bool otSysPseudoResetWasRequested(void)
-{
-    return false;
-}
-
-void otSysDeinit(void)
-{
-    efr32RadioDeinit();
-
-#if USE_EFR32_LOG
-    efr32LogDeinit();
-#endif
-}
-
-void efr32SetSleepCallback(bool (*aCallback)(void))
-{
-    sCanSleepCallback = aCallback;
-}
-
-void efr32Sleep(void)
-{
-    bool canDeepSleep      = false;
-    int  wakeupProcessTime = 1000;
-    CORE_DECLARE_IRQ_STATE;
-
-    if (RAIL_Sleep(wakeupProcessTime, &canDeepSleep) == RAIL_STATUS_NO_ERROR)
-    {
-        if (canDeepSleep)
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM2(true);
-            }
-            CORE_EXIT_ATOMIC();
-            // TODO OT will handle an interrupt here and it mustn't call any RAIL APIs
-
-            while (RAIL_Wake(0) != RAIL_STATUS_NO_ERROR)
-            {
-            }
-        }
-        else
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM1();
-            }
-            CORE_EXIT_ATOMIC();
-        }
-    }
-}
-
-void otSysProcessDrivers(otInstance *aInstance)
-{
-    sInstance = aInstance;
-
-    // should sleep and wait for interrupts here
-
-    efr32UartProcess();
-    efr32RadioProcess(aInstance);
-    efr32AlarmProcess(aInstance);
-}
-
-__WEAK void otSysEventSignalPending(void)
-{
-    // Intentionally empty
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg12/uart.c b/third_party/openthread/repo/examples/platforms/efr32mg12/uart.c
deleted file mode 100644 (file)
index f93f75f..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for UART communication.
- *
- */
-
-#include <stddef.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "uartdrv.h"
-
-#include "hal-config.h"
-
-enum
-{
-    kReceiveFifoSize = 128,
-};
-
-#define USART_INIT                                                                               \
-    {                                                                                            \
-        USART0,                                               /* USART port */                   \
-            115200,                                           /* Baud rate */                    \
-            BSP_SERIAL_APP_TX_LOC,                            /* USART Tx pin location number */ \
-            BSP_SERIAL_APP_RX_LOC,                            /* USART Rx pin location number */ \
-            (USART_Stopbits_TypeDef)USART_FRAME_STOPBITS_ONE, /* Stop bits */                    \
-            (USART_Parity_TypeDef)USART_FRAME_PARITY_NONE,    /* Parity */                       \
-            (USART_OVS_TypeDef)USART_CTRL_OVS_X16,            /* Oversampling mode*/             \
-            false,                                            /* Majority vote disable */        \
-            HAL_SERIAL_APP_FLOW_CONTROL,                      /* Flow control */                 \
-            BSP_SERIAL_APP_CTS_PORT,                          /* CTS port number */              \
-            BSP_SERIAL_APP_CTS_PIN,                           /* CTS pin number */               \
-            BSP_SERIAL_APP_RTS_PORT,                          /* RTS port number */              \
-            BSP_SERIAL_APP_RTS_PIN,                           /* RTS pin number */               \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartRxQueue,      /* RX operation queue */           \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartTxQueue,      /* TX operation queue */           \
-            BSP_SERIAL_APP_CTS_LOC,                           /* CTS location */                 \
-            BSP_SERIAL_APP_RTS_LOC                            /* RTS location */                 \
-    }
-
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_RX_BUFS, sUartRxQueue);
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_TX_BUFS, sUartTxQueue);
-
-static UARTDRV_HandleData_t sUartHandleData;
-static UARTDRV_Handle_t     sUartHandle = &sUartHandleData;
-static uint8_t              sReceiveBuffer[2];
-static const uint8_t *      sTransmitBuffer = NULL;
-static volatile uint16_t    sTransmitLength = 0;
-
-typedef struct ReceiveFifo_t
-{
-    // The data buffer
-    uint8_t mBuffer[kReceiveFifoSize];
-    // The offset of the first item written to the list.
-    volatile uint16_t mHead;
-    // The offset of the next item to be written to the list.
-    volatile uint16_t mTail;
-} ReceiveFifo_t;
-
-static ReceiveFifo_t sReceiveFifo;
-
-static void processReceive(void);
-
-static void receiveDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    // We can only write if incrementing mTail doesn't equal mHead
-    if (sReceiveFifo.mHead != (sReceiveFifo.mTail + 1) % kReceiveFifoSize)
-    {
-        sReceiveFifo.mBuffer[sReceiveFifo.mTail] = aData[0];
-        sReceiveFifo.mTail                       = (sReceiveFifo.mTail + 1) % kReceiveFifoSize;
-    }
-
-    UARTDRV_Receive(aHandle, aData, 1, receiveDone);
-    otSysEventSignalPending();
-}
-
-static void transmitDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    sTransmitLength = 0;
-    otSysEventSignalPending();
-}
-
-static void processReceive(void)
-{
-    // Copy tail to prevent multiple reads
-    uint16_t tail = sReceiveFifo.mTail;
-
-    // If the data wraps around, process the first part
-    if (sReceiveFifo.mHead > tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, kReceiveFifoSize - sReceiveFifo.mHead);
-
-        // Reset the buffer mHead back to zero.
-        sReceiveFifo.mHead = 0;
-    }
-
-    // For any data remaining, process it
-    if (sReceiveFifo.mHead != tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, tail - sReceiveFifo.mHead);
-
-        // Set mHead to the local tail we have cached
-        sReceiveFifo.mHead = tail;
-    }
-}
-
-otError otPlatUartFlush(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-static void processTransmit(void)
-{
-    if (sTransmitBuffer != NULL && sTransmitLength == 0)
-    {
-        sTransmitBuffer = NULL;
-        otPlatUartSendDone();
-    }
-}
-
-otError otPlatUartEnable(void)
-{
-    UARTDRV_Init_t uartInit = USART_INIT;
-
-    sReceiveFifo.mHead = 0;
-    sReceiveFifo.mTail = 0;
-
-    UARTDRV_Init(sUartHandle, &uartInit);
-
-    for (uint8_t i = 0; i < sizeof(sReceiveBuffer); i++)
-    {
-        UARTDRV_Receive(sUartHandle, &sReceiveBuffer[i], sizeof(sReceiveBuffer[i]), receiveDone);
-    }
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatUartDisable(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(sTransmitBuffer == NULL, error = OT_ERROR_BUSY);
-
-    sTransmitBuffer = aBuf;
-    sTransmitLength = aBufLength;
-
-    UARTDRV_Transmit(sUartHandle, (uint8_t *)sTransmitBuffer, sTransmitLength, transmitDone);
-
-exit:
-    return error;
-}
-
-void efr32UartProcess(void)
-{
-    processReceive();
-    processTransmit();
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg13/Makefile.am
deleted file mode 100644 (file)
index 2a54b24..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-
-lib_LIBRARIES = libopenthread-efr32mg13.a
-
-# Do not enable -Wconversion for rail
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-# Do not enable -pedantic-errors for rail
-override CFLAGS   := $(filter-out -pedantic-errors,$(CFLAGS))
-override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
-
-# Do not enable -Wundef for rail
-override CFLAGS   := $(filter-out -Wundef,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-libopenthread_efr32mg13_a_CPPFLAGS                                            = \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -Wno-sign-compare                                                           \
-    -DCORTEXM3                                                                  \
-    -DPHY=EMBER_PHY_RAIL                                                        \
-    -DMICRO=EMBER_MICRO_CORTEXM3_EFR32                                          \
-    -DCORTEXM3_EFM32_MICRO                                                      \
-    -DPLAT=EMBER_PLATFORM_CORTEXM3                                              \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg13/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)                                                            \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG13_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG13P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/inc                                    \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/config                                 \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-PLATFORM_SOURCES                                                              = \
-    alarm.c                                                                     \
-    diag.c                                                                      \
-    entropy.c                                                                   \
-    fem-control.c                                                               \
-    flash.c                                                                     \
-    logging.c                                                                   \
-    misc.c                                                                      \
-    openthread-core-efr32-config.h                                              \
-    openthread-core-efr32-config-check.h                                        \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    radio.c                                                                     \
-    rail_config.h                                                               \
-    startup-gcc.c                                                               \
-    system.c                                                                    \
-    uart.c                                                                      \
-    $(NULL)
-
-noinst_HEADERS                                                                = \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    $(NULL)
-
-libopenthread_efr32mg13_a_SOURCES                                             = \
-    $(PLATFORM_SOURCES)                                                         \
-    $(NULL)
-
-Dash = -
-libopenthread_efr32mg13_a_LIBADD                                                                     = \
-    $(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")             \
-    $(shell find $(top_builddir)/third_party/jlink/SEGGER_RTT_V640/RTT $(Dash)type f $(Dash)name "*.o")
-
-DIST_SUBDIRS                                                                  = \
-    sleepy-demo                                                                 \
-    $(NULL)
-
-SUBDIRS                                                                       = \
-    sleepy-demo                                                                 \
-    $(NULL)
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/Makefile.platform.am b/third_party/openthread/repo/examples/platforms/efr32mg13/Makefile.platform.am
deleted file mode 100644 (file)
index 5addd35..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# efr32mg13 platform-specific Makefile
-#
-
-LIBRAIL = $(shell                                                                \
-if [ "$(DMP)" = "1" ]; then                                                      \
-    echo "librail_multiprotocol_efr32xg13_gcc_release.a";                        \
-else                                                                             \
-    echo "librail_efr32xg13_gcc_release.a";                                      \
-fi )
-
-LDADD_COMMON                                                                  += \
-    $(top_builddir)/examples/platforms/efr32mg13/libopenthread-efr32mg13.a       \
-    $(top_builddir)/third_party/silabs/libsilabs-efr32mg13-sdk.a                 \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/autogen/librail_release/$(LIBRAIL) \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emdrv/nvm3/lib/libnvm3_CM4_gcc.a \
-    $(NULL)
-
-LDFLAGS_COMMON                                                                += \
-    -T $(top_srcdir)/examples/platforms/efr32mg13/efr32mg13.ld                   \
-    $(NULL)
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/README.md b/third_party/openthread/repo/examples/platforms/efr32mg13/README.md
deleted file mode 100644 (file)
index f44b1b1..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-# OpenThread on EFR32MG13 Example
-
-This directory contains example platform drivers for the [Silicon Labs EFR32MG13][efr32mg13] based on [EFR32™ Mighty Gecko Wireless Starter Kit][slwstk6000b].
-
-[efr32mg]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc
-[slwstk6000b]: http://www.silabs.com/products/development-tools/wireless/mesh-networking/mighty-gecko-starter-kit
-
-The example platform drivers are intended to present the minimal code necessary to support OpenThread. [EFR32MG13P SoC][efr32mg13p] has rich memory and peripheral resources which can support all OpenThread capabilities. See the "Run the example with EFR32MG13 boards" section below for an example using basic OpenThread capabilities.
-
-See [sleepy-demo/README.md](sleepy-demo/README.md) for instructions for an example that uses the low-energy modes of the EFR32MG13 when running as a Sleepy End Device.
-
-[efr32mg13p]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc/device.EFR32MG13P432F1024GL125
-
-## Toolchain
-
-Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
-
-[gnu-toolchain]: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
-
-In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
-
-```bash
-$ cd <path-to-openthread>
-$ ./script/bootstrap
-```
-
-## Build Examples
-
-1. Download and install the [Simplicity Studio][simplicity_studio].
-
-[simplicity_studio]: http://www.silabs.com/products/development-tools/software/simplicity-studio
-
-2. Install Flex (Gecko) SDK including RAIL Library from Simplicity Studio.
-   - Connect EFR32MG13P Wireless Starter Kit to Simplicity Studio.
-   - Find Flex SDK v2.7 in the Software Update page and click Install.
-   - Flex SDK v2.7 will be installed in the path: `/SimplicityStudio_v4/developer/sdks/gecko_sdk_suite`.
-
-For more information on configuring, building, and installing applications for the Wireless Gecko (EFR32) portfolio using FLEX, see [Getting Started with the Silicon Labs Flex Software Development Kit for the Wireless Gecko (EFR32™) Portfolio][qsg138]. For more information on RAIL, see [Radio Abstraction Interface Layer][rail].
-
-[qsg138]: https://www.silabs.com/documents/public/quick-start-guides/qsg138-flex-efr32.pdf
-[rail]: http://www.silabs.com/products/development-tools/software/radio-abstraction-interface-layer-sdk
-
-3. Configure the path to Flex SDK source code.
-
-```bash
-$ cd <path-to-openthread>/third_party
-$ mkdir silabs
-$ cd <path-to-Simplicity-Studio>/developer/sdks
-$ cp -rf gecko_sdk_suite <path-to-openthread>/third_party/silabs/
-```
-
-Alternatively create a symbolic link to the Flex SDK source code.
-
-```bash
-$ cd <path-to-openthread>/third_party
-$ mkdir silabs
-$ ln -s <path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite silabs/gecko_sdk_suite
-```
-
-4. Build OpenThread Firmware (CLI example) on EFR32 platform.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-```
-
-For EFR32MG13™ Mighty Gecko Wireless Starter Kit:
-
-```bash
-$ make -f examples/Makefile-efr32mg13 BOARD=BRD4168A
-```
-
-After a successful build, the `elf` files are found in `<path-to-openthread>/output/efr32mg13/bin`.
-
-## Flash Binaries
-
-Compiled binaries may be flashed onto the EFR32 using [JLinkGDBServer][jlinkgdbserver]. EFR32 Starter kit mainboard integrates an on-board SEGGER J-Link debugger.
-
-[jlinkgdbserver]: https://www.segger.com/jlink-gdb-server.html
-
-```bash
-$ cd <path-to-JLinkGDBServer>
-$ sudo ./JLinkGDBServer -if swd -device EFR32MG13PxxxF1024
-$ cd <path-to-openthread>/output/efr32/bin
-$ arm-none-eabi-gdb ot-cli-ftd
-$ (gdb) target remote 127.0.0.1:2331
-$ (gdb) load
-$ (gdb) monitor reset
-$ (gdb) c
-```
-
-Note: Support for the "EFR32MG13PxxxF1024" device was added to JLinkGDBServer V6.14d.
-
-Or Compiled binaries also may be flashed onto the specified EFR32 dev board using [J-Link Commander][j-link-commander].
-
-[j-link-commander]: https://www.segger.com/products/debug-probes/j-link/tools/j-link-commander/
-
-```bash
-$ cd <path-to-openthread>/output/efr32mg13/bin
-$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex
-$ JLinkExe -device EFR32MG13PxxxF1024 -speed 4000 -if SWD -autoconnect 1 -SelectEmuBySN <SerialNo>
-$ J-Link>loadfile ot-cli-ftd.hex
-$ J-Link>r
-$ J-Link>q
-```
-
-Note: SerialNo is J-Link serial number. Use the following command to get the serial number of the connected J-Link.
-
-```bash
-$ JLinkExe
-```
-
-Alternatively Simplicity Commander provides a graphical interface for J-Link Commander.
-
-```bash
-$ cd <path-to-openthread>/output/efr32mg13/bin
-$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.ihex
-$ <path-to-simplicity-studio>/developer/adapter_packs/commander/commander
-```
-
-In the J-Link Device drop-down list select the serial number of the device to flash. Click the Adapter Connect button. Ensure the Debug Interface drop-down list is set to SWD and click the Target Connect button. Click on the Flash icon on the left side of the window to switch to the flash page. In the Flash MCU pane enter the path of the ot-cli-ftd.s37 file or choose the file with the Browse... button. Click the Flash button located under the Browse... button.
-
-## Run the example with EFR32MG13 boards
-
-1. Flash two EFR32 boards with the `CLI example` firmware (as shown above).
-2. Open terminal to first device `/dev/ttyACM0` (serial port settings: 115200 8-N-1). Type `help` for a list of commands.
-
-   ```bash
-   > help
-   help
-   channel
-   childtimeout
-   contextreusedelay
-   extaddr
-   extpanid
-   ipaddr
-   keysequence
-   leaderweight
-   masterkey
-   mode
-   netdataregister
-   networkidtimeout
-   networkname
-   panid
-   ping
-   prefix
-   releaserouterid
-   rloc16
-   route
-   routerupgradethreshold
-   scan
-   start
-   state
-   stop
-   whitelist
-   ```
-
-3. Start a Thread network as Leader.
-
-   ```bash
-   > dataset init new
-   Done
-   > dataset
-   Active Timestamp: 1
-   Channel: 13
-   Channel Mask: 0x07fff800
-   Ext PAN ID: d63e8e3e495ebbc3
-   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
-   Master Key: dfd34f0f05cad978ec4e32b0413038ff
-   Network Name: OpenThread-8f28
-   PAN ID: 0x8f28
-   PSKc: c23a76e98f1a6483639b1ac1271e2e27
-   Security Policy: 0, onrcb
-   Done
-   > dataset commit active
-   Done
-   > ifconfig up
-   Done
-   > thread start
-   Done
-
-   wait a couple of seconds...
-
-   > state
-   leader
-   Done
-   ```
-
-4. Open terminal to second device `/dev/ttyACM1` (serial port settings: 115200 8-N-1) and attach it to the Thread network as a Router.
-
-   ```bash
-   > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
-   Done
-   > dataset commit active
-   Done
-   > routerselectionjitter 1
-   Done
-   > ifconfig up
-   Done
-   > thread start
-   Done
-
-   wait a couple of seconds...
-
-   > state
-   router
-   Done
-   ```
-
-5. List all IPv6 addresses of Leader.
-
-   ```bash
-   > ipaddr
-   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
-   fd3d:b50b:f96d:722d:0:ff:fe00:c00
-   fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-   fe80:0:0:0:6c41:9001:f3d6:4148
-   Done
-   ```
-
-6. Send an ICMPv6 ping to Leader's Mesh-EID IPv6 address.
-
-   ```bash
-   > ping fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-   16 bytes from fd3d:b50b:f96d:722d:558:f56b:d688:799: icmp_seq=1 hlim=64 time=24ms
-   ```
-
-The above example demonstrates basic OpenThread capabilities. Enable more features/roles (e.g. commissioner, joiner, DHCPv6 Server/Client, etc.) by assigning compile-options before compiling.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-$ make -f examples/Makefile-efr32mg13 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1
-```
-
-For a list of all available commands, visit [OpenThread CLI Reference README.md][cli].
-
-[cli]: https://github.com/openthread/openthread/blob/master/src/cli/README.md
-
-## Verification
-
-The following toolchain has been used for testing and verification:
-
-- gcc version 7.3.1
-
-The EFR32 example has been verified with following Flex SDK/RAIL Library version:
-
-- Flex SDK version 2.7.0.0
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/alarm.c b/third_party/openthread/repo/examples/platforms/efr32mg13/alarm.c
deleted file mode 100644 (file)
index 71a39c0..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the alarm.
- *
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "openthread-system.h"
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include "common/logging.hpp"
-
-#include "platform-efr32.h"
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "rail.h"
-#include "sl_sleeptimer.h"
-
-#define XTAL_ACCURACY 200
-
-static sl_sleeptimer_timer_handle_t sl_handle;
-static uint32_t                     sAlarm     = 0;
-static bool                         sIsRunning = false;
-
-static void AlarmCallback(sl_sleeptimer_timer_handle_t *aHandle, void *aData)
-{
-    otSysEventSignalPending();
-}
-
-void efr32AlarmInit(void)
-{
-    memset(&sl_handle, 0, sizeof sl_handle);
-}
-
-uint32_t otPlatAlarmMilliGetNow(void)
-{
-    uint64_t    ticks;
-    uint64_t    now;
-    sl_status_t status;
-
-    ticks  = sl_sleeptimer_get_tick_count64();
-    status = sl_sleeptimer_tick64_to_ms(ticks, &now);
-    assert(status == SL_STATUS_OK);
-    return (uint32_t)now;
-}
-
-uint32_t otPlatTimeGetXtalAccuracy(void)
-{
-    return XTAL_ACCURACY;
-}
-
-void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    sl_status_t status;
-    int32_t     remaining;
-    uint32_t    ticks;
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-
-    sAlarm     = aT0 + aDt;
-    remaining  = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-    sIsRunning = true;
-
-    if (remaining <= 0)
-    {
-        otSysEventSignalPending();
-    }
-    else
-    {
-        status = sl_sleeptimer_ms32_to_tick(remaining, &ticks);
-        assert(status == SL_STATUS_OK);
-
-        status = sl_sleeptimer_start_timer(&sl_handle, ticks, AlarmCallback, NULL, 0,
-                                           SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG);
-        assert(status == SL_STATUS_OK);
-    }
-}
-
-void otPlatAlarmMilliStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-    sIsRunning = false;
-}
-
-void efr32AlarmProcess(otInstance *aInstance)
-{
-    int32_t remaining;
-
-    if (sIsRunning)
-    {
-        remaining = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-
-        if (remaining <= 0)
-        {
-            sIsRunning = false;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-            if (otPlatDiagModeGet())
-            {
-                otPlatDiagAlarmFired(aInstance);
-            }
-            else
-#endif
-            {
-                otPlatAlarmMilliFired(aInstance);
-            }
-        }
-    }
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/brd4168a/board_config.h b/third_party/openthread/repo/examples/platforms/efr32mg13/brd4168a/board_config.h
deleted file mode 100644 (file)
index 8d1a1ec..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes dev borad compile-time configuration constants for efr32.
- *
- */
-
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-
-#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
-#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 0 /// Dev board doesn't support OQPSK modulation in 915MHz band.
-
-#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
-#endif
-
-#ifndef RADIO_CONFIG_DMP_SUPPORT
-#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
-
-#define RADIO_CONFIG_PA_USES_DCDC 0 /// The PA(s) is(are) fed from VBAT
-
-#endif
-
-#endif // __BOARD_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/brd4168a/hal-config.h b/third_party/openthread/repo/examples/platforms/efr32mg13/brd4168a/hal-config.h
deleted file mode 100644 (file)
index e9ce347..0000000
+++ /dev/null
@@ -1,451 +0,0 @@
-#ifndef HAL_CONFIG_BOARD_H
-#define HAL_CONFIG_BOARD_H
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-// This file is auto-generated by Hardware Configurator in Simplicity Studio.
-// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
-// Content outside these regions will be preserved.
-
-// $[ACMP0]
-// [ACMP0]$
-
-// $[ACMP1]
-// [ACMP1]$
-
-// $[ADC0]
-// [ADC0]$
-
-// $[ANTDIV]
-// [ANTDIV]$
-
-// $[BATTERYMON]
-
-// [BATTERYMON]$
-
-// $[BTL_BUTTON]
-
-#define BSP_BTL_BUTTON_PIN (6U)
-#define BSP_BTL_BUTTON_PORT (gpioPortF)
-
-// [BTL_BUTTON]$
-
-// $[BULBPWM]
-// [BULBPWM]$
-
-// $[BULBPWM_COLOR]
-// [BULBPWM_COLOR]$
-
-// $[BUTTON]
-#define BSP_BUTTON_PRESENT (1)
-
-#define BSP_BUTTON0_PIN (6U)
-#define BSP_BUTTON0_PORT (gpioPortF)
-
-#define BSP_BUTTON1_PIN (7U)
-#define BSP_BUTTON1_PORT (gpioPortF)
-
-#define BSP_BUTTON_COUNT (2U)
-#define BSP_BUTTON_INIT                                                            \
-    {                                                                              \
-        {BSP_BUTTON0_PORT, BSP_BUTTON0_PIN}, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } \
-    }
-#define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
-#define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
-// [BUTTON]$
-
-// $[CMU]
-#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
-#define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-
-#define BSP_CLK_HFXO_PRESENT (1)
-#define BSP_CLK_HFXO_FREQ (38400000UL)
-#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
-#define BSP_CLK_HFXO_CTUNE (330)
-#define BSP_CLK_LFXO_PRESENT (1)
-#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
-#define BSP_CLK_LFXO_FREQ (32768U)
-#define BSP_CLK_LFXO_CTUNE (32U)
-// [CMU]$
-
-// $[COEX]
-// [COEX]$
-
-// $[CS5463]
-// [CS5463]$
-
-// $[CSEN]
-// [CSEN]$
-
-// $[DCDC]
-#define BSP_DCDC_PRESENT (1)
-
-#define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
-// [DCDC]$
-
-// $[EMU]
-// [EMU]$
-
-// $[EXTFLASH]
-#define BSP_EXTFLASH_CS_PIN (4U)
-#define BSP_EXTFLASH_CS_PORT (gpioPortA)
-
-#define BSP_EXTFLASH_INTERNAL (0)
-#define BSP_EXTFLASH_USART (HAL_SPI_PORT_USART1)
-#define BSP_EXTFLASH_MOSI_PIN (6U)
-#define BSP_EXTFLASH_MOSI_PORT (gpioPortC)
-#define BSP_EXTFLASH_MOSI_LOC (11U)
-
-#define BSP_EXTFLASH_MISO_PIN (7U)
-#define BSP_EXTFLASH_MISO_PORT (gpioPortC)
-#define BSP_EXTFLASH_MISO_LOC (11U)
-
-#define BSP_EXTFLASH_CLK_PIN (8U)
-#define BSP_EXTFLASH_CLK_PORT (gpioPortC)
-#define BSP_EXTFLASH_CLK_LOC (11U)
-
-// [EXTFLASH]$
-
-// $[EZRADIOPRO]
-// [EZRADIOPRO]$
-
-// $[FEM]
-// [FEM]$
-
-// $[GPIO]
-#define PORTIO_GPIO_SWV_PIN (2U)
-#define PORTIO_GPIO_SWV_PORT (gpioPortF)
-#define PORTIO_GPIO_SWV_LOC (0U)
-
-#define BSP_TRACE_SWO_PIN (2U)
-#define BSP_TRACE_SWO_PORT (gpioPortF)
-#define BSP_TRACE_SWO_LOC (0U)
-
-// [GPIO]$
-
-// $[I2C0]
-#define PORTIO_I2C0_SCL_PIN (10U)
-#define PORTIO_I2C0_SCL_PORT (gpioPortC)
-#define PORTIO_I2C0_SCL_LOC (14U)
-
-#define PORTIO_I2C0_SDA_PIN (11U)
-#define PORTIO_I2C0_SDA_PORT (gpioPortC)
-#define PORTIO_I2C0_SDA_LOC (16U)
-
-#define BSP_I2C0_SCL_PIN (10U)
-#define BSP_I2C0_SCL_PORT (gpioPortC)
-#define BSP_I2C0_SCL_LOC (14U)
-
-#define BSP_I2C0_SDA_PIN (11U)
-#define BSP_I2C0_SDA_PORT (gpioPortC)
-#define BSP_I2C0_SDA_LOC (16U)
-
-// [I2C0]$
-
-// $[I2C1]
-// [I2C1]$
-
-// $[I2CSENSOR]
-
-#define BSP_I2CSENSOR_ENABLE_PIN (15U)
-#define BSP_I2CSENSOR_ENABLE_PORT (gpioPortD)
-
-#define BSP_I2CSENSOR_PERIPHERAL (HAL_I2C_PORT_I2C0)
-#define BSP_I2CSENSOR_SCL_PIN (10U)
-#define BSP_I2CSENSOR_SCL_PORT (gpioPortC)
-#define BSP_I2CSENSOR_SCL_LOC (14U)
-
-#define BSP_I2CSENSOR_SDA_PIN (11U)
-#define BSP_I2CSENSOR_SDA_PORT (gpioPortC)
-#define BSP_I2CSENSOR_SDA_LOC (16U)
-
-// [I2CSENSOR]$
-
-// $[IDAC0]
-// [IDAC0]$
-
-// $[IOEXP]
-// [IOEXP]$
-
-// $[LED]
-#define BSP_LED_PRESENT (1)
-
-#define BSP_LED0_PIN (4U)
-#define BSP_LED0_PORT (gpioPortF)
-
-#define BSP_LED1_PIN (5U)
-#define BSP_LED1_PORT (gpioPortF)
-
-#define BSP_LED_COUNT (2U)
-#define BSP_LED_INIT                                                   \
-    {                                                                  \
-        {BSP_LED0_PORT, BSP_LED0_PIN}, { BSP_LED1_PORT, BSP_LED1_PIN } \
-    }
-#define BSP_LED_POLARITY (1)
-// [LED]$
-
-// $[LESENSE]
-// [LESENSE]$
-
-// $[LETIMER0]
-// [LETIMER0]$
-
-// $[LEUART0]
-// [LEUART0]$
-
-// $[LFXO]
-// [LFXO]$
-
-// $[MODEM]
-// [MODEM]$
-
-// $[PA]
-
-#define BSP_PA_VOLTAGE (3300U)
-// [PA]$
-
-// $[PCNT0]
-// [PCNT0]$
-
-// $[PORTIO]
-// [PORTIO]$
-
-// $[PRS]
-#define PORTIO_PRS_CH4_PIN (13U)
-#define PORTIO_PRS_CH4_PORT (gpioPortD)
-#define PORTIO_PRS_CH4_LOC (4U)
-
-// [PRS]$
-
-// $[PTI]
-#define PORTIO_PTI_DCLK_PIN (11U)
-#define PORTIO_PTI_DCLK_PORT (gpioPortB)
-#define PORTIO_PTI_DCLK_LOC (6U)
-
-#define PORTIO_PTI_DFRAME_PIN (13U)
-#define PORTIO_PTI_DFRAME_PORT (gpioPortB)
-#define PORTIO_PTI_DFRAME_LOC (6U)
-
-#define PORTIO_PTI_DOUT_PIN (12U)
-#define PORTIO_PTI_DOUT_PORT (gpioPortB)
-#define PORTIO_PTI_DOUT_LOC (6U)
-
-#define BSP_PTI_DFRAME_PIN (13U)
-#define BSP_PTI_DFRAME_PORT (gpioPortB)
-#define BSP_PTI_DFRAME_LOC (6U)
-
-#define BSP_PTI_DOUT_PIN (12U)
-#define BSP_PTI_DOUT_PORT (gpioPortB)
-#define BSP_PTI_DOUT_LOC (6U)
-
-// [PTI]$
-
-// $[PYD1698]
-// [PYD1698]$
-
-// $[SERIAL]
-#define BSP_SERIAL_APP_PORT (HAL_SERIAL_PORT_USART0)
-#define BSP_SERIAL_APP_TX_PIN (0U)
-#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_TX_LOC (0U)
-
-#define BSP_SERIAL_APP_RX_PIN (1U)
-#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RX_LOC (0U)
-
-#define BSP_SERIAL_APP_CTS_PIN (2U)
-#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_CTS_LOC (30U)
-
-#define BSP_SERIAL_APP_RTS_PIN (3U)
-#define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
-#define BSP_SERIAL_APP_RTS_LOC (30U)
-
-#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_BAUD_RATE (115200)
-#define HAL_SERIAL_APP_RXSTOP (16)
-#define HAL_SERIAL_APP_RXSTART (16)
-#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128)
-#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [SERIAL]$
-
-// $[SPIDISPLAY]
-
-#define BSP_SPIDISPLAY_CS_PIN (14U)
-#define BSP_SPIDISPLAY_CS_PORT (gpioPortD)
-
-#define BSP_SPIDISPLAY_ENABLE_PIN (15U)
-#define BSP_SPIDISPLAY_ENABLE_PORT (gpioPortD)
-
-#define BSP_SPIDISPLAY_EXTCOMIN_PIN (13U)
-#define BSP_SPIDISPLAY_EXTCOMIN_PORT (gpioPortD)
-#define BSP_SPIDISPLAY_EXTCOMIN_LOC (4U)
-
-#define BSP_SPIDISPLAY_DISPLAY (HAL_DISPLAY_SHARP_LS013B7DH03)
-#define BSP_SPIDISPLAY_USART (HAL_SPI_PORT_USART1)
-#define BSP_SPIDISPLAY_EXTCOMIN_CHANNEL (4)
-#define BSP_SPIDISPLAY_MOSI_PIN (6U)
-#define BSP_SPIDISPLAY_MOSI_PORT (gpioPortC)
-#define BSP_SPIDISPLAY_MOSI_LOC (11U)
-
-#define BSP_SPIDISPLAY_MISO_PIN (7U)
-#define BSP_SPIDISPLAY_MISO_PORT (gpioPortC)
-#define BSP_SPIDISPLAY_MISO_LOC (11U)
-
-#define BSP_SPIDISPLAY_CLK_PIN (8U)
-#define BSP_SPIDISPLAY_CLK_PORT (gpioPortC)
-#define BSP_SPIDISPLAY_CLK_LOC (11U)
-
-// [SPIDISPLAY]$
-
-// $[SPINCP]
-#define BSP_SPINCP_NHOSTINT_PIN (6U)
-#define BSP_SPINCP_NHOSTINT_PORT (gpioPortF)
-
-#define BSP_SPINCP_NWAKE_PIN (7U)
-#define BSP_SPINCP_NWAKE_PORT (gpioPortF)
-
-#define BSP_SPINCP_USART_PORT (HAL_SPI_PORT_USART1)
-#define BSP_SPINCP_MOSI_PIN (6U)
-#define BSP_SPINCP_MOSI_PORT (gpioPortC)
-#define BSP_SPINCP_MOSI_LOC (11U)
-
-#define BSP_SPINCP_MISO_PIN (7U)
-#define BSP_SPINCP_MISO_PORT (gpioPortC)
-#define BSP_SPINCP_MISO_LOC (11U)
-
-#define BSP_SPINCP_CLK_PIN (8U)
-#define BSP_SPINCP_CLK_PORT (gpioPortC)
-#define BSP_SPINCP_CLK_LOC (11U)
-
-#define BSP_SPINCP_CS_PIN (9U)
-#define BSP_SPINCP_CS_PORT (gpioPortC)
-#define BSP_SPINCP_CS_LOC (11U)
-
-// [SPINCP]$
-
-// $[TIMER0]
-// [TIMER0]$
-
-// $[TIMER1]
-// [TIMER1]$
-
-// $[UARTNCP]
-#define BSP_UARTNCP_USART_PORT (HAL_SERIAL_PORT_USART0)
-#define BSP_UARTNCP_TX_PIN (0U)
-#define BSP_UARTNCP_TX_PORT (gpioPortA)
-#define BSP_UARTNCP_TX_LOC (0U)
-
-#define BSP_UARTNCP_RX_PIN (1U)
-#define BSP_UARTNCP_RX_PORT (gpioPortA)
-#define BSP_UARTNCP_RX_LOC (0U)
-
-#define BSP_UARTNCP_CTS_PIN (2U)
-#define BSP_UARTNCP_CTS_PORT (gpioPortA)
-#define BSP_UARTNCP_CTS_LOC (30U)
-
-#define BSP_UARTNCP_RTS_PIN (3U)
-#define BSP_UARTNCP_RTS_PORT (gpioPortA)
-#define BSP_UARTNCP_RTS_LOC (30U)
-
-// [UARTNCP]$
-
-// $[USART0]
-#define PORTIO_USART0_CTS_PIN (2U)
-#define PORTIO_USART0_CTS_PORT (gpioPortA)
-#define PORTIO_USART0_CTS_LOC (30U)
-
-#define PORTIO_USART0_RTS_PIN (3U)
-#define PORTIO_USART0_RTS_PORT (gpioPortA)
-#define PORTIO_USART0_RTS_LOC (30U)
-
-#define PORTIO_USART0_RX_PIN (1U)
-#define PORTIO_USART0_RX_PORT (gpioPortA)
-#define PORTIO_USART0_RX_LOC (0U)
-
-#define PORTIO_USART0_TX_PIN (0U)
-#define PORTIO_USART0_TX_PORT (gpioPortA)
-#define PORTIO_USART0_TX_LOC (0U)
-
-#define BSP_USART0_TX_PIN (0U)
-#define BSP_USART0_TX_PORT (gpioPortA)
-#define BSP_USART0_TX_LOC (0U)
-
-#define BSP_USART0_RX_PIN (1U)
-#define BSP_USART0_RX_PORT (gpioPortA)
-#define BSP_USART0_RX_LOC (0U)
-
-#define BSP_USART0_CTS_PIN (2U)
-#define BSP_USART0_CTS_PORT (gpioPortA)
-#define BSP_USART0_CTS_LOC (30U)
-
-#define BSP_USART0_RTS_PIN (3U)
-#define BSP_USART0_RTS_PORT (gpioPortA)
-#define BSP_USART0_RTS_LOC (30U)
-
-// [USART0]$
-
-// $[USART1]
-#define PORTIO_USART1_CLK_PIN (8U)
-#define PORTIO_USART1_CLK_PORT (gpioPortC)
-#define PORTIO_USART1_CLK_LOC (11U)
-
-#define PORTIO_USART1_CS_PIN (9U)
-#define PORTIO_USART1_CS_PORT (gpioPortC)
-#define PORTIO_USART1_CS_LOC (11U)
-
-#define PORTIO_USART1_RX_PIN (7U)
-#define PORTIO_USART1_RX_PORT (gpioPortC)
-#define PORTIO_USART1_RX_LOC (11U)
-
-#define PORTIO_USART1_TX_PIN (6U)
-#define PORTIO_USART1_TX_PORT (gpioPortC)
-#define PORTIO_USART1_TX_LOC (11U)
-
-#define BSP_USART1_MOSI_PIN (6U)
-#define BSP_USART1_MOSI_PORT (gpioPortC)
-#define BSP_USART1_MOSI_LOC (11U)
-
-#define BSP_USART1_MISO_PIN (7U)
-#define BSP_USART1_MISO_PORT (gpioPortC)
-#define BSP_USART1_MISO_LOC (11U)
-
-#define BSP_USART1_CLK_PIN (8U)
-#define BSP_USART1_CLK_PORT (gpioPortC)
-#define BSP_USART1_CLK_LOC (11U)
-
-#define BSP_USART1_CS_PIN (9U)
-#define BSP_USART1_CS_PORT (gpioPortC)
-#define BSP_USART1_CS_LOC (11U)
-
-// [USART1]$
-
-// $[USART2]
-// [USART2]$
-
-// $[VCOM]
-
-#define BSP_VCOM_ENABLE_PIN (5U)
-#define BSP_VCOM_ENABLE_PORT (gpioPortA)
-
-// [VCOM]$
-
-// $[VDAC0]
-// [VDAC0]$
-
-// $[VUART]
-// [VUART]$
-
-// $[WDOG]
-// [WDOG]$
-
-// $[WTIMER0]
-// [WTIMER0]$
-
-#if defined(_SILICON_LABS_MODULE)
-#include "sl_module.h"
-#endif
-
-#endif /* HAL_CONFIG_BOARD_H */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/crypto/efr32-mbedtls-config.h b/third_party/openthread/repo/examples/platforms/efr32mg13/crypto/efr32-mbedtls-config.h
deleted file mode 100644 (file)
index 14f1d1c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EFR32_MBEDTLS_CONFIG_H
-#define EFR32_MBEDTLS_CONFIG_H
-
-#include "em_device.h"
-
-/**
- * \def MBEDTLS_AES_ALT
- *
- * Enable hardware acceleration for the AES block cipher
- *
- * Module:  sl_crypto/src/crypto_aes.c for devices with CRYPTO
- *          sl_crypto/src/aes_aes.c for devices with AES
- *
- * See MBEDTLS_AES_C for more information.
- */
-#define MBEDTLS_AES_ALT
-
-/**
- * \def MBEDTLS_ECP_INTERNAL_ALT
- * \def ECP_SHORTWEIERSTRASS
- * \def MBEDTLS_ECP_ADD_MIXED_ALT
- * \def MBEDTLS_ECP_DOUBLE_JAC_ALT
- * \def MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
- * \def MBEDTLS_ECP_NORMALIZE_JAC_ALT
- *
- * Enable hardware acceleration for the elliptic curve over GF(p) library.
- *
- * Module:  sl_crypto/src/crypto_ecp.c
- * Caller:  library/ecp.c
- *
- * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_ECP_C and at least one
- * MBEDTLS_ECP_DP_XXX_ENABLED and (CRYPTO_COUNT > 0)
- */
-#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
-#define MBEDTLS_ECP_INTERNAL_ALT
-#define ECP_SHORTWEIERSTRASS
-#define MBEDTLS_ECP_ADD_MIXED_ALT
-#define MBEDTLS_ECP_DOUBLE_JAC_ALT
-#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
-#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
-#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
-#endif
-
-/**
- * \def MBEDTLS_SHA256_ALT
- *
- * Enable hardware acceleration for the SHA-224 and SHA-256 cryptographic
- * hash algorithms.
- *
- * Module:  sl_crypto/src/crypto_sha.c
- * Caller:  library/entropy.c
- *          library/mbedtls_md.c
- *          library/ssl_cli.c
- *          library/ssl_srv.c
- *          library/ssl_tls.c
- *
- * Requires: MBEDTLS_SHA256_C and (CRYPTO_COUNT > 0)
- * See MBEDTLS_SHA256_C for more information.
- */
-#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
-#define MBEDTLS_SHA256_ALT
-#endif
-
-#endif // EFR32_MBEDTLS_CONFIG_H
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/diag.c b/third_party/openthread/repo/examples/platforms/efr32mg13/diag.c
deleted file mode 100644 (file)
index a7c3357..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the diagnostics.
- *
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/radio.h>
-
-#include "platform-efr32.h"
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-/**
- * Diagnostics mode variables.
- *
- */
-static bool sDiagMode = false;
-
-void otPlatDiagModeSet(bool aMode)
-{
-    sDiagMode = aMode;
-}
-
-bool otPlatDiagModeGet()
-{
-    return sDiagMode;
-}
-
-void otPlatDiagChannelSet(uint8_t aChannel)
-{
-    OT_UNUSED_VARIABLE(aChannel);
-}
-
-void otPlatDiagTxPowerSet(int8_t aTxPower)
-{
-    OT_UNUSED_VARIABLE(aTxPower);
-}
-
-void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aFrame);
-    OT_UNUSED_VARIABLE(aError);
-}
-
-void otPlatDiagAlarmCallback(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-#endif // #if OPENTHREAD_CONFIG_DIAG_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/efr32mg13.ld b/third_party/openthread/repo/examples/platforms/efr32mg13/efr32mg13.ld
deleted file mode 100644 (file)
index 22be579..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
- /**
- * @file
- *   This file implements the OpenThread linker script for the
- *   Silicon Labs efr32mg13 platform.
- *
- */
-
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
-  RAM (rwx)  : ORIGIN = 0x20000000, LENGTH = 64K
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- *
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __copy_table_start__
- *   __copy_table_end__
- *   __zero_table_start__
- *   __zero_table_end__
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapBase
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- *   __Vectors_End
- *   __Vectors_Size
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-  .text :
-  {
-    KEEP(*(.vectors))
-    __Vectors_End = .;
-    __Vectors_Size = __Vectors_End - __Vectors;
-    __end__ = .;
-
-    *(.text*)
-
-    KEEP(*(.init))
-    KEEP(*(.fini))
-
-    /* .ctors */
-    *crtbegin.o(.ctors)
-    *crtbegin?.o(.ctors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-    *(SORT(.ctors.*))
-    *(.ctors)
-
-    /* .dtors */
-    *crtbegin.o(.dtors)
-    *crtbegin?.o(.dtors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-    *(SORT(.dtors.*))
-    *(.dtors)
-
-    *(.rodata*)
-
-    KEEP(*(.eh_frame*))
-  } > FLASH
-
-  .ARM.extab :
-  {
-    *(.ARM.extab* .gnu.linkonce.armextab.*)
-  } > FLASH
-
-  __exidx_start = .;
-  .ARM.exidx :
-  {
-    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-  } > FLASH
-  __exidx_end = .;
-
-  /* To copy multiple ROM to RAM sections,
-   * uncomment .copy.table section and,
-   * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .copy.table :
-  {
-    . = ALIGN(4);
-    __copy_table_start__ = .;
-    LONG (__etext)
-    LONG (__data_start__)
-    LONG (__data_end__ - __data_start__)
-    LONG (__etext2)
-    LONG (__data2_start__)
-    LONG (__data2_end__ - __data2_start__)
-    __copy_table_end__ = .;
-  } > FLASH
-  */
-
-  /* To clear multiple BSS sections,
-   * uncomment .zero.table section and,
-   * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .zero.table :
-  {
-    . = ALIGN(4);
-    __zero_table_start__ = .;
-    LONG (__bss_start__)
-    LONG (__bss_end__ - __bss_start__)
-    LONG (__bss2_start__)
-    LONG (__bss2_end__ - __bss2_start__)
-    __zero_table_end__ = .;
-  } > FLASH
-  */
-
-  __etext = .;
-  
-  .data : AT (__etext)
-  {
-    __data_start__ = .;
-    *(vtable)
-    *(.data*)
-    . = ALIGN (4);
-    PROVIDE (__ram_func_section_start = .);
-    *(.ram)
-    PROVIDE (__ram_func_section_end = .);
-
-    . = ALIGN(4);
-    /* preinit data */
-    PROVIDE_HIDDEN (__preinit_array_start = .);
-    KEEP(*(.preinit_array))
-    PROVIDE_HIDDEN (__preinit_array_end = .);
-
-    . = ALIGN(4);
-    /* init data */
-    PROVIDE_HIDDEN (__init_array_start = .);
-    KEEP(*(SORT(.init_array.*)))
-    KEEP(*(.init_array))
-    PROVIDE_HIDDEN (__init_array_end = .);
-
-    . = ALIGN(4);
-    /* finit data */
-    PROVIDE_HIDDEN (__fini_array_start = .);
-    KEEP(*(SORT(.fini_array.*)))
-    KEEP(*(.fini_array))
-    PROVIDE_HIDDEN (__fini_array_end = .);
-
-    KEEP(*(.jcr*))
-    . = ALIGN(4);
-    /* All data end */
-    __data_end__ = .;
-
-  } > RAM
-
-  .bss :
-  {
-    . = ALIGN(4);
-    __bss_start__ = .;
-    *(.bss*)
-    *(COMMON)
-    . = ALIGN(4);
-    __bss_end__ = .;
-  } > RAM
-
-  .heap (COPY):
-  {
-    __HeapBase = .;
-    __end__ = .;
-    end = __end__;
-    _end = __end__;
-    KEEP(*(.heap*))
-    __HeapLimit = .;
-  } > RAM
-
-  /* .stack_dummy section doesn't contains any symbols. It is only
-   * used for linker to calculate size of stack sections, and assign
-   * values to stack symbols later */
-  .stack_dummy (COPY):
-  {
-    KEEP(*(.stack*))
-  } > RAM
-
-  /* Set stack top to end of RAM, and stack limit move down by
-   * size of stack_dummy section */
-  __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-  __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-  PROVIDE(__stack = __StackTop);
-
-  /*******************************************************************/
-  /* Define flash block for nvm3                                     */
-  .nvm (DSECT) : {
-    KEEP(*(.simee*))
-  } > FLASH
-
-  linker_nvm_end = ORIGIN(FLASH) + LENGTH(FLASH);
-  linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm);
-  linker_nvm_size = SIZEOF(.nvm);
-  __nvm3Base = linker_nvm_begin;
-  /*******************************************************************/
-
-  /* Check if data + heap + stack exceeds RAM limit */
-  ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-
-  /* Check if FLASH usage exceeds FLASH size */
-  ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/entropy.c b/third_party/openthread/repo/examples/platforms/efr32mg13/entropy.c
deleted file mode 100644 (file)
index 2b196bb..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements an entropy source based on ADC.
- *
- */
-
-#include <openthread/platform/entropy.h>
-
-#include "utils/code_utils.h"
-
-#include "em_adc.h"
-#include "em_cmu.h"
-
-enum
-{
-    EFR32_ADC_REF_CLOCK = 7000000,
-};
-
-void efr32RandomInit(void)
-{
-    /* Enable ADC Clock */
-    CMU_ClockEnable(cmuClock_ADC0, true);
-    ADC_Init_TypeDef       init       = ADC_INIT_DEFAULT;
-    ADC_InitSingle_TypeDef singleInit = ADC_INITSINGLE_DEFAULT;
-
-    /* Initialize the ADC with the required values */
-    init.timebase = ADC_TimebaseCalc(0);
-    init.prescale = ADC_PrescaleCalc(EFR32_ADC_REF_CLOCK, 0);
-    ADC_Init(ADC0, &init);
-
-    /* Initialize for single conversion specific to RNG */
-    singleInit.reference = adcRefVEntropy;
-    singleInit.diff      = true;
-    singleInit.posSel    = adcPosSelVSS;
-    singleInit.negSel    = adcNegSelVSS;
-    ADC_InitSingle(ADC0, &singleInit);
-
-    /* Set VINATT to maximum value and clear FIFO */
-    ADC0->SINGLECTRLX |= _ADC_SINGLECTRLX_VINATT_MASK;
-    ADC0->SINGLEFIFOCLEAR = ADC_SINGLEFIFOCLEAR_SINGLEFIFOCLEAR;
-}
-
-static uint32_t randomUint32Get(void)
-{
-    uint8_t  tmp;
-    uint32_t random = 0;
-
-    for (int i = 0; i < 4; i++)
-    {
-        tmp = 0;
-
-        for (int j = 0; j < 3; j++)
-        {
-            ADC_Start(ADC0, adcStartSingle);
-
-            while ((ADC0->IF & ADC_IF_SINGLE) == 0)
-                ;
-
-            tmp |= ((ADC_DataSingleGet(ADC0) & 0x07) << (j * 3));
-        }
-
-        random |= (tmp & 0xff) << (i * 8);
-    }
-
-    return random;
-}
-
-otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
-
-    for (uint16_t length = 0; length < aOutputLength; length++)
-    {
-        aOutput[length] = (uint8_t)randomUint32Get();
-    }
-
-exit:
-    return error;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/fem-control.c b/third_party/openthread/repo/examples/platforms/efr32mg13/fem-control.c
deleted file mode 100644 (file)
index f66415c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "hal-config.h"
-
-#if (HAL_FEM_ENABLE)
-#include "util/plugin/plugin-common/fem-control/fem-control.c"
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/flash.c b/third_party/openthread/repo/examples/platforms/efr32mg13/flash.c
deleted file mode 100644 (file)
index 4f35969..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the non-volatile storage.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#if OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE // Use OT NV system
-
-#include "em_msc.h"
-#include <string.h>
-#include <openthread/instance.h>
-
-#define FLASH_PAGE_NUM 2
-#define FLASH_DATA_END_ADDR (FLASH_BASE + FLASH_SIZE)
-#define FLASH_DATA_START_ADDR (FLASH_DATA_END_ADDR - (FLASH_PAGE_SIZE * FLASH_PAGE_NUM))
-#define FLASH_SWAP_PAGE_NUM (FLASH_PAGE_NUM / 2)
-#define FLASH_SWAP_SIZE (FLASH_PAGE_SIZE * FLASH_SWAP_PAGE_NUM)
-
-static inline uint32_t mapAddress(uint8_t aSwapIndex, uint32_t aOffset)
-{
-    uint32_t address;
-
-    address = FLASH_DATA_START_ADDR + aOffset;
-
-    if (aSwapIndex)
-    {
-        address += FLASH_SWAP_SIZE;
-    }
-
-    return address;
-}
-
-void otPlatFlashInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return FLASH_SWAP_SIZE;
-}
-
-void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint32_t address = mapAddress(aSwapIndex, 0);
-
-    for (uint32_t n = 0; n < FLASH_SWAP_PAGE_NUM; n++, address += FLASH_PAGE_SIZE)
-    {
-        MSC_ErasePage((uint32_t *)address);
-    }
-}
-
-void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    MSC_WriteWord((uint32_t *)mapAddress(aSwapIndex, aOffset), aData, aSize);
-}
-
-void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    memcpy(aData, (const uint8_t *)mapAddress(aSwapIndex, aOffset), aSize);
-}
-
-#else // Defaults to Silabs nvm3 system
-
-#include "nvm3.h"
-#include "nvm3_default.h"
-#include <string.h>
-#include <openthread/platform/settings.h>
-#include "common/code_utils.hpp"
-#include "common/logging.hpp"
-
-#define NVM3KEY_DOMAIN_OPENTHREAD 0x20000U
-#define NUM_INDEXED_SETTINGS \
-    OPENTHREAD_CONFIG_MLE_MAX_CHILDREN // Indexed key types are only supported for kKeyChildInfo (=='child table').
-#define ENUM_NVM3_KEY_LIST_SIZE 4      // List size used when enumerating nvm3 keys.
-
-static otError          addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength);
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index);
-static otError          mapNvm3Error(Ecode_t nvm3Res);
-
-void otPlatSettingsInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    if (mapNvm3Error(nvm3_open(nvm3_defaultHandle, nvm3_defaultInit)) != OT_ERROR_NONE)
-    {
-        otLogDebgPlat("Error initializing nvm3 instance");
-    }
-}
-
-void otPlatSettingsDeinit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    nvm3_close(nvm3_defaultHandle);
-}
-
-otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index', then reads the nvm3 data into the destination buffer.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError  err;
-    uint16_t valueLength = 0;
-
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if (idx == aIndex)
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    valueLength = objLen;
-
-                    // Only perform read if an input buffer was passed in.
-                    if ((aValue != NULL) && (aValueLength != NULL))
-                    {
-                        // Read all nvm3 obj bytes into a tmp buffer, then copy the required
-                        // number of bytes to the read destination buffer.
-                        uint8_t *buf = malloc(valueLength);
-                        err          = mapNvm3Error(nvm3_readData(nvm3_defaultHandle, nvm3Key, buf, valueLength));
-                        if (err == OT_ERROR_NONE)
-                        {
-                            memcpy(aValue, buf, (valueLength < *aValueLength) ? valueLength : *aValueLength);
-                        }
-                        free(buf);
-                        SuccessOrExit(err);
-                    }
-                }
-                idxFound = true;
-                break;
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    if (aValueLength != NULL)
-    {
-        *aValueLength = valueLength; // always return actual nvm3 object length.
-    }
-
-    return err;
-}
-
-otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError err;
-
-    // Delete all nvm3 objects matching the input key (i.e. the 'setting indexes' of the key).
-    err = otPlatSettingsDelete(aInstance, aKey, -1);
-    if ((err == OT_ERROR_NONE) || (err == OT_ERROR_NOT_FOUND))
-    {
-        // Add new setting object (i.e. 'index0' of the key).
-        err = addSetting(aKey, aValue, aValueLength);
-        SuccessOrExit(err);
-    }
-
-exit:
-    return err;
-}
-
-otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    return addSetting(aKey, aValue, aValueLength);
-}
-
-otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index' (or index = -1 to delete all), then deletes the nvm3 object.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError          err;
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if ((idx == aIndex) || (aIndex == -1))
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    // Delete the nvm3 object.
-                    err = mapNvm3Error(nvm3_deleteObject(nvm3_defaultHandle, nvm3Key));
-                    SuccessOrExit(err);
-                }
-                if (aIndex != -1)
-                {
-                    idxFound = true;
-                    break;
-                }
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    return err;
-}
-
-void otPlatSettingsWipe(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // Delete nvm3 objects for all OT Settings keys (and any of their associated 'indexes').
-    // Note- any OT User nvm3 objects in the OT nvm3 area are NOT be erased.
-    for (uint16_t aKey = 0; aKey < 8; ++aKey)
-    {
-        otPlatSettingsDelete(NULL, aKey, -1);
-    }
-}
-
-// Local functions..
-
-static otError addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    // Helper function- writes input buffer data to a NEW nvm3 object.
-    // nvm3 object is created at the first available Key + index.
-
-    otError err;
-
-    if ((aValueLength == 0) || (aValue == NULL))
-    {
-        err = OT_ERROR_INVALID_ARGS;
-    }
-    else
-    {
-        for (int idx = 0; idx <= NUM_INDEXED_SETTINGS; ++idx)
-        {
-            nvm3_ObjectKey_t nvm3Key;
-            nvm3Key = makeNvm3ObjKey(aKey, idx);
-
-            uint32_t objType;
-            size_t   objLen;
-            err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-            if (err == OT_ERROR_NOT_FOUND)
-            {
-                // Use this index for the new nvm3 object.
-                // Write the binary data to nvm3 (Creates nvm3 object if required).
-                err = mapNvm3Error(nvm3_writeData(nvm3_defaultHandle, nvm3Key, aValue, aValueLength));
-                break;
-            }
-            else if (err != OT_ERROR_NONE)
-            {
-                break;
-            }
-        }
-    }
-
-    return err;
-}
-
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index)
-{
-    return (NVM3KEY_DOMAIN_OPENTHREAD | (otSettingsKey << 8) | (index & 0xFF));
-}
-
-static otError mapNvm3Error(Ecode_t nvm3Res)
-{
-    otError err;
-
-    switch (nvm3Res)
-    {
-    case ECODE_NVM3_OK:
-        err = OT_ERROR_NONE;
-        break;
-
-    case ECODE_NVM3_ERR_KEY_NOT_FOUND:
-        err = OT_ERROR_NOT_FOUND;
-        break;
-
-    default:
-        err = OT_ERROR_FAILED;
-        break;
-    }
-
-    return err;
-}
-
-#endif // OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/logging.c b/third_party/openthread/repo/examples/platforms/efr32mg13/logging.c
deleted file mode 100644 (file)
index fa0a4dd..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file logging.c
- * Platform abstraction for the logging
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/logging.h>
-
-#include <utils/logging_rtt.h>
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-void efr32LogInit(void)
-{
-    utilsLogRttInit();
-}
-
-void efr32LogDeinit(void)
-{
-    utilsLogRttDeinit();
-}
-
-OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    va_list ap;
-
-    va_start(ap, aFormat);
-
-    utilsLogRttOutput(aLogLevel, aLogRegion, aFormat, ap);
-
-    va_end(ap);
-}
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/misc.c b/third_party/openthread/repo/examples/platforms/efr32mg13/misc.c
deleted file mode 100644 (file)
index 4b2076f..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for miscellaneous behaviors.
- */
-
-#include <openthread/platform/misc.h>
-
-#include "em_rmu.h"
-#include "platform-efr32.h"
-
-static uint32_t sResetCause;
-
-void efr32MiscInit(void)
-{
-    // Read the cause of last reset.
-    sResetCause = RMU_ResetCauseGet();
-
-    // Clear the register, as the causes cumulate over resets.
-    RMU_ResetCauseClear();
-}
-
-void otPlatReset(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    NVIC_SystemReset();
-}
-
-otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otPlatResetReason reason;
-
-    if (sResetCause & RMU_RSTCAUSE_PORST)
-    {
-        reason = OT_PLAT_RESET_REASON_POWER_ON;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_SYSREQRST)
-    {
-        reason = OT_PLAT_RESET_REASON_SOFTWARE;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_WDOGRST)
-    {
-        reason = OT_PLAT_RESET_REASON_WATCHDOG;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_EXTRST)
-    {
-        reason = OT_PLAT_RESET_REASON_EXTERNAL;
-    }
-    else if (sResetCause & RMU_RSTCAUSE_LOCKUPRST)
-    {
-        reason = OT_PLAT_RESET_REASON_FAULT;
-    }
-    else if ((sResetCause & RMU_RSTCAUSE_AVDDBOD) || (sResetCause & RMU_RSTCAUSE_DECBOD) ||
-             (sResetCause & RMU_RSTCAUSE_DVDDBOD) || (sResetCause & RMU_RSTCAUSE_EM4RST))
-    {
-        reason = OT_PLAT_RESET_REASON_ASSERT;
-    }
-    else
-    {
-        reason = OT_PLAT_RESET_REASON_UNKNOWN;
-    }
-
-    return reason;
-}
-
-void otPlatWakeHost(void)
-{
-    // TODO: implement an operation to wake the host from sleep state.
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/openthread-core-efr32-config-check.h b/third_party/openthread/repo/examples/platforms/efr32mg13/openthread-core-efr32-config-check.h
deleted file mode 100644 (file)
index a6bfb62..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-
-#include "board_config.h"
-
-#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
-#error "Platform efr32mg13 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
-#endif
-
-#ifndef RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
-#error "Platform efr32mg13 not configured to support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
-#endif
-#endif
-
-#endif /* OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_ */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/openthread-core-efr32-config.h b/third_party/openthread/repo/examples/platforms/efr32mg13/openthread-core-efr32-config.h
deleted file mode 100644 (file)
index d1cbde6..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes efr32 compile-time configuration constants
- *   for OpenThread.
- */
-
-#include "board_config.h"
-#include "em_msc.h"
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_H_
-
-/**
- * @def OPENTHREAD_CONFIG_LOG_OUTPUT
- *
- * The efr32 platform provides an otPlatLog() function.
- */
-#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT /* allow command line override */
-#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
-#endif
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
- *
- * Define to 1 if you want to enable physical layer to support OQPSK modulation in 915MHz band.
- *
- */
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 1
-#else
-#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 0
-#endif
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
- *
- * Define to 1 if you want to enable physical layer to support OQPSK modulation in 2.4GHz band.
- *
- */
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1
-#else
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 0
-#endif
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_INFO
- *
- * The platform-specific string to insert into the OpenThread version string.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_INFO "EFR32"
-
-/*
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
- *
- * Define to 1 if you want to enable software retransmission logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
- *
- * Define to 1 if you want to enable software CSMA-CA backoff logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
- *
- * Define to 1 if you want to enable software transmission security logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE
- *
- * Define to 1 if you want to enable software energy scanning logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
- *
- * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
- *
- * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
- *
- * Define to 1 to enable NCP UART support.
- *
- */
-#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
-
-#endif // OPENTHREAD_CORE_EFR32_CONFIG_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/platform-band.h b/third_party/openthread/repo/examples/platforms/efr32mg13/platform-band.h
deleted file mode 100644 (file)
index 7c4d912..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file defines the frequency band configuration structure for efr32.
- *
- */
-
-#ifndef PLATFORM_BAND_H_
-#define PLATFORM_BAND_H_
-
-#include <openthread/platform/radio.h>
-
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-#define RAIL_TX_FIFO_SIZE (OT_RADIO_FRAME_MAX_SIZE + 1)
-
-#define RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SLIP_TIME 500000UL
-#define RADIO_SCHEDULER_TX_PRIORITY 100
-#define RADIO_SCHEDULER_TX_SLIP_TIME 500000UL
-
-#define RADIO_TIMING_CSMA_OVERHEAD_US 500
-#define RADIO_TIMING_DEFAULT_BYTETIME_US 32   // only used if RAIL_GetBitRate returns 0
-#define RADIO_TIMING_DEFAULT_SYMBOLTIME_US 16 // only used if RAIL_GetSymbolRate returns 0
-
-typedef struct efr32RadioCounters
-{
-    uint64_t mRailPlatTxTriggered;
-    uint64_t mRailPlatRadioReceiveDoneCbCount;
-    uint64_t mRailPlatRadioEnergyScanDoneCbCount;
-    uint64_t mRailPlatRadioTxDoneCbCount;
-    uint64_t mRailTxStarted;
-    uint64_t mRailTxStartFailed;
-    uint64_t mRailEventConfigScheduled;
-    uint64_t mRailEventConfigUnScheduled;
-    uint64_t mRailEventPacketSent;
-    uint64_t mRailEventChannelBusy;
-    uint64_t mRailEventEnergyScanCompleted;
-    uint64_t mRailEventCalNeeded;
-    uint64_t mRailEventPacketReceived;
-    uint64_t mRailEventNoAck;
-    uint64_t mRailEventTxAbort;
-    uint64_t mRailEventSchedulerStatusError;
-    uint64_t mRailEventsSchedulerStatusTransmitBusy;
-    uint32_t mRailEventsSchedulerStatusLastStatus;
-} efr32RadioCounters;
-
-typedef struct efr32CommonConfig
-{
-    RAIL_Config_t mRailConfig;
-#if RADIO_CONFIG_DMP_SUPPORT
-    RAILSched_Config_t railSchedState;
-#endif
-    uint8_t
-        mRailTxFifo[RAIL_TX_FIFO_SIZE]; // must be 2 power between 64 and 4096, and bigger than OT_RADIO_FRAME_MAX_SIZE
-} efr32CommonConfig;
-
-typedef struct efr32BandConfig
-{
-    const RAIL_ChannelConfig_t *mChannelConfig;
-    uint8_t                     mChannelMin;
-    uint8_t                     mChannelMax;
-} efr32BandConfig;
-
-#endif // PLATFORM_BAND_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/platform-efr32.h b/third_party/openthread/repo/examples/platforms/efr32mg13/platform-efr32.h
deleted file mode 100644 (file)
index 5ec48e2..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes the platform-specific initializers.
- *
- */
-
-#ifndef PLATFORM_EFR32_H_
-#define PLATFORM_EFR32_H_
-
-#include <openthread/instance.h>
-
-#include "em_device.h"
-#include "em_system.h"
-
-#include "core_cm4.h"
-#include "rail.h"
-
-// Global OpenThread instance structure
-extern otInstance *sInstance;
-
-// Global reference to rail handle
-extern RAIL_Handle_t gRailHandle;
-
-/**
- * This function initializes the alarm service used by OpenThread.
- *
- */
-void efr32AlarmInit(void);
-
-/**
- * This function performs alarm driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32AlarmProcess(otInstance *aInstance);
-
-/**
- * This function initializes the radio service used by OpenThead.
- *
- */
-void efr32RadioInit(void);
-
-/**
- * This function deinitializes the radio service used by OpenThead.
- *
- */
-void efr32RadioDeinit(void);
-
-/**
- * This function performs radio driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32RadioProcess(otInstance *aInstance);
-
-/**
- * This function performs UART driver processing.
- *
- */
-void efr32UartProcess(void);
-
-/**
- * Initialization of Misc module.
- *
- */
-void efr32MiscInit(void);
-
-/**
- * Initialization of ADC module for random number generator.
- *
- */
-void efr32RandomInit(void);
-
-/**
- * Initialization of Logger driver.
- *
- */
-void efr32LogInit(void);
-
-/**
- * Deinitialization of Logger driver.
- *
- */
-void efr32LogDeinit(void);
-
-/**
- * Registers the sleep callback handler.  The callback is used to check that
- * the application has no work pending and that it is safe to put the EFR32
- * into a low energy sleep mode.
- *
- * The callback should return true if it is ok to enter sleep mode. Note
- * that the callback itself is run with interrupts disabled and so should
- * be kept as short as possible.  Anny interrupt including those from timers
- * will wake the EFR32 out of sleep mode.
- *
- * @param[in]  aCallback  Callback function.
- *
- */
-void efr32SetSleepCallback(bool (*aCallback)(void));
-
-/**
- * Put the EFR32 into a low power mode.  Before sleeping it will call a callback
- * in the application registered with efr32SetSleepCallback to ensure that there
- * is no outstanding work in the application to do.
- */
-void efr32Sleep(void);
-
-#endif // PLATFORM_EFR32_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/radio.c b/third_party/openthread/repo/examples/platforms/efr32mg13/radio.c
deleted file mode 100644 (file)
index e104d81..0000000
+++ /dev/null
@@ -1,1175 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for radio communication.
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-
-#include "openthread-system.h"
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include <openthread/platform/radio.h>
-
-#include "common/logging.hpp"
-#include "utils/code_utils.h"
-
-#include "utils/soft_source_match_table.h"
-
-#include "board_config.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "pa_conversions_efr32.h"
-#include "platform-band.h"
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-enum
-{
-    IEEE802154_MIN_LENGTH = 5,
-    IEEE802154_MAX_LENGTH = 127,
-    IEEE802154_ACK_LENGTH = 5,
-
-    // FCF + DSN + dest PANID + dest addr + src PANID + src addr (without security header)
-    IEEE802154_MAX_MHR_LENGTH = 2 + 1 + 2 + 8 + 2 + 8,
-
-    IEEE802154_FRAME_TYPE_MASK        = 0x7,
-    IEEE802154_FRAME_TYPE_ACK         = 0x2,
-    IEEE802154_FRAME_TYPE_MAC_COMMAND = 0x3,
-    IEEE802154_ACK_REQUEST            = 1 << 5,
-    IEEE802154_DSN_OFFSET             = 2,
-    IEEE802154_FCF_OFFSET             = 0,
-};
-
-enum
-{
-    EFR32_RECEIVE_SENSITIVITY    = -100, // dBm
-    EFR32_RSSI_AVERAGING_TIME    = 16,   // us
-    EFR32_RSSI_AVERAGING_TIMEOUT = 300,  // us
-};
-
-enum
-{
-    EFR32_SCHEDULER_SAMPLE_RSSI_PRIORITY = 10, // High priority
-    EFR32_SCHEDULER_TX_PRIORITY          = 10, // High priority
-    EFR32_SCHEDULER_RX_PRIORITY          = 20, // Low priority
-};
-
-enum
-{
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT && RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-    EFR32_NUM_BAND_CONFIGS = 2,
-#else
-    EFR32_NUM_BAND_CONFIGS = 1,
-#endif
-};
-
-typedef enum
-{
-    ENERGY_SCAN_STATUS_IDLE,
-    ENERGY_SCAN_STATUS_IN_PROGRESS,
-    ENERGY_SCAN_STATUS_COMPLETED
-} energyScanStatus;
-
-typedef enum
-{
-    ENERGY_SCAN_MODE_SYNC,
-    ENERGY_SCAN_MODE_ASYNC
-} energyScanMode;
-
-RAIL_Handle_t gRailHandle;
-
-static volatile bool sTransmitBusy = false;
-static bool          sPromiscuous  = false;
-static otRadioState  sState        = OT_RADIO_STATE_DISABLED;
-
-enum
-{
-    ACKED_WITH_FP_MATCH_LENGTH = 1 + IEEE802154_MAX_MHR_LENGTH, // PHR and MHR
-    ACKED_WITH_FP_SLOTS = 16, // maximum number of Data Request packets in the RX FIFO. Length should be a power of 2.
-};
-
-typedef struct efr32AckedWithFP
-{
-    uint8_t mLength;
-    uint8_t mPacket[ACKED_WITH_FP_MATCH_LENGTH];
-} efr32AckedWithFP;
-static bool              sIsSrcMatchEnabled = false;
-static efr32AckedWithFP  sAckedWithFPFifo[ACKED_WITH_FP_SLOTS];
-static uint32_t          sAckedWithFPReadIndex;
-static volatile uint32_t sAckedWithFPWriteIndex;
-
-static uint8_t      sReceivePsdu[IEEE802154_MAX_LENGTH];
-static otRadioFrame sReceiveFrame;
-static otError      sReceiveError;
-
-static otRadioFrame     sTransmitFrame;
-static uint8_t          sTransmitPsdu[IEEE802154_MAX_LENGTH];
-static volatile otError sTransmitError;
-
-static efr32CommonConfig sCommonConfig;
-static efr32BandConfig   sBandConfigs[EFR32_NUM_BAND_CONFIGS];
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-static efr32RadioCounters sRailDebugCounters;
-#endif
-
-static volatile energyScanStatus sEnergyScanStatus;
-static volatile int8_t           sEnergyScanResultDbm;
-static energyScanMode            sEnergyScanMode;
-
-#define QUARTER_DBM_IN_DBM 4
-#define US_IN_MS 1000
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents);
-
-static const RAIL_IEEE802154_Config_t sRailIeee802154Config = {
-    .addresses = NULL,
-    .ackConfig =
-        {
-            .enable     = true,
-            .ackTimeout = 864,
-            .rxTransitions =
-                {
-                    .success = RAIL_RF_STATE_RX,
-                    .error   = RAIL_RF_STATE_RX,
-                },
-            .txTransitions =
-                {
-                    .success = RAIL_RF_STATE_RX,
-                    .error   = RAIL_RF_STATE_RX,
-                },
-        },
-    .timings =
-        {
-            .idleToRx            = 100,
-            .txToRx              = 192 - 10,
-            .idleToTx            = 100,
-            .rxToTx              = 192,
-            .rxSearchTimeout     = 0,
-            .txToRxSearchTimeout = 0,
-        },
-    .framesMask       = RAIL_IEEE802154_ACCEPT_STANDARD_FRAMES,
-    .promiscuousMode  = false,
-    .isPanCoordinator = false,
-};
-
-#if RADIO_CONFIG_PA_USES_DCDC
-RAIL_DECLARE_TX_POWER_DCDC_CURVES(piecewiseSegments, curvesSg, curves24Hp, curves24Lp);
-#else
-RAIL_DECLARE_TX_POWER_VBAT_CURVES(piecewiseSegments, curvesSg, curves24Hp, curves24Lp);
-#endif
-
-static int8_t sTxPowerDbm = OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER;
-
-static int8_t sCcaThresholdDbm = -75; // default -75dBm energy detect threshold
-
-static efr32BandConfig *sCurrentBandConfig = NULL;
-
-static RAIL_Handle_t efr32RailInit(efr32CommonConfig *aCommonConfig)
-{
-    RAIL_Status_t status;
-    RAIL_Handle_t handle;
-
-    handle = RAIL_Init(&aCommonConfig->mRailConfig, NULL);
-    assert(handle != NULL);
-
-    status = RAIL_ConfigCal(handle, RAIL_CAL_ALL);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_IEEE802154_Init(handle, &sRailIeee802154Config);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_ConfigEvents(handle, RAIL_EVENTS_ALL,
-                               RAIL_EVENT_RX_ACK_TIMEOUT |                      //
-                                   RAIL_EVENTS_TX_COMPLETION |                  //
-                                   RAIL_EVENT_RX_PACKET_RECEIVED |              //
-                                   RAIL_EVENT_RSSI_AVERAGE_DONE |               //
-                                   RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND | //
-                                   RAIL_EVENT_CAL_NEEDED |                      //
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-                                   RAIL_EVENT_CONFIG_SCHEDULED |   //
-                                   RAIL_EVENT_CONFIG_UNSCHEDULED | //
-#endif
-                                   RAIL_EVENT_SCHEDULER_STATUS //
-    );
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    uint16_t actualLenth = RAIL_SetTxFifo(handle, aCommonConfig->mRailTxFifo, 0, sizeof(aCommonConfig->mRailTxFifo));
-    assert(actualLenth == sizeof(aCommonConfig->mRailTxFifo));
-
-    return handle;
-}
-
-static void efr32RailConfigLoad(efr32BandConfig *aBandConfig)
-{
-    RAIL_Status_t status;
-#if HAL_PA_2P4_LOWPOWER == 1
-    RAIL_TxPowerConfig_t txPowerConfig = {RAIL_TX_POWER_MODE_2P4_LP, BSP_PA_VOLTAGE, 10};
-#else
-    RAIL_TxPowerConfig_t txPowerConfig = {RAIL_TX_POWER_MODE_2P4_HP, BSP_PA_VOLTAGE, 10};
-#endif
-    if (aBandConfig->mChannelConfig != NULL)
-    {
-        uint16_t firstChannel = RAIL_ConfigChannels(gRailHandle, aBandConfig->mChannelConfig, NULL);
-        assert(firstChannel == aBandConfig->mChannelMin);
-
-        txPowerConfig.mode = RAIL_TX_POWER_MODE_SUBGIG;
-    }
-    else
-    {
-        status = RAIL_IEEE802154_Config2p4GHzRadio(gRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-    status = RAIL_ConfigTxPower(gRailHandle, &txPowerConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-static void efr32RadioSetTxPower(int8_t aPowerDbm)
-{
-    RAIL_Status_t              status;
-    RAIL_TxPowerCurvesConfig_t txPowerCurvesConfig = {curves24Hp, curvesSg, curves24Lp, piecewiseSegments};
-
-    status = RAIL_InitTxPowerCurves(&txPowerCurvesConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPowerDbm) * 10);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-static efr32BandConfig *efr32RadioGetBandConfig(uint8_t aChannel)
-{
-    efr32BandConfig *config = NULL;
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        if ((sBandConfigs[i].mChannelMin <= aChannel) && (aChannel <= sBandConfigs[i].mChannelMax))
-        {
-            config = &sBandConfigs[i];
-            break;
-        }
-    }
-
-    return config;
-}
-
-static void efr32ConfigInit(void (*aEventCallback)(RAIL_Handle_t railHandle, RAIL_Events_t events))
-{
-    sCommonConfig.mRailConfig.eventsCallback = aEventCallback;
-    sCommonConfig.mRailConfig.protocol       = NULL; // only used by Bluetooth stack
-#if RADIO_CONFIG_DMP_SUPPORT
-    sCommonConfig.mRailConfig.scheduler = &(sCommonConfig.railSchedState);
-#else
-    sCommonConfig.mRailConfig.scheduler = NULL; // only needed for DMP
-#endif
-
-    uint8_t index = 0;
-
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-    sBandConfigs[index].mChannelConfig = NULL;
-    sBandConfigs[index].mChannelMin    = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN;
-    sBandConfigs[index].mChannelMax    = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX;
-
-    index++;
-#endif
-
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-    sBandConfigs[index].mChannelConfig = channelConfigs[0];
-    sBandConfigs[index].mChannelMin    = OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN;
-    sBandConfigs[index].mChannelMax    = OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX;
-#endif
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    memset(&sRailDebugCounters, 0x00, sizeof(efr32RadioCounters));
-#endif
-
-    gRailHandle = efr32RailInit(&sCommonConfig);
-    assert(gRailHandle != NULL);
-    efr32RailConfigLoad(&(sBandConfigs[0]));
-}
-
-void efr32RadioInit(void)
-{
-    RAIL_Status_t status;
-
-    // check if RAIL_TX_FIFO_SIZE is power of two..
-    assert((RAIL_TX_FIFO_SIZE & (RAIL_TX_FIFO_SIZE - 1)) == 0);
-
-    // check the limits of the RAIL_TX_FIFO_SIZE.
-    assert((RAIL_TX_FIFO_SIZE >= 64) || (RAIL_TX_FIFO_SIZE <= 4096));
-
-    efr32ConfigInit(RAILCb_Generic);
-
-    CMU_ClockEnable(cmuClock_PRS, true);
-
-    status = RAIL_ConfigSleep(gRailHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sReceiveFrame.mLength  = 0;
-    sReceiveFrame.mPsdu    = sReceivePsdu;
-    sTransmitFrame.mLength = 0;
-    sTransmitFrame.mPsdu   = sTransmitPsdu;
-
-    sCurrentBandConfig = efr32RadioGetBandConfig(OPENTHREAD_CONFIG_DEFAULT_CHANNEL);
-    assert(sCurrentBandConfig != NULL);
-
-    memset(sAckedWithFPFifo, 0, sizeof(sAckedWithFPFifo));
-    sAckedWithFPWriteIndex = 0;
-    sAckedWithFPReadIndex  = 0;
-
-    efr32RadioSetTxPower(sTxPowerDbm);
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-    sTransmitError    = OT_ERROR_NONE;
-    sTransmitBusy     = false;
-
-    otLogInfoPlat("Initialized", NULL);
-}
-
-void efr32RadioDeinit(void)
-{
-    RAIL_Status_t status;
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE_ABORT, true);
-    status = RAIL_ConfigEvents(gRailHandle, RAIL_EVENTS_ALL, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sCurrentBandConfig = NULL;
-}
-
-static otError efr32StartEnergyScan(energyScanMode aMode, uint16_t aChannel, RAIL_Time_t aAveragingTimeUs)
-{
-    RAIL_Status_t    status;
-    otError          error  = OT_ERROR_NONE;
-    efr32BandConfig *config = NULL;
-
-    otEXPECT_ACTION(sEnergyScanStatus == ENERGY_SCAN_STATUS_IDLE, error = OT_ERROR_BUSY);
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IN_PROGRESS;
-    sEnergyScanMode   = aMode;
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-
-    config = efr32RadioGetBandConfig(aChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    if (sCurrentBandConfig != config)
-    {
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    RAIL_SchedulerInfo_t scanSchedulerInfo = {.priority        = RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY,
-                                              .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-                                              .transactionTime = aAveragingTimeUs};
-
-    status = RAIL_StartAverageRssi(gRailHandle, aChannel, aAveragingTimeUs, &scanSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-exit:
-    return error;
-}
-
-void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint64_t eui64;
-    uint8_t *eui64Ptr = NULL;
-
-    eui64    = SYSTEM_GetUnique();
-    eui64Ptr = (uint8_t *)&eui64;
-
-    for (uint8_t i = 0; i < OT_EXT_ADDRESS_SIZE; i++)
-    {
-        aIeeeEui64[i] = eui64Ptr[(OT_EXT_ADDRESS_SIZE - 1) - i];
-    }
-}
-
-void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("PANID=%X", aPanId);
-
-    utilsSoftSrcMatchSetPanId(aPanId);
-
-    status = RAIL_IEEE802154_SetPanId(gRailHandle, aPanId, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], aAddress->m8[4],
-                  aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]);
-
-    status = RAIL_IEEE802154_SetLongAddress(gRailHandle, (uint8_t *)aAddress->m8, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ShortAddr=%X", aAddress);
-
-    status = RAIL_IEEE802154_SetShortAddress(gRailHandle, aAddress, 0);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-bool otPlatRadioIsEnabled(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return (sState != OT_RADIO_STATE_DISABLED);
-}
-
-otError otPlatRadioEnable(otInstance *aInstance)
-{
-    otEXPECT(!otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioDisable(otInstance *aInstance)
-{
-    otEXPECT(otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_DISABLED", NULL);
-    sState = OT_RADIO_STATE_DISABLED;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioSleep(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED),
-                    error = OT_ERROR_INVALID_STATE);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-
-    RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
-{
-    otError          error = OT_ERROR_NONE;
-    RAIL_Status_t    status;
-    efr32BandConfig *config;
-
-    OT_UNUSED_VARIABLE(aInstance);
-    otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    if (sCurrentBandConfig != config)
-    {
-        RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    RAIL_SchedulerInfo_t bgRxSchedulerInfo = {
-        .priority = RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY,
-        // sliptime/transaction time is not used for bg rx
-    };
-
-    status = RAIL_StartRx(gRailHandle, aChannel, &bgRxSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_RECEIVE", NULL);
-    sState                 = OT_RADIO_STATE_RECEIVE;
-    sReceiveFrame.mChannel = aChannel;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
-{
-    otError           error      = OT_ERROR_NONE;
-    RAIL_CsmaConfig_t csmaConfig = RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA;
-    RAIL_TxOptions_t  txOptions  = RAIL_TX_OPTIONS_DEFAULT;
-    efr32BandConfig * config;
-    RAIL_Status_t     status;
-    uint8_t           frameLength;
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    sRailDebugCounters.mRailPlatTxTriggered++;
-#endif
-
-    assert(sTransmitBusy == false);
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_DISABLED) && (sState != OT_RADIO_STATE_TRANSMIT),
-                    error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aFrame->mChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    sState         = OT_RADIO_STATE_TRANSMIT;
-    sTransmitError = OT_ERROR_NONE;
-    sTransmitBusy  = true;
-
-    if (sCurrentBandConfig != config)
-    {
-        RAIL_Idle(gRailHandle, RAIL_IDLE, true);
-        efr32RailConfigLoad(config);
-        sCurrentBandConfig = config;
-    }
-
-    frameLength = (uint8_t)aFrame->mLength;
-    RAIL_WriteTxFifo(gRailHandle, &frameLength, sizeof frameLength, true);
-    RAIL_WriteTxFifo(gRailHandle, aFrame->mPsdu, frameLength - 2, false);
-
-    RAIL_SchedulerInfo_t txSchedulerInfo = {
-        .priority        = RADIO_SCHEDULER_TX_PRIORITY,
-        .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-        .transactionTime = 0, // will be calculated later if DMP is used
-    };
-
-    if (aFrame->mPsdu[0] & IEEE802154_ACK_REQUEST)
-    {
-        txOptions |= RAIL_TX_OPTION_WAIT_FOR_ACK;
-
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time we wait for ACK
-        if (RAIL_GetSymbolRate(gRailHandle) > 0)
-        {
-            txSchedulerInfo.transactionTime += 12 * 1e6 / RAIL_GetSymbolRate(gRailHandle);
-        }
-        else
-        {
-            txSchedulerInfo.transactionTime += 12 * RADIO_TIMING_DEFAULT_SYMBOLTIME_US;
-        }
-#endif
-    }
-
-#if RADIO_CONFIG_DMP_SUPPORT
-    // time needed for the frame itself
-    // 4B preamble, 1B SFD, 1B PHR is not counted in frameLength
-    if (RAIL_GetBitRate(gRailHandle) > 0)
-    {
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * 8 * 1e6 / RAIL_GetBitRate(gRailHandle);
-    }
-    else
-    { // assume 250kbps
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * RADIO_TIMING_DEFAULT_BYTETIME_US;
-    }
-#endif
-
-    if (aFrame->mInfo.mTxInfo.mCsmaCaEnabled)
-    {
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time needed for CSMA/CA
-        txSchedulerInfo.transactionTime += RADIO_TIMING_CSMA_OVERHEAD_US;
-#endif
-        csmaConfig.csmaTries    = aFrame->mInfo.mTxInfo.mMaxCsmaBackoffs;
-        csmaConfig.ccaThreshold = sCcaThresholdDbm;
-
-        status = RAIL_StartCcaCsmaTx(gRailHandle, aFrame->mChannel, txOptions, &csmaConfig, &txSchedulerInfo);
-    }
-    else
-    {
-        status = RAIL_StartTx(gRailHandle, aFrame->mChannel, txOptions, &txSchedulerInfo);
-    }
-
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStarted++;
-#endif
-        otPlatRadioTxStarted(aInstance, aFrame);
-    }
-    else
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStartFailed++;
-#endif
-        sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-        sTransmitBusy  = false;
-        otSysEventSignalPending();
-    }
-
-exit:
-    return error;
-}
-
-otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return &sTransmitFrame;
-}
-
-int8_t otPlatRadioGetRssi(otInstance *aInstance)
-{
-    otError  error;
-    uint32_t start;
-    int8_t   rssi = OT_RADIO_RSSI_INVALID;
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    error = efr32StartEnergyScan(ENERGY_SCAN_MODE_SYNC, sReceiveFrame.mChannel, EFR32_RSSI_AVERAGING_TIME);
-    otEXPECT(error == OT_ERROR_NONE);
-
-    start = RAIL_GetTime();
-
-    // waiting for the event RAIL_EVENT_RSSI_AVERAGE_DONE
-    while (sEnergyScanStatus == ENERGY_SCAN_STATUS_IN_PROGRESS &&
-           ((RAIL_GetTime() - start) < EFR32_RSSI_AVERAGING_TIMEOUT))
-        ;
-
-    if (sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        rssi = sEnergyScanResultDbm;
-    }
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-exit:
-    return rssi;
-}
-
-otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_ENERGY_SCAN;
-}
-
-bool otPlatRadioGetPromiscuous(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return sPromiscuous;
-}
-
-void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    sPromiscuous = aEnable;
-
-    status = RAIL_IEEE802154_SetPromiscuousMode(gRailHandle, aEnable);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // set Frame Pending bit for all outgoing ACKs if aEnable is false
-    sIsSrcMatchEnabled = aEnable;
-}
-
-static bool sAckedWithFPFifoIsFull(void)
-{
-    return (uint32_t)(sAckedWithFPWriteIndex - sAckedWithFPReadIndex) == otARRAY_LENGTH(sAckedWithFPFifo);
-}
-
-static bool sAckedWithFPFifoIsEmpty(void)
-{
-    return (uint32_t)(sAckedWithFPWriteIndex - sAckedWithFPReadIndex) == 0;
-}
-
-static efr32AckedWithFP *sAckedWithFPFifoGetWriteSlot(void)
-{
-    uint32_t idx = sAckedWithFPWriteIndex & (otARRAY_LENGTH(sAckedWithFPFifo) - 1);
-    return &sAckedWithFPFifo[idx];
-}
-
-static const efr32AckedWithFP *sAckedWithFPFifoGetReadSlot(void)
-{
-    uint32_t idx = sAckedWithFPReadIndex & (otARRAY_LENGTH(sAckedWithFPFifo) - 1);
-    return &sAckedWithFPFifo[idx];
-}
-
-static void insertIeee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
-{
-    assert(!sAckedWithFPFifoIsFull());
-    efr32AckedWithFP *const slot = sAckedWithFPFifoGetWriteSlot();
-
-    RAIL_RxPacketInfo_t packetInfo;
-
-    RAIL_GetRxIncomingPacketInfo(aRailHandle, &packetInfo);
-    assert(packetInfo.packetBytes >= 4); // PHR + FCF + DSN
-
-    if (packetInfo.packetBytes > sizeof(slot->mPacket))
-    {
-        packetInfo.packetBytes = sizeof(slot->mPacket);
-        if (packetInfo.firstPortionBytes >= sizeof(slot->mPacket))
-        {
-            packetInfo.firstPortionBytes = sizeof(slot->mPacket);
-            packetInfo.lastPortionData   = NULL;
-        }
-    }
-    slot->mLength = packetInfo.packetBytes;
-    RAIL_CopyRxPacket(slot->mPacket, &packetInfo);
-
-    ++sAckedWithFPWriteIndex;
-}
-
-static bool wasAckedWithFramePending(const uint8_t *aPsdu, uint8_t aPsduLength)
-{
-    bool     ackedWithFramePending = false;
-    uint16_t fcf                   = aPsdu[IEEE802154_FCF_OFFSET] | (aPsdu[IEEE802154_FCF_OFFSET + 1] << 8);
-
-    otEXPECT((fcf & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_MAC_COMMAND);
-
-    while (!(ackedWithFramePending || sAckedWithFPFifoIsEmpty()))
-    {
-        const efr32AckedWithFP *const slot = sAckedWithFPFifoGetReadSlot();
-        if ((slot->mPacket[0] == aPsduLength) && (memcmp(slot->mPacket + 1, aPsdu, slot->mLength - 1) == 0))
-        {
-            ackedWithFramePending = true;
-        }
-        ++sAckedWithFPReadIndex;
-    }
-
-exit:
-    return ackedWithFramePending;
-}
-
-static void processNextRxPacket(otInstance *aInstance)
-{
-    RAIL_RxPacketHandle_t  packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    RAIL_RxPacketInfo_t    packetInfo;
-    RAIL_RxPacketDetails_t packetDetails;
-    RAIL_Status_t          status;
-    uint16_t               length;
-
-    packetHandle = RAIL_GetRxPacketInfo(gRailHandle, RAIL_RX_PACKET_HANDLE_OLDEST, &packetInfo);
-
-    otEXPECT_ACTION(packetHandle != RAIL_RX_PACKET_HANDLE_INVALID &&
-                        packetInfo.packetStatus == RAIL_RX_PACKET_READY_SUCCESS,
-                    packetHandle = RAIL_RX_PACKET_HANDLE_INVALID);
-
-    status = RAIL_GetRxPacketDetailsAlt(gRailHandle, packetHandle, &packetDetails);
-    otEXPECT(status == RAIL_STATUS_NO_ERROR);
-
-    length = packetInfo.packetBytes + 1;
-
-    // check the length in recv packet info structure; RAIL should take care of this.
-    assert(length == packetInfo.firstPortionData[0]);
-
-    // check the length validity of recv packet; RAIL should take care of this.
-    assert(length >= IEEE802154_MIN_LENGTH && length <= IEEE802154_MAX_LENGTH);
-
-    otLogInfoPlat("Received data:%d", length);
-
-    // skip length byte
-    assert(packetInfo.firstPortionBytes > 0);
-    packetInfo.firstPortionData++;
-    packetInfo.firstPortionBytes--;
-    packetInfo.packetBytes--;
-
-    // read packet
-    RAIL_CopyRxPacket(sReceiveFrame.mPsdu, &packetInfo);
-
-    status = RAIL_ReleaseRxPacket(gRailHandle, packetHandle);
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-        packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    }
-
-    sReceiveFrame.mLength = length;
-
-    if (packetDetails.isAck)
-    {
-        assert((length == IEEE802154_ACK_LENGTH) &&
-               (sReceiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK);
-
-        RAIL_YieldRadio(gRailHandle);
-        sTransmitBusy = false;
-
-        if (sReceiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET])
-        {
-            sTransmitError = OT_ERROR_NONE;
-        }
-        else
-        {
-            sTransmitError = OT_ERROR_NO_ACK;
-        }
-    }
-    else
-    {
-        // signal MAC layer for each received frame if promiscuous is enabled
-        // otherwise only signal MAC layer for non-ACK frame
-        otEXPECT(sPromiscuous || (length != IEEE802154_ACK_LENGTH));
-
-        sReceiveError = OT_ERROR_NONE;
-
-        sReceiveFrame.mInfo.mRxInfo.mRssi = packetDetails.rssi;
-        sReceiveFrame.mInfo.mRxInfo.mLqi  = packetDetails.lqi;
-
-        // Get the timestamp when the SFD was received
-        assert(packetDetails.timeReceived.timePosition != RAIL_PACKET_TIME_INVALID);
-        packetDetails.timeReceived.totalPacketBytes = length + 1;
-
-        status = RAIL_GetRxTimeSyncWordEndAlt(gRailHandle, &packetDetails);
-        assert(status == RAIL_STATUS_NO_ERROR);
-        sReceiveFrame.mInfo.mRxInfo.mTimestamp = packetDetails.timeReceived.packetTime;
-
-        // Set this flag only when the packet is really acknowledged with frame pending set.
-        sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending =
-            wasAckedWithFramePending(sReceiveFrame.mPsdu, sReceiveFrame.mLength);
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-        }
-        else
-#endif
-        {
-            otLogInfoPlat("Received %d bytes", sReceiveFrame.mLength);
-            otPlatRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailPlatRadioReceiveDoneCbCount++;
-#endif
-        }
-    }
-
-    otSysEventSignalPending();
-
-exit:
-
-    if (packetHandle != RAIL_RX_PACKET_HANDLE_INVALID)
-    {
-        RAIL_ReleaseRxPacket(gRailHandle, packetHandle);
-    }
-}
-
-static void ieee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
-{
-    RAIL_Status_t status;
-
-    if (sIsSrcMatchEnabled)
-    {
-        RAIL_IEEE802154_Address_t sourceAddress;
-
-        status = RAIL_IEEE802154_GetAddress(aRailHandle, &sourceAddress);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-        if ((sourceAddress.length == RAIL_IEEE802154_LongAddress &&
-             utilsSoftSrcMatchExtFindEntry((otExtAddress *)sourceAddress.longAddress) >= 0) ||
-            (sourceAddress.length == RAIL_IEEE802154_ShortAddress &&
-             utilsSoftSrcMatchShortFindEntry(sourceAddress.shortAddress) >= 0))
-        {
-            status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-            assert(status == RAIL_STATUS_NO_ERROR);
-            insertIeee802154DataRequestCommand(aRailHandle);
-        }
-    }
-    else
-    {
-        status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-        insertIeee802154DataRequestCommand(aRailHandle);
-    }
-}
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents)
-{
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    if (aEvents & RAIL_EVENT_CONFIG_SCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigScheduled++;
-    }
-    if (aEvents & RAIL_EVENT_CONFIG_UNSCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigUnScheduled++;
-    }
-#endif
-    if (aEvents & RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND)
-    {
-        ieee802154DataRequestCommand(aRailHandle);
-    }
-
-    if (aEvents & RAIL_EVENTS_TX_COMPLETION)
-    {
-        if (aEvents & RAIL_EVENT_TX_PACKET_SENT)
-        {
-            if ((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0)
-            {
-                RAIL_YieldRadio(aRailHandle);
-                sTransmitError = OT_ERROR_NONE;
-                sTransmitBusy  = false;
-            }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventPacketSent++;
-#endif
-        }
-        else if (aEvents & RAIL_EVENT_TX_CHANNEL_BUSY)
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventChannelBusy++;
-#endif
-        }
-        else
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventTxAbort++;
-#endif
-        }
-    }
-
-    if (aEvents & RAIL_EVENT_RX_ACK_TIMEOUT)
-    {
-        RAIL_YieldRadio(aRailHandle);
-        sTransmitError = OT_ERROR_NO_ACK;
-        sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventNoAck++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RX_PACKET_RECEIVED)
-    {
-        RAIL_HoldRxPacket(aRailHandle);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventPacketReceived++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_CAL_NEEDED)
-    {
-        RAIL_Status_t status;
-
-        status = RAIL_Calibrate(aRailHandle, NULL, RAIL_CAL_ALL_PENDING);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventCalNeeded++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RSSI_AVERAGE_DONE)
-    {
-        const int16_t energyScanResultQuarterDbm = RAIL_GetAverageRssi(aRailHandle);
-        RAIL_YieldRadio(aRailHandle);
-
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_COMPLETED;
-
-        if (energyScanResultQuarterDbm == RAIL_RSSI_INVALID)
-        {
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-        else
-        {
-            sEnergyScanResultDbm = energyScanResultQuarterDbm / QUARTER_DBM_IN_DBM;
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioEnergyScanDoneCbCount++;
-#endif
-    }
-    if (aEvents & RAIL_EVENT_SCHEDULER_STATUS)
-    {
-        RAIL_SchedulerStatus_t status = RAIL_GetSchedulerStatus(aRailHandle);
-
-        assert(status != RAIL_SCHEDULER_STATUS_INTERNAL_ERROR);
-
-        if (status == RAIL_SCHEDULER_STATUS_CCA_CSMA_TX_FAIL || status == RAIL_SCHEDULER_STATUS_SINGLE_TX_FAIL ||
-            status == RAIL_SCHEDULER_STATUS_SCHEDULED_TX_FAIL ||
-            (status == RAIL_SCHEDULER_STATUS_SCHEDULE_FAIL && sTransmitBusy) ||
-            (status == RAIL_SCHEDULER_STATUS_EVENT_INTERRUPTED && sTransmitBusy))
-        {
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventSchedulerStatusError++;
-#endif
-        }
-        else if (status == RAIL_SCHEDULER_STATUS_AVERAGE_RSSI_FAIL)
-        {
-            sEnergyScanStatus    = ENERGY_SCAN_STATUS_COMPLETED;
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        else if (sTransmitBusy)
-        {
-            sRailDebugCounters.mRailEventsSchedulerStatusLastStatus = status;
-            sRailDebugCounters.mRailEventsSchedulerStatusTransmitBusy++;
-        }
-#endif
-    }
-
-    otSysEventSignalPending();
-}
-
-otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return efr32StartEnergyScan(ENERGY_SCAN_MODE_ASYNC, aScanChannel, (RAIL_Time_t)aScanDuration * US_IN_MS);
-}
-
-void efr32RadioProcess(otInstance *aInstance)
-{
-    // We should process the received packet first. Adding it at the end of this function,
-    // will delay the stack notification until the next call to efr32RadioProcess()
-    processNextRxPacket(aInstance);
-
-    if (sState == OT_RADIO_STATE_TRANSMIT && sTransmitBusy == false)
-    {
-        if (sTransmitError != OT_ERROR_NONE)
-        {
-            otLogDebgPlat("Transmit failed ErrorCode=%d", sTransmitError);
-        }
-
-        sState = OT_RADIO_STATE_RECEIVE;
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioTransmitDone(aInstance, &sTransmitFrame, sTransmitError);
-        }
-        else
-#endif
-            if (((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) || (sTransmitError != OT_ERROR_NONE))
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, sTransmitError);
-        }
-        else
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, &sReceiveFrame, sTransmitError);
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioTxDoneCbCount++;
-#endif
-
-        otSysEventSignalPending();
-    }
-    else if (sEnergyScanMode == ENERGY_SCAN_MODE_ASYNC && sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-        otPlatRadioEnergyScanDone(aInstance, sEnergyScanResultDbm);
-        otSysEventSignalPending();
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventEnergyScanCompleted++;
-#endif
-    }
-}
-
-otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
-    *aPower = sTxPowerDbm;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPower) * 10);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    sTxPowerDbm = aPower;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-    otEXPECT_ACTION(aThreshold != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    *aThreshold = sCcaThresholdDbm;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sCcaThresholdDbm = aThreshold;
-
-    return OT_ERROR_NONE;
-}
-
-int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return EFR32_RECEIVE_SENSITIVITY;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/rail_config.h b/third_party/openthread/repo/examples/platforms/efr32mg13/rail_config.h
deleted file mode 100644 (file)
index 5a62825..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __RAIL_CONFIG_H__
-#define __RAIL_CONFIG_H__
-
-#include "board_config.h"
-#include "rail_types.h"
-#include <stdint.h>
-
-#define RADIO_CONFIG_XTAL_FREQUENCY 38400000UL
-
-#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
-extern const RAIL_ChannelConfig_t *channelConfigs[];
-#endif
-
-#endif // __RAIL_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/Makefile.am
deleted file mode 100644 (file)
index 9be5713..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-
-# Always package (e.g. for 'make dist') these subdirectories.
-
-DIST_SUBDIRS                            = \
-    sleepy-demo-mtd                       \
-    sleepy-demo-ftd                       \
-    $(NULL)
-
-# Always build (e.g. for 'make all') these subdirectories.
-
-SUBDIRS                                 = \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-SUBDIRS                                += sleepy-demo-mtd sleepy-demo-ftd
-endif
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/README.md b/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/README.md
deleted file mode 100644 (file)
index 847f8a0..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# EFR32MG13 Sleepy Demo Example
-
-The EFR32 Sleepy applications demonstrates Sleepy End Device behavior using the EFR32's low power EM2 mode. The steps below will take you through the process of building and running the demo
-
-For setting up the build environment refer to [examples/platforms/efr32mg13/README.md](../README.md).
-
-## 1. Build
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-$ make -f examples/Makefile-efr32mg13 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BOARD=BRD4168A
-```
-
-Convert the resulting executables into S-Record format and append a s37 suffix.
-
-```bash
-$ cd output/efr32mg13/bin
-$ arm-none-eabi-objcopy -O srec sleepy-demo-mtd sleepy-demo-mtd.s37
-$ arm-none-eabi-objcopy -O srec sleepy-demo-ftd sleepy-demo-ftd.s37
-```
-
-In Silicon Labs Simplicity Studio flash one device with the sleepy-demo-mtd.s37 image and the other device with the sleepy-demo-ftd.s37 image.
-
-For instructions on flashing firmware see [examples/platforms/efr32mg13/README.md](../README.md#flash-binaries)
-
-## 2. Starting nodes
-
-For demonstration purposes the network settings are hardcoded within the source files. The devices start Thread and form a network within a few seconds of powering on. In a real-life application the devices should implement and go through a commissioning process to create a network and add devices.
-
-When the sleepy-demo-ftd device is started in the CLI the user shall see:
-
-```
-sleepy-demo-ftd started
-sleepy-demo-ftd changed to leader
-```
-
-When the sleepy-demo-mtd device starts it joins the pre-configured Thread network before disabling Rx-On-Idle to become a Sleepy-End-Device.
-
-Use the command "child table" in the FTD console and observe the R flag of the child is 0.
-
-```
-> child table
-| ID  | RLOC16 | Timeout    | Age        | LQ In | C_VN |R|S|D|N| Extended MAC     |
-+-----+--------+------------+------------+-------+------+-+-+-+-+------------------+
-|   1 | 0x8401 |        240 |          3 |     3 |    3 |0|1|0|0| 8e8582dbd78c243c |
-
-Done
-```
-
-## 3. Buttons on the MTD
-
-Pressing button 0 on the MTD toggles between operating as a Minimal End Device (MED) and a Sleepy End Device (SED) with the RX off when idle.
-
-Pressing button 1 on the MTD sends a multicast UDP message containing the string "mtd button". The FTD listens on the multicast address and will toggle LED 0 and display a message in the CLI showing "Message Received: mtd button".
-
-## 4. Buttons on the FTD
-
-Pressing either button 0 or 1 on the FTD will send a UDP message to the FTD containing the string "ftd button". The MTD must first send a multicast message by pressing the MTD's button 1 so that the FTD knows the address of the MTD to send messages to.
-
-This will toggle the state of LED0 on the MTD. If the MTD is operating as a sleepy end device then the MTD polls the parent every 5 seconds for messages and will update the LED state on the next poll.
-
-## 5. Monitoring power consumption of the MTD
-
-Open the Energy Profiler within Silicon Labs Simplicity Studio. Within the Quick Access menu select Start Energy Capture... and select the MTD device. When operating as a Sleepy End Device with no LEDs on the current should be under 20 microamps with occasional spikes during waking and polling the parent. With the LED on the MTD has a current consumption of approximately 1mA.
-
-When operating as a Minimal End Device with the Rx on Idle observe that the current is in the order of 10ma.
-
-With further configuration of GPIOs and peripherals it is possible to reduce the sleepy current consumption further.
-
-## 6. Notes on sleeping, sleepy callback and interrupts
-
-To allow the EFR32 to enter sleepy mode the application must register a callback with efr32SetSleepCallback. The return value of callback is used to indicate that the application has no further work to do and that it is safe to go into a low power mode. The callback is called with interrupts disabled so should do the minimum required to check if it can sleep.
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/Makefile.am
deleted file mode 100644 (file)
index 10b31df..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-include $(top_srcdir)/examples/platforms/Makefile.platform.am
-
-override CFLAGS    := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS  := $(filter-out -Wconversion,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-$(top_builddir)/examples/platforms/efr32mg13/libopenthread-efr32mg13.a:
-       (cd $(top_builddir)/examples/platforms/efr32mg13/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg13.a )
-
-bin_PROGRAMS                                                                  = \
-    $(NULL)
-
-CPPFLAGS_COMMON                                                              += \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -Wno-sign-compare                                                           \
-    -DCORTEXM3                                                                  \
-    -DPHY=EMBER_PHY_RAIL                                                        \
-    -DMICRO=EMBER_MICRO_CORTEXM3_EFR32                                          \
-    -DCORTEXM3_EFM32_MICRO                                                      \
-    -DPLAT=EMBER_PLATFORM_CORTEXM3                                              \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg13/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG13_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG13P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-LDADD_COMMON                                                                 += \
-    $(NULL)
-
-LDFLAGS_COMMON                                                               += \
-    $(NULL)
-
-LIBTOOLFLAGS_COMMON                                                          += \
-    $(NULL)
-
-SOURCES_COMMON                                                               += \
-    main.c                                                                      \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-LDADD_COMMON                                                                 += \
-    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                         \
-    $(NULL)
-endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-bin_PROGRAMS                                                                 += \
-    sleepy-demo-ftd                                                             \
-    $(NULL)
-endif
-
-sleepy_demo_ftd_CPPFLAGS                                                      = \
-    $(CPPFLAGS_COMMON)                                                          \
-    $(NULL)
-
-sleepy_demo_ftd_LDADD                                                         = \
-    $(top_builddir)/src/cli/libopenthread-cli-ftd.a                             \
-    $(top_builddir)/src/core/libopenthread-ftd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(top_builddir)/src/core/libopenthread-ftd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(NULL)
-
-sleepy_demo_ftd_LDFLAGS                                                       = \
-    $(LDFLAGS_COMMON)                                                           \
-    $(NULL)
-
-sleepy_demo_ftd_LIBTOOLFLAGS                                                  = \
-    $(LIBTOOLFLAGS_COMMON)                                                      \
-    $(NULL)
-
-sleepy_demo_ftd_SOURCES                                                       = \
-    $(SOURCES_COMMON)                                                           \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_LINKER_MAP
-sleepy_demo_ftd_LDFLAGS  += -Wl,-Map=sleepy-demo-ftd.map
-endif
-
-if OPENTHREAD_BUILD_COVERAGE
-CPPFLAGS_COMMON                                                              += \
-    -DOPENTHREAD_ENABLE_COVERAGE                                                \
-    $(NULL)
-
-CLEANFILES = $(wildcard *.gcda *.gcno)
-endif # OPENTHREAD_BUILD_COVERAGE
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/main.c b/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/main.c
deleted file mode 100644 (file)
index 7a489b1..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "bsp.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "gpiointerrupt.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "openthread-system.h"
-#include <assert.h>
-#include <common/logging.hpp>
-#include <openthread-core-config.h>
-#include <string.h>
-#include <openthread/cli.h>
-#include <openthread/config.h>
-#include <openthread/dataset_ftd.h>
-#include <openthread/diag.h>
-#include <openthread/instance.h>
-#include <openthread/message.h>
-#include <openthread/tasklet.h>
-#include <openthread/thread.h>
-#include <openthread/udp.h>
-#include <openthread/platform/logging.h>
-
-// Constants
-#define MULTICAST_ADDR "ff03::1"
-#define MULTICAST_PORT 123
-#define RECV_PORT 234
-#define MTD_MESSAGE "mtd button"
-#define FTD_MESSAGE "ftd button"
-
-// Types
-typedef struct ButtonArray
-{
-    GPIO_Port_TypeDef port;
-    unsigned int      pin;
-} ButtonArray_t;
-
-// Prototypes
-void setNetworkConfiguration(otInstance *aInstance);
-void handleNetifStateChanged(uint32_t aFlags, void *aContext);
-void gpioInit(void (*gpioCallback)(uint8_t pin));
-void buttonCallback(uint8_t pin);
-void initUdp(void);
-void applicationTick(void);
-void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
-
-// Variables
-static otInstance *        instance;
-static otUdpSocket         sFtdSocket;
-static bool                sLedOn             = false;
-static bool                sHaveSwitchAddress = false;
-static otIp6Address        sSwitchAddress;
-static bool                sFtdButtonPressed              = false;
-static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
-
-void otTaskletsSignalPending(otInstance *aInstance)
-{
-    (void)aInstance;
-}
-
-int main(int argc, char *argv[])
-{
-    otSysInit(argc, argv);
-    gpioInit(buttonCallback);
-
-    instance = otInstanceInitSingle();
-    assert(instance);
-
-    otCliUartInit(instance);
-    otCliOutputFormat("sleepy-demo-ftd started\r\n");
-
-    setNetworkConfiguration(instance);
-    otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
-    initUdp();
-
-    otIp6SetEnabled(instance, true);
-    otThreadSetEnabled(instance, true);
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-        applicationTick();
-    }
-
-    otInstanceFinalize(instance);
-    return 0;
-}
-
-/*
- * Provide, if required an "otPlatLog()" function
- */
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-    OT_UNUSED_VARIABLE(aFormat);
-
-    va_list ap;
-    va_start(ap, aFormat);
-    otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
-    va_end(ap);
-}
-#endif
-
-/**
- * Override default network settings, such as panid, so the devices can join a network
- */
-void setNetworkConfiguration(otInstance *aInstance)
-{
-    static char          aNetworkName[] = "SleepyEFR32";
-    otOperationalDataset aDataset;
-
-    memset(&aDataset, 0, sizeof(otOperationalDataset));
-
-    /*
-     * Fields that can be configured in otOperationDataset to override defaults:
-     *     Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
-     *     Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
-     */
-    aDataset.mActiveTimestamp                      = 1;
-    aDataset.mComponents.mIsActiveTimestampPresent = true;
-
-    /* Set Channel to 15 */
-    aDataset.mChannel                      = 15;
-    aDataset.mComponents.mIsChannelPresent = true;
-
-    /* Set Pan ID to 2222 */
-    aDataset.mPanId                      = (otPanId)0x2222;
-    aDataset.mComponents.mIsPanIdPresent = true;
-
-    /* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
-    uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
-    aDataset.mComponents.mIsExtendedPanIdPresent = true;
-
-    /* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
-    uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
-    aDataset.mComponents.mIsMasterKeyPresent = true;
-
-    /* Set Network Name to SleepyEFR32 */
-    size_t length = strlen(aNetworkName);
-    assert(length <= OT_NETWORK_NAME_MAX_SIZE);
-    memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
-    aDataset.mComponents.mIsNetworkNamePresent = true;
-
-    otDatasetSetActive(aInstance, &aDataset);
-}
-
-void handleNetifStateChanged(uint32_t aFlags, void *aContext)
-{
-    if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
-    {
-        otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
-
-        switch (changedRole)
-        {
-        case OT_DEVICE_ROLE_LEADER:
-            otCliOutputFormat("sleepy-demo-ftd changed to leader\r\n");
-            break;
-        case OT_DEVICE_ROLE_ROUTER:
-            otCliOutputFormat("sleepy-demo-ftd changed to router\r\n");
-            break;
-
-        case OT_DEVICE_ROLE_CHILD:
-            break;
-
-        case OT_DEVICE_ROLE_DETACHED:
-        case OT_DEVICE_ROLE_DISABLED:
-            break;
-        }
-    }
-}
-
-void gpioInit(void (*callback)(uint8_t pin))
-{
-    // set up button GPIOs to input with pullups
-    for (int i = 0; i < BSP_BUTTON_COUNT; i++)
-    {
-        GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
-    }
-    // set up interrupt based callback function on falling edge
-    GPIOINT_Init();
-    GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
-    GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
-    GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
-    GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
-
-    BSP_LedsInit();
-    BSP_LedClear(0);
-    BSP_LedClear(1);
-}
-
-void initUdp(void)
-{
-    otError    error;
-    otSockAddr sockaddr;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-
-    otIp6AddressFromString(MULTICAST_ADDR, &sockaddr.mAddress);
-    sockaddr.mPort = MULTICAST_PORT;
-
-    error = otUdpOpen(instance, &sFtdSocket, sFtdReceiveCallback, NULL);
-    if (error != OT_ERROR_NONE)
-    {
-        otCliOutputFormat("FTD failed to open udp multicast\r\n");
-        return;
-    }
-
-    error = otUdpBind(instance, &sFtdSocket, &sockaddr);
-    if (error != OT_ERROR_NONE)
-    {
-        otUdpClose(instance, &sFtdSocket);
-        otCliOutputFormat("FTD failed to bind udp multicast\r\n");
-        return;
-    }
-}
-
-void buttonCallback(uint8_t pin)
-{
-    OT_UNUSED_VARIABLE(pin);
-    sFtdButtonPressed = true;
-}
-
-void applicationTick(void)
-{
-    otError       error = 0;
-    otMessageInfo messageInfo;
-    otMessage *   message = NULL;
-    char *        payload = FTD_MESSAGE;
-
-    if (sFtdButtonPressed == true)
-    {
-        sFtdButtonPressed = false;
-
-        if (sHaveSwitchAddress)
-        {
-            memset(&messageInfo, 0, sizeof(messageInfo));
-            memcpy(&messageInfo.mPeerAddr, &sSwitchAddress, sizeof messageInfo.mPeerAddr);
-            messageInfo.mPeerPort = RECV_PORT;
-
-            message = otUdpNewMessage(instance, NULL);
-
-            if (message != NULL)
-            {
-                error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
-
-                if (error == OT_ERROR_NONE)
-                {
-                    error = otUdpSend(instance, &sFtdSocket, message, &messageInfo);
-
-                    if (error == OT_ERROR_NONE)
-                    {
-                        return;
-                    }
-                }
-            }
-
-            if (message != NULL)
-            {
-                otMessageFree(message);
-            }
-        }
-    }
-}
-
-void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aMessage);
-    OT_UNUSED_VARIABLE(aMessageInfo);
-    uint8_t buf[1500];
-    int     length;
-
-    sLedOn = !sLedOn;
-
-    if (sLedOn)
-    {
-        BSP_LedSet(0);
-    }
-    else
-    {
-        BSP_LedClear(0);
-    }
-
-    length      = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
-    buf[length] = '\0';
-    otCliOutputFormat("Message Received: %s\r\n", buf);
-
-    sHaveSwitchAddress = true;
-    memcpy(&sSwitchAddress, &aMessageInfo->mPeerAddr, sizeof sSwitchAddress);
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/Makefile.am
deleted file mode 100644 (file)
index d3ad8ad..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-include $(top_srcdir)/examples/platforms/Makefile.platform.am
-
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-$(top_builddir)/examples/platforms/efr32mg13/libopenthread-efr32mg13.a:
-       (cd $(top_builddir)/examples/platforms/efr32mg13/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg13.a )
-
-bin_PROGRAMS                                                                  = \
-    $(NULL)
-
-CPPFLAGS_COMMON                                                              += \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -Wno-sign-compare                                                           \
-    -DCORTEXM3                                                                  \
-    -DPHY=EMBER_PHY_RAIL                                                        \
-    -DMICRO=EMBER_MICRO_CORTEXM3_EFR32                                          \
-    -DCORTEXM3_EFM32_MICRO                                                      \
-    -DPLAT=EMBER_PLATFORM_CORTEXM3                                              \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg13/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG13_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG13P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-LDADD_COMMON                                                                 += \
-    $(NULL)
-
-LDFLAGS_COMMON                                                               += \
-    $(NULL)
-
-LIBTOOLFLAGS_COMMON                                                          += \
-    $(NULL)
-
-SOURCES_COMMON                                                               += \
-    main.c                                                                      \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-LDADD_COMMON                                                                 += \
-    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                         \
-    $(NULL)
-endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-bin_PROGRAMS                                                                 += \
-    sleepy-demo-mtd                                                             \
-    $(NULL)
-endif
-
-sleepy_demo_mtd_CPPFLAGS                                                      = \
-    $(CPPFLAGS_COMMON)                                                          \
-    $(NULL)
-
-sleepy_demo_mtd_LDADD                                                         = \
-    $(top_builddir)/src/cli/libopenthread-cli-mtd.a                             \
-    $(top_builddir)/src/core/libopenthread-mtd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(top_builddir)/src/core/libopenthread-mtd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(NULL)
-
-sleepy_demo_mtd_LDFLAGS                                                       = \
-    $(LDFLAGS_COMMON)                                                           \
-    $(NULL)
-
-sleepy_demo_mtd_LIBTOOLFLAGS                                                  = \
-    $(LIBTOOLFLAGS_COMMON)                                                      \
-    $(NULL)
-
-sleepy_demo_mtd_SOURCES                                                       = \
-    $(SOURCES_COMMON)                                                           \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_LINKER_MAP
-sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
-endif
-
-if OPENTHREAD_BUILD_COVERAGE
-CPPFLAGS_COMMON                                                              += \
-    -DOPENTHREAD_ENABLE_COVERAGE                                                \
-    $(NULL)
-
-CLEANFILES = $(wildcard *.gcda *.gcno)
-endif # OPENTHREAD_BUILD_COVERAGE
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/main.c b/third_party/openthread/repo/examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/main.c
deleted file mode 100644 (file)
index b1d34a3..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <string.h>
-
-#include "bsp.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "gpiointerrupt.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "openthread-system.h"
-#include "platform-efr32.h"
-#include <common/logging.hpp>
-#include <openthread-core-config.h>
-#include <openthread/cli.h>
-#include <openthread/config.h>
-#include <openthread/dataset_ftd.h>
-#include <openthread/diag.h>
-#include <openthread/instance.h>
-#include <openthread/link.h>
-#include <openthread/message.h>
-#include <openthread/tasklet.h>
-#include <openthread/thread.h>
-#include <openthread/udp.h>
-#include <openthread/platform/logging.h>
-
-// Constants
-#define MULTICAST_ADDR "ff03::1"
-#define MULTICAST_PORT 123
-#define RECV_PORT 234
-#define SLEEPY_POLL_PERIOD_MS 5000
-#define MTD_MESSAGE "mtd button"
-#define FTD_MESSAGE "ftd button"
-
-// Types
-typedef struct ButtonArray
-{
-    GPIO_Port_TypeDef port;
-    unsigned int      pin;
-} ButtonArray_t;
-
-// Prototypes
-bool sleepCb(void);
-void setNetworkConfiguration(otInstance *aInstance);
-void handleNetifStateChanged(uint32_t aFlags, void *aContext);
-void gpioInit(void (*gpioCallback)(uint8_t pin));
-void buttonCallback(uint8_t pin);
-void initUdp(void);
-void applicationTick(void);
-void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
-
-// Variables
-static otInstance *        instance;
-static otUdpSocket         sMtdSocket;
-static otSockAddr          sMulticastSockAddr;
-static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
-static bool                sButtonPressed                 = false;
-static bool                sRxOnIdleButtonPressed         = false;
-static bool                sLedOn                         = false;
-static bool                sAllowDeepSleep                = false;
-static bool                sTaskletsPendingSem            = true;
-
-int main(int argc, char *argv[])
-{
-    otLinkModeConfig config;
-
-    otSysInit(argc, argv);
-    gpioInit(buttonCallback);
-
-    instance = otInstanceInitSingle();
-    assert(instance);
-
-    otCliUartInit(instance);
-
-    otLinkSetPollPeriod(instance, SLEEPY_POLL_PERIOD_MS);
-    setNetworkConfiguration(instance);
-    otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
-
-    config.mRxOnWhenIdle       = true;
-    config.mSecureDataRequests = true;
-    config.mDeviceType         = 0;
-    config.mNetworkData        = 0;
-    otThreadSetLinkMode(instance, config);
-
-    initUdp();
-    otIp6SetEnabled(instance, true);
-    otThreadSetEnabled(instance, true);
-    efr32SetSleepCallback(sleepCb);
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-
-        applicationTick();
-
-        // Put the EFR32 into deep sleep if callback sleepCb permits.
-        efr32Sleep();
-    }
-
-    otInstanceFinalize(instance);
-    return 0;
-}
-
-/*
- * Callback from efr32Sleep to indicate if it is ok to go into sleep mode.
- * This runs with interrupts disabled.
- */
-bool sleepCb(void)
-{
-    bool allow;
-    allow               = (sAllowDeepSleep && !sTaskletsPendingSem);
-    sTaskletsPendingSem = false;
-    return allow;
-}
-
-void otTaskletsSignalPending(otInstance *aInstance)
-{
-    (void)aInstance;
-    sTaskletsPendingSem = true;
-}
-
-/*
- * Override default network settings, such as panid, so the devices can join a network
- */
-void setNetworkConfiguration(otInstance *aInstance)
-{
-    static char          aNetworkName[] = "SleepyEFR32";
-    otOperationalDataset aDataset;
-
-    memset(&aDataset, 0, sizeof(otOperationalDataset));
-
-    /*
-     * Fields that can be configured in otOperationDataset to override defaults:
-     *     Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
-     *     Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
-     */
-    aDataset.mActiveTimestamp                      = 1;
-    aDataset.mComponents.mIsActiveTimestampPresent = true;
-
-    /* Set Channel to 15 */
-    aDataset.mChannel                      = 15;
-    aDataset.mComponents.mIsChannelPresent = true;
-
-    /* Set Pan ID to 2222 */
-    aDataset.mPanId                      = (otPanId)0x2222;
-    aDataset.mComponents.mIsPanIdPresent = true;
-
-    /* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
-    uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
-    aDataset.mComponents.mIsExtendedPanIdPresent = true;
-
-    /* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
-    uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
-    aDataset.mComponents.mIsMasterKeyPresent = true;
-
-    /* Set Network Name to SleepyEFR32 */
-    size_t length = strlen(aNetworkName);
-    assert(length <= OT_NETWORK_NAME_MAX_SIZE);
-    memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
-    aDataset.mComponents.mIsNetworkNamePresent = true;
-
-    otDatasetSetActive(aInstance, &aDataset);
-}
-
-void handleNetifStateChanged(uint32_t aFlags, void *aContext)
-{
-    otLinkModeConfig config;
-
-    if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
-    {
-        otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
-
-        switch (changedRole)
-        {
-        case OT_DEVICE_ROLE_LEADER:
-        case OT_DEVICE_ROLE_ROUTER:
-            break;
-
-        case OT_DEVICE_ROLE_CHILD:
-            config.mRxOnWhenIdle       = 0;
-            config.mSecureDataRequests = true;
-            config.mDeviceType         = 0;
-            config.mNetworkData        = 0;
-            otThreadSetLinkMode(instance, config);
-            sAllowDeepSleep = true;
-            break;
-
-        case OT_DEVICE_ROLE_DETACHED:
-        case OT_DEVICE_ROLE_DISABLED:
-            break;
-        }
-    }
-}
-
-/*
- * Provide, if required an "otPlatLog()" function
- */
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-    OT_UNUSED_VARIABLE(aFormat);
-
-    va_list ap;
-    va_start(ap, aFormat);
-    otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
-    va_end(ap);
-}
-#endif
-
-void gpioInit(void (*callback)(uint8_t pin))
-{
-    // set up button GPIOs to input with pullups
-    for (int i = 0; i < BSP_BUTTON_COUNT; i++)
-    {
-        GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
-    }
-    // set up interrupt based callback function on falling edge
-    GPIOINT_Init();
-    GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
-    GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
-    GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
-    GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
-
-    BSP_LedsInit();
-    BSP_LedClear(0);
-    BSP_LedClear(1);
-}
-
-void initUdp(void)
-{
-    otError    error;
-    otSockAddr sockaddr;
-
-    memset(&sMulticastSockAddr, 0, sizeof sMulticastSockAddr);
-    otIp6AddressFromString(MULTICAST_ADDR, &sMulticastSockAddr.mAddress);
-    sMulticastSockAddr.mPort = MULTICAST_PORT;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-    sockaddr.mPort = RECV_PORT;
-
-    error = otUdpOpen(instance, &sMtdSocket, mtdReceiveCallback, NULL);
-
-    if (error != OT_ERROR_NONE)
-    {
-        return;
-    }
-
-    error = otUdpBind(instance, &sMtdSocket, &sockaddr);
-
-    if (error != OT_ERROR_NONE)
-    {
-        otUdpClose(instance, &sMtdSocket);
-        return;
-    }
-}
-
-void buttonCallback(uint8_t pin)
-{
-    if ((pin & 0x01) == 0x01)
-    {
-        sButtonPressed = true;
-    }
-    else if ((pin & 0x01) == 0x00)
-    {
-        sRxOnIdleButtonPressed = true;
-    }
-}
-
-void applicationTick(void)
-{
-    otError          error = 0;
-    otMessageInfo    messageInfo;
-    otMessage *      message = NULL;
-    char *           payload = MTD_MESSAGE;
-    otLinkModeConfig config;
-
-    if (sRxOnIdleButtonPressed == true)
-    {
-        sRxOnIdleButtonPressed     = false;
-        sAllowDeepSleep            = !sAllowDeepSleep;
-        config.mRxOnWhenIdle       = !sAllowDeepSleep;
-        config.mSecureDataRequests = true;
-        config.mDeviceType         = 0;
-        config.mNetworkData        = 0;
-        otThreadSetLinkMode(instance, config);
-    }
-
-    if (sButtonPressed == true)
-    {
-        sButtonPressed = false;
-
-        memset(&messageInfo, 0, sizeof(messageInfo));
-        memcpy(&messageInfo.mPeerAddr, &sMulticastSockAddr.mAddress, sizeof messageInfo.mPeerAddr);
-        messageInfo.mPeerPort = sMulticastSockAddr.mPort;
-
-        message = otUdpNewMessage(instance, NULL);
-
-        if (message != NULL)
-        {
-            error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
-
-            if (error == OT_ERROR_NONE)
-            {
-                error = otUdpSend(instance, &sMtdSocket, message, &messageInfo);
-
-                if (error == OT_ERROR_NONE)
-                {
-                    return;
-                }
-            }
-        }
-
-        if (message != NULL)
-        {
-            otMessageFree(message);
-        }
-    }
-}
-
-void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aMessage);
-    OT_UNUSED_VARIABLE(aMessageInfo);
-    uint8_t buf[1500];
-    int     length;
-
-    length      = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
-    buf[length] = '\0';
-
-    if (strcmp((char *)buf, FTD_MESSAGE) == 0)
-    {
-        sLedOn = !sLedOn;
-
-        if (sLedOn)
-        {
-            BSP_LedSet(0);
-        }
-        else
-        {
-            BSP_LedClear(0);
-        }
-    }
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/startup-gcc.c b/third_party/openthread/repo/examples/platforms/efr32mg13/startup-gcc.c
deleted file mode 100644 (file)
index 85c9e2a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements gcc-specific startup code for the efr32.
- */
-
-__extension__ typedef int __guard __attribute__((mode(__DI__)));
-
-int __cxa_guard_acquire(__guard *g)
-{
-    return !*(char *)(g);
-}
-
-void __cxa_guard_release(__guard *g)
-{
-    *(char *)g = 1;
-}
-
-void __cxa_guard_abort(__guard *g)
-{
-    (void)g;
-}
-
-void __cxa_pure_virtual(void)
-{
-    while (1)
-        ;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/system.c b/third_party/openthread/repo/examples/platforms/efr32mg13/system.c
deleted file mode 100644 (file)
index 815e29c..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief
- *   This file includes the platform-specific initializers.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-#include <string.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "common/logging.hpp"
-
-#include "bsp.h"
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_emu.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "rail.h"
-#include "sl_mpu.h"
-#include "sl_sleeptimer.h"
-
-#include "openthread-core-efr32-config.h"
-#include "platform-efr32.h"
-
-#if (HAL_FEM_ENABLE)
-#include "fem-control.h"
-#endif
-
-#define USE_EFR32_LOG (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-
-void halInitChipSpecific(void);
-
-otInstance *sInstance;
-static bool (*sCanSleepCallback)(void);
-
-void otSysInit(int argc, char *argv[])
-{
-    OT_UNUSED_VARIABLE(argc);
-    OT_UNUSED_VARIABLE(argv);
-    sl_status_t status;
-
-    __disable_irq();
-
-#undef FIXED_EXCEPTION
-#define FIXED_EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler)
-#define EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler, priorityLevel, subpriority) \
-    NVIC_SetPriority(deviceIrqn, NVIC_EncodePriority(PRIGROUP_POSITION, priorityLevel, subpriority));
-#include NVIC_CONFIG
-#undef EXCEPTION
-
-    NVIC_SetPriorityGrouping(PRIGROUP_POSITION);
-    CHIP_Init();
-    halInitChipSpecific();
-    BSP_Init(BSP_INIT_BCC);
-
-    CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFRCO);
-    CMU_ClockEnable(cmuClock_CORELE, true);
-    CMU_ClockEnable(cmuClock_RTCC, true);
-    status = sl_sleeptimer_init();
-    assert(status == SL_STATUS_OK);
-
-#if (HAL_FEM_ENABLE)
-    initFem();
-    wakeupFem();
-#endif
-
-    __enable_irq();
-
-#if USE_EFR32_LOG
-    efr32LogInit();
-#endif
-    efr32RadioInit();
-    efr32AlarmInit();
-    efr32MiscInit();
-    efr32RandomInit();
-}
-
-bool otSysPseudoResetWasRequested(void)
-{
-    return false;
-}
-
-void otSysDeinit(void)
-{
-    efr32RadioDeinit();
-
-#if USE_EFR32_LOG
-    efr32LogDeinit();
-#endif
-}
-
-void efr32SetSleepCallback(bool (*aCallback)(void))
-{
-    sCanSleepCallback = aCallback;
-}
-
-void efr32Sleep(void)
-{
-    bool canDeepSleep      = false;
-    int  wakeupProcessTime = 1000;
-    CORE_DECLARE_IRQ_STATE;
-
-    if (RAIL_Sleep(wakeupProcessTime, &canDeepSleep) == RAIL_STATUS_NO_ERROR)
-    {
-        if (canDeepSleep)
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM2(true);
-            }
-            CORE_EXIT_ATOMIC();
-            // TODO OT will handle an interrupt here and it mustn't call any RAIL APIs
-
-            while (RAIL_Wake(0) != RAIL_STATUS_NO_ERROR)
-            {
-            }
-        }
-        else
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM1();
-            }
-            CORE_EXIT_ATOMIC();
-        }
-    }
-}
-
-void otSysProcessDrivers(otInstance *aInstance)
-{
-    sInstance = aInstance;
-
-    // should sleep and wait for interrupts here
-
-    efr32UartProcess();
-    efr32RadioProcess(aInstance);
-    efr32AlarmProcess(aInstance);
-}
-
-__WEAK void otSysEventSignalPending(void)
-{
-    // Intentionally empty
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg13/uart.c b/third_party/openthread/repo/examples/platforms/efr32mg13/uart.c
deleted file mode 100644 (file)
index f93f75f..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for UART communication.
- *
- */
-
-#include <stddef.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "uartdrv.h"
-
-#include "hal-config.h"
-
-enum
-{
-    kReceiveFifoSize = 128,
-};
-
-#define USART_INIT                                                                               \
-    {                                                                                            \
-        USART0,                                               /* USART port */                   \
-            115200,                                           /* Baud rate */                    \
-            BSP_SERIAL_APP_TX_LOC,                            /* USART Tx pin location number */ \
-            BSP_SERIAL_APP_RX_LOC,                            /* USART Rx pin location number */ \
-            (USART_Stopbits_TypeDef)USART_FRAME_STOPBITS_ONE, /* Stop bits */                    \
-            (USART_Parity_TypeDef)USART_FRAME_PARITY_NONE,    /* Parity */                       \
-            (USART_OVS_TypeDef)USART_CTRL_OVS_X16,            /* Oversampling mode*/             \
-            false,                                            /* Majority vote disable */        \
-            HAL_SERIAL_APP_FLOW_CONTROL,                      /* Flow control */                 \
-            BSP_SERIAL_APP_CTS_PORT,                          /* CTS port number */              \
-            BSP_SERIAL_APP_CTS_PIN,                           /* CTS pin number */               \
-            BSP_SERIAL_APP_RTS_PORT,                          /* RTS port number */              \
-            BSP_SERIAL_APP_RTS_PIN,                           /* RTS pin number */               \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartRxQueue,      /* RX operation queue */           \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartTxQueue,      /* TX operation queue */           \
-            BSP_SERIAL_APP_CTS_LOC,                           /* CTS location */                 \
-            BSP_SERIAL_APP_RTS_LOC                            /* RTS location */                 \
-    }
-
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_RX_BUFS, sUartRxQueue);
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_TX_BUFS, sUartTxQueue);
-
-static UARTDRV_HandleData_t sUartHandleData;
-static UARTDRV_Handle_t     sUartHandle = &sUartHandleData;
-static uint8_t              sReceiveBuffer[2];
-static const uint8_t *      sTransmitBuffer = NULL;
-static volatile uint16_t    sTransmitLength = 0;
-
-typedef struct ReceiveFifo_t
-{
-    // The data buffer
-    uint8_t mBuffer[kReceiveFifoSize];
-    // The offset of the first item written to the list.
-    volatile uint16_t mHead;
-    // The offset of the next item to be written to the list.
-    volatile uint16_t mTail;
-} ReceiveFifo_t;
-
-static ReceiveFifo_t sReceiveFifo;
-
-static void processReceive(void);
-
-static void receiveDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    // We can only write if incrementing mTail doesn't equal mHead
-    if (sReceiveFifo.mHead != (sReceiveFifo.mTail + 1) % kReceiveFifoSize)
-    {
-        sReceiveFifo.mBuffer[sReceiveFifo.mTail] = aData[0];
-        sReceiveFifo.mTail                       = (sReceiveFifo.mTail + 1) % kReceiveFifoSize;
-    }
-
-    UARTDRV_Receive(aHandle, aData, 1, receiveDone);
-    otSysEventSignalPending();
-}
-
-static void transmitDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    sTransmitLength = 0;
-    otSysEventSignalPending();
-}
-
-static void processReceive(void)
-{
-    // Copy tail to prevent multiple reads
-    uint16_t tail = sReceiveFifo.mTail;
-
-    // If the data wraps around, process the first part
-    if (sReceiveFifo.mHead > tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, kReceiveFifoSize - sReceiveFifo.mHead);
-
-        // Reset the buffer mHead back to zero.
-        sReceiveFifo.mHead = 0;
-    }
-
-    // For any data remaining, process it
-    if (sReceiveFifo.mHead != tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, tail - sReceiveFifo.mHead);
-
-        // Set mHead to the local tail we have cached
-        sReceiveFifo.mHead = tail;
-    }
-}
-
-otError otPlatUartFlush(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-static void processTransmit(void)
-{
-    if (sTransmitBuffer != NULL && sTransmitLength == 0)
-    {
-        sTransmitBuffer = NULL;
-        otPlatUartSendDone();
-    }
-}
-
-otError otPlatUartEnable(void)
-{
-    UARTDRV_Init_t uartInit = USART_INIT;
-
-    sReceiveFifo.mHead = 0;
-    sReceiveFifo.mTail = 0;
-
-    UARTDRV_Init(sUartHandle, &uartInit);
-
-    for (uint8_t i = 0; i < sizeof(sReceiveBuffer); i++)
-    {
-        UARTDRV_Receive(sUartHandle, &sReceiveBuffer[i], sizeof(sReceiveBuffer[i]), receiveDone);
-    }
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatUartDisable(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(sTransmitBuffer == NULL, error = OT_ERROR_BUSY);
-
-    sTransmitBuffer = aBuf;
-    sTransmitLength = aBufLength;
-
-    UARTDRV_Transmit(sUartHandle, (uint8_t *)sTransmitBuffer, sTransmitLength, transmitDone);
-
-exit:
-    return error;
-}
-
-void efr32UartProcess(void)
-{
-    processReceive();
-    processTransmit();
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg21/Makefile.am
deleted file mode 100644 (file)
index ef1eab6..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-
-lib_LIBRARIES = libopenthread-efr32mg21.a
-
-# Do not enable -Wconversion for rail
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-# Do not enable -pedantic-errors for rail
-override CFLAGS   := $(filter-out -pedantic-errors,$(CFLAGS))
-override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
-
-# Do not enable -Wundef for rail
-override CFLAGS   := $(filter-out -Wundef,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-libopenthread_efr32mg21_a_CPPFLAGS                                            = \
-    -DEFR32_SERIES2_CONFIG1_MICRO                                               \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -Wno-sign-compare                                                           \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)                                                            \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG21_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG21P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/inc                                    \
-    -I$(SDK_SRC_DIR)/platform/emdrv/nvm3/config                                 \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg2x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-PLATFORM_SOURCES                                                              = \
-    alarm.c                                                                     \
-    diag.c                                                                      \
-    entropy.c                                                                   \
-    fem-control.c                                                               \
-    flash.c                                                                     \
-    logging.c                                                                   \
-    misc.c                                                                      \
-    openthread-core-efr32-config.h                                              \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    radio.c                                                                     \
-    rail_config.h                                                               \
-    startup-gcc.c                                                               \
-    system.c                                                                    \
-    uart.c                                                                      \
-    $(NULL)
-
-noinst_HEADERS                                                                = \
-    platform-efr32.h                                                            \
-    platform-band.h                                                             \
-    $(NULL)
-
-libopenthread_efr32mg21_a_SOURCES                                             = \
-    $(PLATFORM_SOURCES)                                                         \
-    $(NULL)
-
-Dash = -
-libopenthread_efr32mg21_a_LIBADD                                                                     = \
-    $(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")             \
-    $(shell find $(top_builddir)/third_party/jlink/SEGGER_RTT_V640/RTT $(Dash)type f $(Dash)name "*.o")
-
-DIST_SUBDIRS                                                                  = \
-    sleepy-demo                                                                 \
-    $(NULL)
-
-SUBDIRS                                                                       = \
-    sleepy-demo                                                                 \
-    $(NULL)
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/Makefile.platform.am b/third_party/openthread/repo/examples/platforms/efr32mg21/Makefile.platform.am
deleted file mode 100644 (file)
index 03a85ae..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# efr32mg21 platform-specific Makefile
-#
-
-LIBRAIL = $(shell                                                                \
-if [ "$(DMP)" = "1" ]; then                                                      \
-    echo "librail_multiprotocol_efr32xg21_gcc_release.a";                        \
-else                                                                             \
-    echo "librail_efr32xg21_gcc_release.a";                                      \
-fi )
-
-LDADD_COMMON                                                                  += \
-    $(top_builddir)/examples/platforms/efr32mg21/libopenthread-efr32mg21.a       \
-    $(top_builddir)/third_party/silabs/libsilabs-efr32mg21-sdk.a                 \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/autogen/librail_release/$(LIBRAIL) \
-    $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a \
-    $(NULL)
-    
-LDFLAGS_COMMON                                                                += \
-    -T $(top_srcdir)/examples/platforms/efr32mg21/efr32mg21.ld                   \
-    $(NULL)
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/README.md b/third_party/openthread/repo/examples/platforms/efr32mg21/README.md
deleted file mode 100644 (file)
index ae6310a..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-# OpenThread on EFR32MG21 Example
-
-This directory contains example platform drivers for the [Silicon Labs EFR32MG21][efr32mg] based on [EFR32™ Mighty Gecko Wireless Starter Kit][slwstk6000b]
-
-[efr32mg]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc
-[slwstk6000b]: http://www.silabs.com/products/development-tools/wireless/mesh-networking/mighty-gecko-starter-kit
-
-The example platform drivers are intended to present the minimal code necessary to support OpenThread. [EFR32MG21 SoC][efr32mg21] has rich memory and peripheral resources which can support all OpenThread capabilities. See the "Run the example with EFR32 boards" section below for an example using basic OpenThread capabilities.
-
-[efr32mg21]: https://www.silabs.com/products/wireless/mesh-networking/series-2-efr32-mighty-gecko-zigbee-thread-soc/device.efr32mg21a020f768im32
-
-## Toolchain
-
-Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
-
-[gnu-toolchain]: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
-
-In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
-
-```bash
-$ cd <path-to-openthread>
-$ ./script/bootstrap
-```
-
-## Build Examples
-
-1. Download and install the [Simplicity Studio][simplicity_studio].
-
-[simplicity_studio]: http://www.silabs.com/products/development-tools/software/simplicity-studio
-
-2. Install Flex (Gecko) SDK including RAIL Library from Simplicity Studio.
-   - Connect EFR32MG21 Wireless Starter Kit to Simplicity Studio.
-   - Find Flex SDK v2.7 in the Software Update page and click Install.
-   - Flex SDK v2.7 will be installed in the path: `/SimplicityStudio_v4/developer/sdks/gecko_sdk_suite`.
-
-For more information on configuring, building, and installing applications for the Wireless Gecko (EFR32) portfolio using FLEX, see [Getting Started with the Silicon Labs Flex Software Development Kit for the Wireless Gecko (EFR32™) Portfolio][qsg138]. For more information on RAIL, see [Radio Abstraction Interface Layer][rail].
-
-[qsg138]: https://www.silabs.com/documents/public/quick-start-guides/qsg138-flex-efr32.pdf
-[rail]: http://www.silabs.com/products/development-tools/software/radio-abstraction-interface-layer-sdk
-
-3. Configure the path to Flex SDK source code.
-
-```bash
-$ cd <path-to-Simplicity-Studio>/developer/sdks
-$ cp -rf gecko_sdk_suite <path-to-openthread>/third_party/silabs/
-```
-
-Alternatively create a symbolic link to the Flex SDK source code.
-
-```bash
-$ cd <path-to-openthread>/third_party
-$ ln -s <path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite silabs/gecko_sdk_suite
-```
-
-Note: Due to an error in the core_cm33.h file provided by ARM, the compiler will throw an error when pedantic option is used on the builds. To avoid this, please add the following lines of code at the top of the file core_cm33.h:
-
-```
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
-```
-
-core_cm33.h can be found at:
-
-```
-<path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite/v2.7/platform/CMSIS/Include
-```
-
-4. Build OpenThread Firmware (CLI example) on EFR32 platform.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-```
-
-For EFR32MG21™ Mighty Gecko Wireless Starter Kit:
-
-```bash
-$ make -f examples/Makefile-efr32mg21 BOARD=BRD4180A
-```
-
-After a successful build, the `elf` files are found in `<path-to-openthread>/output/efr32mg21/bin`.
-
-## Flash Binaries
-
-Simplicity Commander provides a graphical interface for J-Link Commander.
-
-```bash
-$ cd <path-to-openthread>/output/efr32mg21/bin
-$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex
-$ <path-to-simplicity-studio>/developer/adapter_packs/commander/commander
-```
-
-In the J-Link Device drop-down list select the serial number of the device to flash. Click the Adapter Connect button. Ensure the Debug Interface drop-down list is set to SWD and click the Target Connect button. Click on the Flash icon on the left side of the window to switch to the flash page. In the Flash MCU pane enter the path of the ot-cli-ftd.s37 file or choose the file with the Browse... button. Click the Flash button located under the Browse... button.
-
-## Run the example with EFR32MG21 boards
-
-1. Flash two EFR32 boards with the `CLI example` firmware (as shown above).
-2. Open terminal to first device `/dev/ttyACM0` (serial port settings: 115200 8-N-1). Type `help` for a list of commands.
-
-```bash
-> help
-help
-channel
-childtimeout
-contextreusedelay
-extaddr
-extpanid
-ipaddr
-keysequence
-leaderweight
-masterkey
-mode
-netdataregister
-networkidtimeout
-networkname
-panid
-ping
-prefix
-releaserouterid
-rloc16
-route
-routerupgradethreshold
-scan
-start
-state
-stop
-whitelist
-```
-
-3. Start a Thread network as Leader.
-
-```bash
-> panid 0xface
-Done
-> ifconfig up
-Done
-> thread start
-Done
-
-wait a couple of seconds...
-
-> state
-leader
-Done
-```
-
-4. Open terminal to second device `/dev/ttyACM1` (serial port settings: 115200 8-N-1) and attach it to the Thread network as a Router.
-
-```bash
-> panid 0xface
-Done
-> routerselectionjitter 1
-Done
-> ifconfig up
-Done
-> thread start
-Done
-
-wait a couple of seconds...
-
-> state
-router
-Done
-```
-
-5. List all IPv6 addresses of Leader.
-
-```bash
-> ipaddr
-fdde:ad00:beef:0:0:ff:fe00:fc00
-fdde:ad00:beef:0:0:ff:fe00:800
-fdde:ad00:beef:0:5b:3bcd:deff:7786
-fe80:0:0:0:6447:6e10:cf7:ee29
-Done
-```
-
-6. Send an ICMPv6 ping to Leader's Mesh-EID IPv6 address.
-
-```bash
-> ping fdde:ad00:beef:0:5b:3bcd:deff:7786
-8 bytes from fdde:ad00:beef:0:5b:3bcd:deff:7786: icmp_seq=1 hlim=64 time=24ms
-```
-
-The above example demonstrates basic OpenThread capabilities. Enable more features/roles (e.g. commissioner, joiner, DHCPv6 Server/Client, etc.) by assigning compile-options before compiling.
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-$ make -f examples/Makefile-efr32mg21 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1
-```
-
-For a list of all available commands, visit [OpenThread CLI Reference README.md][cli].
-
-[cli]: https://github.com/openthread/openthread/blob/master/src/cli/README.md
-
-## Verification
-
-The following toolchain has been used for testing and verification:
-
-- gcc version 7.3.1
-
-The EFR32 example has been verified with following Flex SDK/RAIL Library version:
-
-- Flex SDK version 2.7.0.0
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/alarm.c b/third_party/openthread/repo/examples/platforms/efr32mg21/alarm.c
deleted file mode 100644 (file)
index 4004498..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the alarm.
- *
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "openthread-system.h"
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include "common/logging.hpp"
-
-#include "platform-efr32.h"
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "rail.h"
-#include "sl_sleeptimer.h"
-
-#define XTAL_ACCURACY 200
-
-static sl_sleeptimer_timer_handle_t sl_handle;
-static uint32_t                     sAlarm     = 0;
-static bool                         sIsRunning = false;
-
-static void AlarmCallback(sl_sleeptimer_timer_handle_t *aHandle, void *aData)
-{
-    otSysEventSignalPending();
-}
-
-void efr32AlarmInit(void)
-{
-    memset(&sl_handle, 0, sizeof sl_handle);
-}
-
-uint32_t otPlatAlarmMilliGetNow(void)
-{
-    uint64_t    ticks;
-    uint64_t    now;
-    sl_status_t status;
-
-    ticks  = sl_sleeptimer_get_tick_count64();
-    status = sl_sleeptimer_tick64_to_ms(ticks, &now);
-    assert(status == SL_STATUS_OK);
-    return (uint32_t)now;
-}
-
-uint32_t otPlatTimeGetXtalAccuracy(void)
-{
-    return XTAL_ACCURACY;
-}
-
-void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    sl_status_t status;
-    int32_t     remaining;
-    uint32_t    ticks;
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-
-    sAlarm     = aT0 + aDt;
-    remaining  = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-    sIsRunning = true;
-
-    if (remaining <= 0)
-    {
-        otSysEventSignalPending();
-    }
-    else
-    {
-        status = sl_sleeptimer_ms32_to_tick(remaining, &ticks);
-        assert(status == SL_STATUS_OK);
-
-        status = sl_sleeptimer_start_timer(&sl_handle, ticks, AlarmCallback, NULL, 0,
-                                           SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG);
-        assert(status == SL_STATUS_OK);
-    }
-}
-
-void otPlatAlarmMilliStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sl_sleeptimer_stop_timer(&sl_handle);
-    sIsRunning = false;
-}
-
-void efr32AlarmProcess(otInstance *aInstance)
-{
-    int32_t remaining;
-
-    if (sIsRunning)
-    {
-        remaining = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
-
-        if (remaining <= 0)
-        {
-            sIsRunning = false;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-            if (otPlatDiagModeGet())
-            {
-                otPlatDiagAlarmFired(aInstance);
-            }
-            else
-#endif
-            {
-                otPlatAlarmMilliFired(aInstance);
-            }
-        }
-    }
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/brd4180a/board_config.h b/third_party/openthread/repo/examples/platforms/efr32mg21/brd4180a/board_config.h
deleted file mode 100644 (file)
index 51aa1e1..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes dev borad compile-time configuration constants for efr32.
- *
- */
-
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-
-#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
-
-#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
-#endif
-
-#ifndef RADIO_CONFIG_DMP_SUPPORT
-#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
-#endif
-
-#endif // __BOARD_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/brd4180a/hal-config.h b/third_party/openthread/repo/examples/platforms/efr32mg21/brd4180a/hal-config.h
deleted file mode 100644 (file)
index b74f973..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-#ifndef HAL_CONFIG_H
-#define HAL_CONFIG_H
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-// This file is auto-generated by Hardware Configurator in Simplicity Studio.
-// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
-// Content outside these regions will be preserved.
-
-// $[ACMP0]
-// [ACMP0]$
-
-// $[ACMP1]
-// [ACMP1]$
-
-// $[ADC0]
-// [ADC0]$
-
-// $[ANTDIV]
-// [ANTDIV]$
-
-// $[BATTERYMON]
-// [BATTERYMON]$
-
-// $[BTL_BUTTON]
-// [BTL_BUTTON]$
-
-// $[BULBPWM]
-// [BULBPWM]$
-
-// $[BULBPWM_COLOR]
-// [BULBPWM_COLOR]$
-
-// $[BUTTON]
-// [BUTTON]$
-
-// $[CMU]
-#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
-#define BSP_CLK_LFXO_PRESENT (1)
-#define HAL_CLK_EM4CLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define HAL_CLK_EM23CLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_HFXO_PRESENT (1)
-#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
-#define BSP_CLK_LFXO_CTUNE (79U)
-#define HAL_CLK_RTCCCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
-#define BSP_CLK_LFXO_FREQ (32768U)
-#define BSP_CLK_HFXO_FREQ (38400000UL)
-#define BSP_CLK_HFXO_CTUNE (129)
-#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
-// [CMU]$
-
-// $[COEX]
-// [COEX]$
-
-// $[EMU]
-// [EMU]$
-
-// $[EXTFLASH]
-// [EXTFLASH]$
-
-// $[EZRADIOPRO]
-// [EZRADIOPRO]$
-
-// $[GPIO]
-#define PORTIO_GPIO_SWV_PIN (3U)
-#define PORTIO_GPIO_SWV_PORT (gpioPortA)
-
-#define BSP_TRACE_SWO_PIN (3U)
-#define BSP_TRACE_SWO_PORT (gpioPortA)
-
-// [GPIO]$
-
-// $[I2C0]
-// [I2C0]$
-
-// $[I2C1]
-// [I2C1]$
-
-// $[I2CSENSOR]
-// [I2CSENSOR]$
-
-// $[IADC0]
-// [IADC0]$
-
-// $[IOEXP]
-// [IOEXP]$
-
-// $[LED]
-#define BSP_LED_PRESENT (1)
-
-#define BSP_LED0_PIN (0U)
-#define BSP_LED0_PORT (gpioPortB)
-
-#define BSP_LED1_PIN (1U)
-#define BSP_LED1_PORT (gpioPortB)
-
-#define HAL_LED_ENABLE \
-    {                  \
-        0, 1           \
-    }
-#define BSP_LED_POLARITY (1)
-#define HAL_LED_COUNT (2U)
-#define BSP_LED_COUNT (2U)
-#define BSP_LED_INIT                                                   \
-    {                                                                  \
-        {BSP_LED0_PORT, BSP_LED0_PIN}, { BSP_LED1_PORT, BSP_LED1_PIN } \
-    }
-// [LED]$
-
-// $[LETIMER0]
-// [LETIMER0]$
-
-// $[LFXO]
-// [LFXO]$
-
-// $[MODEM]
-// [MODEM]$
-
-// $[PA]
-#define HAL_PA_ENABLE (1)
-
-#define HAL_PA_RAMP (10UL)
-#define HAL_PA_SELECTION (HAL_PA_SELECTION_2P4_HP)
-#define HAL_PA_POWER (252U)
-#define HAL_PA_VOLTAGE (3300U)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-// [PA]$
-
-// $[PORTIO]
-// [PORTIO]$
-
-// $[PRS]
-// [PRS]$
-
-// $[PTI]
-#define PORTIO_PTI_DFRAME_PIN (5U)
-#define PORTIO_PTI_DFRAME_PORT (gpioPortC)
-
-#define PORTIO_PTI_DOUT_PIN (4U)
-#define PORTIO_PTI_DOUT_PORT (gpioPortC)
-
-#define HAL_PTI_ENABLE (1)
-
-#define BSP_PTI_DFRAME_PIN (5U)
-#define BSP_PTI_DFRAME_PORT (gpioPortC)
-
-#define BSP_PTI_DOUT_PIN (4U)
-#define BSP_PTI_DOUT_PORT (gpioPortC)
-
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000UL)
-// [PTI]$
-
-// $[SERIAL]
-#define HAL_SERIAL_USART0_ENABLE (0)
-#define HAL_SERIAL_LEUART0_ENABLE (0)
-#define HAL_SERIAL_USART1_ENABLE (0)
-#define HAL_SERIAL_USART2_ENABLE (0)
-#define HAL_SERIAL_USART3_ENABLE (0)
-#define HAL_SERIAL_RXWAKE_ENABLE (0)
-#define BSP_SERIAL_APP_CTS_PIN (4U)
-#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
-
-#define BSP_SERIAL_APP_RX_PIN (6U)
-#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
-
-#define BSP_SERIAL_APP_TX_PIN (5U)
-#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
-
-#define BSP_SERIAL_APP_RTS_PIN (1U)
-#define BSP_SERIAL_APP_RTS_PORT (gpioPortC)
-
-#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128UL)
-#define HAL_SERIAL_APP_BAUD_RATE (115200UL)
-#define HAL_SERIAL_APP_RXSTOP (16UL)
-#define HAL_SERIAL_APP_RXSTART (16UL)
-#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128UL)
-#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [SERIAL]$
-
-// $[SPIDISPLAY]
-// [SPIDISPLAY]$
-
-// $[SPINCP]
-// [SPINCP]$
-
-// $[TIMER0]
-// [TIMER0]$
-
-// $[TIMER1]
-// [TIMER1]$
-
-// $[TIMER2]
-// [TIMER2]$
-
-// $[TIMER3]
-// [TIMER3]$
-
-// $[UARTNCP]
-// [UARTNCP]$
-
-// $[USART0]
-#define PORTIO_USART0_CTS_PIN (4U)
-#define PORTIO_USART0_CTS_PORT (gpioPortA)
-
-#define PORTIO_USART0_RTS_PIN (1U)
-#define PORTIO_USART0_RTS_PORT (gpioPortC)
-
-#define PORTIO_USART0_RX_PIN (6U)
-#define PORTIO_USART0_RX_PORT (gpioPortA)
-
-#define PORTIO_USART0_TX_PIN (5U)
-#define PORTIO_USART0_TX_PORT (gpioPortA)
-
-#define HAL_USART0_ENABLE (1)
-
-#define BSP_USART0_CTS_PIN (4U)
-#define BSP_USART0_CTS_PORT (gpioPortA)
-
-#define BSP_USART0_RX_PIN (6U)
-#define BSP_USART0_RX_PORT (gpioPortA)
-
-#define BSP_USART0_TX_PIN (5U)
-#define BSP_USART0_TX_PORT (gpioPortA)
-
-#define BSP_USART0_RTS_PIN (1U)
-#define BSP_USART0_RTS_PORT (gpioPortC)
-
-#define HAL_USART0_RX_QUEUE_SIZE (128UL)
-#define HAL_USART0_BAUD_RATE (115200UL)
-#define HAL_USART0_RXSTOP (16UL)
-#define HAL_USART0_RXSTART (16UL)
-#define HAL_USART0_TX_QUEUE_SIZE (128UL)
-#define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
-// [USART0]$
-
-// $[USART1]
-// [USART1]$
-
-// $[USART2]
-// [USART2]$
-
-// $[VCOM]
-#define HAL_VCOM_ENABLE (1)
-
-#define BSP_VCOM_ENABLE_PIN (4U)
-#define BSP_VCOM_ENABLE_PORT (gpioPortD)
-
-// [VCOM]$
-
-// $[VUART]
-// [VUART]$
-
-// $[WDOG]
-#define HAL_WDOG_ENABLE (0)
-
-// [WDOG]$
-
-#if defined(_SILICON_LABS_MODULE)
-#include "sl_module.h"
-#endif
-
-#endif /* HAL_CONFIG_H */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/crypto/efr32-mbedtls-config.h b/third_party/openthread/repo/examples/platforms/efr32mg21/crypto/efr32-mbedtls-config.h
deleted file mode 100644 (file)
index d392df0..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EFR32_MBEDTLS_CONFIG_H
-#define EFR32_MBEDTLS_CONFIG_H
-
-#include "em_device.h"
-#include "em_se.h"
-
-/**
- * \def MBEDTLS_AES_ALT
- *
- * Enable hardware acceleration for the AES block cipher
- *
- * Module:  sl_crypto/src/crypto_aes.c for devices with CRYPTO
- *          sl_crypto/src/aes_aes.c for devices with AES
- *
- * See MBEDTLS_AES_C for more information.
- */
-#define MBEDTLS_AES_ALT
-
-/**
- * \def MBEDTLS_ENTROPY_HARDWARE_ALT
- *
- * Integrate the provided default entropy source into the mbed
- * TLS entropy infrastructure.
- *
- */
-#define MBEDTLS_ENTROPY_HARDWARE_ALT
-
-/* Turn on all hardware acceleration provided by the EFR32xG21's built-in SE */
-#define MBEDTLS_SHA1_ALT
-#define MBEDTLS_SHA1_PROCESS_ALT
-#define MBEDTLS_SHA256_ALT
-#define MBEDTLS_SHA256_PROCESS_ALT
-#define MBEDTLS_SHA512_ALT
-#define MBEDTLS_SHA512_PROCESS_ALT
-
-#define MBEDTLS_CCM_ALT
-#define MBEDTLS_CMAC_ALT
-
-/* Turning on ECC acceleration is dependant on not requiring curve25519 when
- * running on EFR32xG21A devices */
-#if (defined(_SILICON_LABS_SECURITY_FEATURE) &&                                   \
-     (_SILICON_LABS_SECURITY_FEATURE == _SILICON_LABS_SECURITY_FEATURE_VAULT)) || \
-    !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
-#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
-#define MBEDTLS_ECDSA_GENKEY_ALT
-#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
-#define MBEDTLS_ECDSA_SIGN_ALT
-#define MBEDTLS_ECDSA_VERIFY_ALT
-/* Incompatibility in header files between mbedTLS version in OT and GSDK means
- * we can't turn on EC-JPAKE acceleration on EFR32xG21 just yet. Will be fixed
- * for the next GSDK update */
-//#define MBEDTLS_ECJPAKE_ALT
-#endif /* EFR32xG21B or curve25519 not enabled */
-
-#endif // EFR32_MBEDTLS_CONFIG_H
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/diag.c b/third_party/openthread/repo/examples/platforms/efr32mg21/diag.c
deleted file mode 100644 (file)
index d3fb43b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the diagnostics.
- *
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/radio.h>
-
-#include "platform-efr32.h"
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-/**
- * Diagnostics mode variables.
- *
- */
-static bool sDiagMode = false;
-
-void otPlatDiagModeSet(bool aMode)
-{
-    sDiagMode = aMode;
-}
-
-bool otPlatDiagModeGet()
-{
-    return sDiagMode;
-}
-
-void otPlatDiagChannelSet(uint8_t aChannel)
-{
-    OT_UNUSED_VARIABLE(aChannel);
-}
-
-void otPlatDiagTxPowerSet(int8_t aTxPower)
-{
-    OT_UNUSED_VARIABLE(aTxPower);
-}
-
-void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aFrame);
-    OT_UNUSED_VARIABLE(aError);
-}
-
-void otPlatDiagAlarmCallback(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-#endif // #if OPENTHREAD_CONFIG_DIAG_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/efr32mg21.ld b/third_party/openthread/repo/examples/platforms/efr32mg21/efr32mg21.ld
deleted file mode 100644 (file)
index 3d877e8..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
- /**
- * @file
- *   This file implements the OpenThread linker script for the
- *   Silicon Labs efr32mg21 platform.
- *
- */
-
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
-  RAM (rwx)  : ORIGIN = 0x20000000, LENGTH = 96K
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- *
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __copy_table_start__
- *   __copy_table_end__
- *   __zero_table_start__
- *   __zero_table_end__
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapBase
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- *   __Vectors_End
- *   __Vectors_Size
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-  .text :
-  {
-    KEEP(*(.vectors))
-    __Vectors_End = .;
-    __Vectors_Size = __Vectors_End - __Vectors;
-    __end__ = .;
-
-    *(.text*)
-
-    KEEP(*(.init))
-    KEEP(*(.fini))
-
-    /* .ctors */
-    *crtbegin.o(.ctors)
-    *crtbegin?.o(.ctors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-    *(SORT(.ctors.*))
-    *(.ctors)
-
-    /* .dtors */
-    *crtbegin.o(.dtors)
-    *crtbegin?.o(.dtors)
-    *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-    *(SORT(.dtors.*))
-    *(.dtors)
-
-    *(.rodata*)
-
-    KEEP(*(.eh_frame*))
-  } > FLASH
-
-  .ARM.extab :
-  {
-    *(.ARM.extab* .gnu.linkonce.armextab.*)
-  } > FLASH
-
-  __exidx_start = .;
-  .ARM.exidx :
-  {
-    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-  } > FLASH
-  __exidx_end = .;
-
-  /* To copy multiple ROM to RAM sections,
-   * uncomment .copy.table section and,
-   * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .copy.table :
-  {
-    . = ALIGN(4);
-    __copy_table_start__ = .;
-    LONG (__etext)
-    LONG (__data_start__)
-    LONG (__data_end__ - __data_start__)
-    LONG (__etext2)
-    LONG (__data2_start__)
-    LONG (__data2_end__ - __data2_start__)
-    __copy_table_end__ = .;
-  } > FLASH
-  */
-
-  /* To clear multiple BSS sections,
-   * uncomment .zero.table section and,
-   * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
-  /*
-  .zero.table :
-  {
-    . = ALIGN(4);
-    __zero_table_start__ = .;
-    LONG (__bss_start__)
-    LONG (__bss_end__ - __bss_start__)
-    LONG (__bss2_start__)
-    LONG (__bss2_end__ - __bss2_start__)
-    __zero_table_end__ = .;
-  } > FLASH
-  */
-
-  __etext = .;
-
-  .data : AT (__etext)
-  {
-    __data_start__ = .;
-    *(vtable)
-    *(.data*)
-    . = ALIGN (4);
-    PROVIDE (__ram_func_section_start = .);
-    *(.ram)
-    PROVIDE (__ram_func_section_end = .);
-
-    . = ALIGN(4);
-    /* preinit data */
-    PROVIDE_HIDDEN (__preinit_array_start = .);
-    KEEP(*(.preinit_array))
-    PROVIDE_HIDDEN (__preinit_array_end = .);
-
-    . = ALIGN(4);
-    /* init data */
-    PROVIDE_HIDDEN (__init_array_start = .);
-    KEEP(*(SORT(.init_array.*)))
-    KEEP(*(.init_array))
-    PROVIDE_HIDDEN (__init_array_end = .);
-
-    . = ALIGN(4);
-    /* finit data */
-    PROVIDE_HIDDEN (__fini_array_start = .);
-    KEEP(*(SORT(.fini_array.*)))
-    KEEP(*(.fini_array))
-    PROVIDE_HIDDEN (__fini_array_end = .);
-
-    KEEP(*(.jcr*))
-    . = ALIGN(4);
-    /* All data end */
-    __data_end__ = .;
-
-  } > RAM
-
-  .bss :
-  {
-    . = ALIGN(4);
-    __bss_start__ = .;
-    *(.bss*)
-    *(COMMON)
-    . = ALIGN(4);
-    __bss_end__ = .;
-  } > RAM
-
-  .heap (COPY):
-  {
-    __HeapBase = .;
-    __end__ = .;
-    end = __end__;
-    _end = __end__;
-    KEEP(*(.heap*))
-    __HeapLimit = .;
-  } > RAM
-
-  /* .stack_dummy section doesn't contains any symbols. It is only
-   * used for linker to calculate size of stack sections, and assign
-   * values to stack symbols later */
-  .stack_dummy (COPY):
-  {
-    KEEP(*(.stack*))
-  } > RAM
-
-  /* Set stack top to end of RAM, and stack limit move down by
-   * size of stack_dummy section */
-  __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-  __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-  PROVIDE(__stack = __StackTop);
-
-  /*******************************************************************/
-  /* Define flash block for nvm3                                     */
-  .nvm (DSECT) : {
-    KEEP(*(.simee*))
-  } > FLASH
-
-  linker_nvm_end = ORIGIN(FLASH) + LENGTH(FLASH);
-  linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm);
-  linker_nvm_size = SIZEOF(.nvm);
-  __nvm3Base = linker_nvm_begin;
-  /*******************************************************************/
-
-  /* Check if data + heap + stack exceeds RAM limit */
-  ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-
-  /* Check if FLASH usage exceeds FLASH size */
-  /*ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")*/
-}
\ No newline at end of file
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/entropy.c b/third_party/openthread/repo/examples/platforms/efr32mg21/entropy.c
deleted file mode 100644 (file)
index cd03c8f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for random number generator.
- *
- */
-
-#include <openthread/platform/entropy.h>
-
-#include "mbedtls/entropy_poll.h"
-#include "utils/code_utils.h"
-
-static uint32_t randomUint32Get(void)
-{
-    uint32_t random   = 0;
-    size_t   ouputLen = 0;
-
-    mbedtls_hardware_poll(NULL, (unsigned char *)&random, sizeof(random), &ouputLen);
-
-    return random;
-}
-
-otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
-
-    for (uint16_t length = 0; length < aOutputLength; length++)
-    {
-        aOutput[length] = (uint8_t)randomUint32Get();
-    }
-
-exit:
-    return error;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/fem-control.c b/third_party/openthread/repo/examples/platforms/efr32mg21/fem-control.c
deleted file mode 100644 (file)
index e9093d1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "hal-config.h"
-
-#if (HAL_FEM_ENABLE)
-#include "util/plugin/plugin-common/fem-control/fem-control.c"
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/flash.c b/third_party/openthread/repo/examples/platforms/efr32mg21/flash.c
deleted file mode 100644 (file)
index 4f35969..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for the non-volatile storage.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#if OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE // Use OT NV system
-
-#include "em_msc.h"
-#include <string.h>
-#include <openthread/instance.h>
-
-#define FLASH_PAGE_NUM 2
-#define FLASH_DATA_END_ADDR (FLASH_BASE + FLASH_SIZE)
-#define FLASH_DATA_START_ADDR (FLASH_DATA_END_ADDR - (FLASH_PAGE_SIZE * FLASH_PAGE_NUM))
-#define FLASH_SWAP_PAGE_NUM (FLASH_PAGE_NUM / 2)
-#define FLASH_SWAP_SIZE (FLASH_PAGE_SIZE * FLASH_SWAP_PAGE_NUM)
-
-static inline uint32_t mapAddress(uint8_t aSwapIndex, uint32_t aOffset)
-{
-    uint32_t address;
-
-    address = FLASH_DATA_START_ADDR + aOffset;
-
-    if (aSwapIndex)
-    {
-        address += FLASH_SWAP_SIZE;
-    }
-
-    return address;
-}
-
-void otPlatFlashInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-}
-
-uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return FLASH_SWAP_SIZE;
-}
-
-void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint32_t address = mapAddress(aSwapIndex, 0);
-
-    for (uint32_t n = 0; n < FLASH_SWAP_PAGE_NUM; n++, address += FLASH_PAGE_SIZE)
-    {
-        MSC_ErasePage((uint32_t *)address);
-    }
-}
-
-void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    MSC_WriteWord((uint32_t *)mapAddress(aSwapIndex, aOffset), aData, aSize);
-}
-
-void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    memcpy(aData, (const uint8_t *)mapAddress(aSwapIndex, aOffset), aSize);
-}
-
-#else // Defaults to Silabs nvm3 system
-
-#include "nvm3.h"
-#include "nvm3_default.h"
-#include <string.h>
-#include <openthread/platform/settings.h>
-#include "common/code_utils.hpp"
-#include "common/logging.hpp"
-
-#define NVM3KEY_DOMAIN_OPENTHREAD 0x20000U
-#define NUM_INDEXED_SETTINGS \
-    OPENTHREAD_CONFIG_MLE_MAX_CHILDREN // Indexed key types are only supported for kKeyChildInfo (=='child table').
-#define ENUM_NVM3_KEY_LIST_SIZE 4      // List size used when enumerating nvm3 keys.
-
-static otError          addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength);
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index);
-static otError          mapNvm3Error(Ecode_t nvm3Res);
-
-void otPlatSettingsInit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    if (mapNvm3Error(nvm3_open(nvm3_defaultHandle, nvm3_defaultInit)) != OT_ERROR_NONE)
-    {
-        otLogDebgPlat("Error initializing nvm3 instance");
-    }
-}
-
-void otPlatSettingsDeinit(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    nvm3_close(nvm3_defaultHandle);
-}
-
-otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index', then reads the nvm3 data into the destination buffer.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError  err;
-    uint16_t valueLength = 0;
-
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if (idx == aIndex)
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    valueLength = objLen;
-
-                    // Only perform read if an input buffer was passed in.
-                    if ((aValue != NULL) && (aValueLength != NULL))
-                    {
-                        // Read all nvm3 obj bytes into a tmp buffer, then copy the required
-                        // number of bytes to the read destination buffer.
-                        uint8_t *buf = malloc(valueLength);
-                        err          = mapNvm3Error(nvm3_readData(nvm3_defaultHandle, nvm3Key, buf, valueLength));
-                        if (err == OT_ERROR_NONE)
-                        {
-                            memcpy(aValue, buf, (valueLength < *aValueLength) ? valueLength : *aValueLength);
-                        }
-                        free(buf);
-                        SuccessOrExit(err);
-                    }
-                }
-                idxFound = true;
-                break;
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    if (aValueLength != NULL)
-    {
-        *aValueLength = valueLength; // always return actual nvm3 object length.
-    }
-
-    return err;
-}
-
-otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError err;
-
-    // Delete all nvm3 objects matching the input key (i.e. the 'setting indexes' of the key).
-    err = otPlatSettingsDelete(aInstance, aKey, -1);
-    if ((err == OT_ERROR_NONE) || (err == OT_ERROR_NOT_FOUND))
-    {
-        // Add new setting object (i.e. 'index0' of the key).
-        err = addSetting(aKey, aValue, aValueLength);
-        SuccessOrExit(err);
-    }
-
-exit:
-    return err;
-}
-
-otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    return addSetting(aKey, aValue, aValueLength);
-}
-
-otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
-{
-    // Searches through all matching nvm3 keys to find the one with the required
-    // 'index' (or index = -1 to delete all), then deletes the nvm3 object.
-    // (Repeatedly enumerates a list of matching keys from the nvm3 until the
-    // required index is found).
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError          err;
-    nvm3_ObjectKey_t nvm3Key  = makeNvm3ObjKey(aKey, 0); // The base nvm3 key value.
-    bool             idxFound = false;
-    int              idx      = 0;
-    err                       = OT_ERROR_NOT_FOUND;
-    while ((idx <= NUM_INDEXED_SETTINGS) && (!idxFound))
-    {
-        // Get the next nvm3 key list.
-        nvm3_ObjectKey_t keys[ENUM_NVM3_KEY_LIST_SIZE]; // List holds the next set of nvm3 keys.
-        size_t           objCnt = nvm3_enumObjects(nvm3_defaultHandle, keys, ENUM_NVM3_KEY_LIST_SIZE, nvm3Key,
-                                         makeNvm3ObjKey(aKey, NUM_INDEXED_SETTINGS));
-        for (size_t i = 0; i < objCnt; ++i)
-        {
-            nvm3Key = keys[i];
-            if ((idx == aIndex) || (aIndex == -1))
-            {
-                uint32_t objType;
-                size_t   objLen;
-                err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-                if (err == OT_ERROR_NONE)
-                {
-                    // Delete the nvm3 object.
-                    err = mapNvm3Error(nvm3_deleteObject(nvm3_defaultHandle, nvm3Key));
-                    SuccessOrExit(err);
-                }
-                if (aIndex != -1)
-                {
-                    idxFound = true;
-                    break;
-                }
-            }
-            ++idx;
-        }
-        if (objCnt < ENUM_NVM3_KEY_LIST_SIZE)
-        {
-            // Stop searching (there are no more matching nvm3 objects).
-            break;
-        }
-        ++nvm3Key; // Inc starting value for next nvm3 key list enumeration.
-    }
-
-exit:
-    return err;
-}
-
-void otPlatSettingsWipe(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // Delete nvm3 objects for all OT Settings keys (and any of their associated 'indexes').
-    // Note- any OT User nvm3 objects in the OT nvm3 area are NOT be erased.
-    for (uint16_t aKey = 0; aKey < 8; ++aKey)
-    {
-        otPlatSettingsDelete(NULL, aKey, -1);
-    }
-}
-
-// Local functions..
-
-static otError addSetting(uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    // Helper function- writes input buffer data to a NEW nvm3 object.
-    // nvm3 object is created at the first available Key + index.
-
-    otError err;
-
-    if ((aValueLength == 0) || (aValue == NULL))
-    {
-        err = OT_ERROR_INVALID_ARGS;
-    }
-    else
-    {
-        for (int idx = 0; idx <= NUM_INDEXED_SETTINGS; ++idx)
-        {
-            nvm3_ObjectKey_t nvm3Key;
-            nvm3Key = makeNvm3ObjKey(aKey, idx);
-
-            uint32_t objType;
-            size_t   objLen;
-            err = mapNvm3Error(nvm3_getObjectInfo(nvm3_defaultHandle, nvm3Key, &objType, &objLen));
-            if (err == OT_ERROR_NOT_FOUND)
-            {
-                // Use this index for the new nvm3 object.
-                // Write the binary data to nvm3 (Creates nvm3 object if required).
-                err = mapNvm3Error(nvm3_writeData(nvm3_defaultHandle, nvm3Key, aValue, aValueLength));
-                break;
-            }
-            else if (err != OT_ERROR_NONE)
-            {
-                break;
-            }
-        }
-    }
-
-    return err;
-}
-
-static nvm3_ObjectKey_t makeNvm3ObjKey(uint16_t otSettingsKey, int index)
-{
-    return (NVM3KEY_DOMAIN_OPENTHREAD | (otSettingsKey << 8) | (index & 0xFF));
-}
-
-static otError mapNvm3Error(Ecode_t nvm3Res)
-{
-    otError err;
-
-    switch (nvm3Res)
-    {
-    case ECODE_NVM3_OK:
-        err = OT_ERROR_NONE;
-        break;
-
-    case ECODE_NVM3_ERR_KEY_NOT_FOUND:
-        err = OT_ERROR_NOT_FOUND;
-        break;
-
-    default:
-        err = OT_ERROR_FAILED;
-        break;
-    }
-
-    return err;
-}
-
-#endif // OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/logging.c b/third_party/openthread/repo/examples/platforms/efr32mg21/logging.c
deleted file mode 100644 (file)
index a6fdbba..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file logging.c
- * Platform abstraction for the logging
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/logging.h>
-
-#include <utils/logging_rtt.h>
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-void efr32LogInit(void)
-{
-    utilsLogRttInit();
-}
-
-void efr32LogDeinit(void)
-{
-    utilsLogRttDeinit();
-}
-
-OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    va_list ap;
-
-    va_start(ap, aFormat);
-
-    utilsLogRttOutput(aLogLevel, aLogRegion, aFormat, ap);
-
-    va_end(ap);
-}
-#endif
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/misc.c b/third_party/openthread/repo/examples/platforms/efr32mg21/misc.c
deleted file mode 100644 (file)
index 66dd766..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for miscellaneous behaviors.
- */
-
-#include <openthread/platform/misc.h>
-
-#include "em_rmu.h"
-#include "platform-efr32.h"
-
-static uint32_t sResetCause;
-
-void efr32MiscInit(void)
-{
-    // Read the cause of last reset.
-    sResetCause = RMU_ResetCauseGet();
-
-    // Clear the register, as the causes cumulate over resets.
-    RMU_ResetCauseClear();
-}
-
-void otPlatReset(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    NVIC_SystemReset();
-}
-
-otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otPlatResetReason reason;
-
-    if (sResetCause & EMU_RSTCAUSE_POR)
-    {
-        reason = OT_PLAT_RESET_REASON_POWER_ON;
-    }
-    else if (sResetCause & EMU_RSTCAUSE_SYSREQ)
-    {
-        reason = OT_PLAT_RESET_REASON_SOFTWARE;
-    }
-    else if ((sResetCause & EMU_RSTCAUSE_WDOG0) || (sResetCause & EMU_RSTCAUSE_WDOG1))
-    {
-        reason = OT_PLAT_RESET_REASON_WATCHDOG;
-    }
-    else if (sResetCause & EMU_RSTCAUSE_PIN)
-    {
-        reason = OT_PLAT_RESET_REASON_EXTERNAL;
-    }
-    else if (sResetCause & EMU_RSTCAUSE_LOCKUP)
-    {
-        reason = OT_PLAT_RESET_REASON_FAULT;
-    }
-    else if ((sResetCause & EMU_RSTCAUSE_AVDDBOD) || (sResetCause & EMU_RSTCAUSE_DECBOD) ||
-             (sResetCause & EMU_RSTCAUSE_DVDDBOD) || (sResetCause & EMU_RSTCAUSE_DVDDLEBOD) ||
-             (sResetCause & EMU_RSTCAUSE_EM4))
-    {
-        reason = OT_PLAT_RESET_REASON_ASSERT;
-    }
-    else
-    {
-        reason = OT_PLAT_RESET_REASON_UNKNOWN;
-    }
-
-    return reason;
-}
-
-void otPlatWakeHost(void)
-{
-    // TODO: implement an operation to wake the host from sleep state.
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/openthread-core-efr32-config-check.h b/third_party/openthread/repo/examples/platforms/efr32mg21/openthread-core-efr32-config-check.h
deleted file mode 100644 (file)
index abae165..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
-
-#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
-#error "Platform efr32mg21 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
-#endif
-
-#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
-#error "Platform efr32mg21 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
-#endif
-
-#endif /* OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_ */
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/openthread-core-efr32-config.h b/third_party/openthread/repo/examples/platforms/efr32mg21/openthread-core-efr32-config.h
deleted file mode 100644 (file)
index a4e53d4..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes efr32 compile-time configuration constants
- *   for OpenThread.
- */
-
-#include "board_config.h"
-#include "em_msc.h"
-
-#ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_
-#define OPENTHREAD_CORE_EFR32_CONFIG_H_
-
-/**
- * @def OPENTHREAD_CONFIG_LOG_OUTPUT
- *
- * The efr32 platform provides an otPlatLog() function.
- */
-#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT /* allow command line override */
-#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
-#endif
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
- *
- * We dont support sub-gig frequencies on MG21.
- *
- */
-
-#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 0
-
-/*
- * @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
- *
- * Define to 1 if you want to enable physical layer to support OQPSK modulation in 2.4GHz band.
- *
- */
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1
-#else
-#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 0
-#endif
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_INFO
- *
- * The platform-specific string to insert into the OpenThread version string.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_INFO "EFR32"
-
-/*
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
- *
- * Define to 1 if you want to enable software retransmission logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
- *
- * Define to 1 if you want to enable software CSMA-CA backoff logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
- *
- * Define to 1 if you want to enable software transmission security logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0
-
-/**
- * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE
- *
- * Define to 1 if you want to enable software energy scanning logic.
- *
- */
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1
-
-/**
- * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
- *
- * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
- *
- * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
- *
- */
-#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0
-
-/**
- * @def RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM
- *
- * The number of short source address table entries.
- *
- */
-#define RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM 6
-
-/**
- * @def RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
- *
- * The number of extended source address table entries.
- *
- */
-#define RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM 6
-
-/**
- * @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
- *
- * Define to 1 to enable NCP UART support.
- *
- */
-#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
-
-#endif // OPENTHREAD_CORE_EFR32_CONFIG_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/platform-band.h b/third_party/openthread/repo/examples/platforms/efr32mg21/platform-band.h
deleted file mode 100644 (file)
index fb82093..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file defines the frequency band configuration structure for efr32.
- *
- */
-
-#ifndef PLATFORM_BAND_H_
-#define PLATFORM_BAND_H_
-
-#include <openthread/platform/radio.h>
-
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-#define RAIL_TX_FIFO_SIZE (OT_RADIO_FRAME_MAX_SIZE + 1)
-
-#define RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY 255
-#define RADIO_SCHEDULER_CHANNEL_SLIP_TIME 500000UL
-#define RADIO_SCHEDULER_TX_PRIORITY 100
-#define RADIO_SCHEDULER_TX_SLIP_TIME 500000UL
-
-#define RADIO_TIMING_CSMA_OVERHEAD_US 500
-#define RADIO_TIMING_DEFAULT_BYTETIME_US 32   // only used if RAIL_GetBitRate returns 0
-#define RADIO_TIMING_DEFAULT_SYMBOLTIME_US 16 // only used if RAIL_GetSymbolRate returns 0
-
-typedef struct efr32RadioCounters
-{
-    uint64_t mRailPlatTxTriggered;
-    uint64_t mRailPlatRadioReceiveDoneCbCount;
-    uint64_t mRailPlatRadioEnergyScanDoneCbCount;
-    uint64_t mRailPlatRadioTxDoneCbCount;
-    uint64_t mRailTxStarted;
-    uint64_t mRailTxStartFailed;
-    uint64_t mRailEventConfigScheduled;
-    uint64_t mRailEventConfigUnScheduled;
-    uint64_t mRailEventPacketSent;
-    uint64_t mRailEventChannelBusy;
-    uint64_t mRailEventEnergyScanCompleted;
-    uint64_t mRailEventCalNeeded;
-    uint64_t mRailEventPacketReceived;
-    uint64_t mRailEventNoAck;
-    uint64_t mRailEventTxAbort;
-    uint64_t mRailEventSchedulerStatusError;
-    uint64_t mRailEventsSchedulerStatusTransmitBusy;
-    uint32_t mRailEventsSchedulerStatusLastStatus;
-} efr32RadioCounters;
-
-typedef struct efr32BandConfig
-{
-    RAIL_Handle_t               mRailHandle;
-    RAIL_Config_t               mRailConfig;
-    RAILSched_Config_t          mRailSchedState;
-    const RAIL_ChannelConfig_t *mChannelConfig;
-    uint8_t                     mRailTxFifo[OT_RADIO_FRAME_MAX_SIZE + 1];
-    uint8_t                     mChannelMin;
-    uint8_t                     mChannelMax;
-} efr32BandConfig;
-
-#endif // PLATFORM_BAND_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/platform-efr32.h b/third_party/openthread/repo/examples/platforms/efr32mg21/platform-efr32.h
deleted file mode 100644 (file)
index 0f62c47..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes the platform-specific initializers.
- *
- */
-
-#ifndef PLATFORM_EFR32_H_
-#define PLATFORM_EFR32_H_
-
-#include <openthread/instance.h>
-
-#include "em_device.h"
-#include "em_system.h"
-
-#include "core_cm33.h"
-#include "rail.h"
-
-// Global OpenThread instance structure
-extern otInstance *sInstance;
-
-// Global reference to rail handle
-extern RAIL_Handle_t gRailHandle;
-
-/**
- * This function initializes the alarm service used by OpenThread.
- *
- */
-void efr32AlarmInit(void);
-
-/**
- * This function performs alarm driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32AlarmProcess(otInstance *aInstance);
-
-/**
- * This function initializes the radio service used by OpenThead.
- *
- */
-void efr32RadioInit(void);
-
-/**
- * This function deinitializes the radio service used by OpenThead.
- *
- */
-void efr32RadioDeinit(void);
-
-/**
- * This function performs radio driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void efr32RadioProcess(otInstance *aInstance);
-
-/**
- * This function performs UART driver processing.
- *
- */
-void efr32UartProcess(void);
-
-/**
- * Initialization of Misc module.
- *
- */
-void efr32MiscInit(void);
-
-/**
- * Initialization of ADC module for random number generator.
- *
- */
-void efr32RandomInit(void);
-
-/**
- * Initialization of Logger driver.
- *
- */
-void efr32LogInit(void);
-
-/**
- * Deinitialization of Logger driver.
- *
- */
-void efr32LogDeinit(void);
-
-/**
- * Registers the sleep callback handler.  The callback is used to check that
- * the application has no work pending and that it is safe to put the EFR32
- * into a low energy sleep mode.
- *
- * The callback should return true if it is ok to enter sleep mode. Note
- * that the callback itself is run with interrupts disabled and so should
- * be kept as short as possible.  Anny interrupt including those from timers
- * will wake the EFR32 out of sleep mode.
- *
- * @param[in]  aCallback  Callback function.
- *
- */
-void efr32SetSleepCallback(bool (*aCallback)(void), void (*aCallbackWake)(void));
-
-/**
- * Put the EFR32 into a low power mode.  Before sleeping it will call a callback
- * in the application registered with efr32SetSleepCallback to ensure that there
- * is no outstanding work in the application to do.
- */
-void efr32Sleep(void);
-
-#endif // PLATFORM_EFR32_H_
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/radio.c b/third_party/openthread/repo/examples/platforms/efr32mg21/radio.c
deleted file mode 100644 (file)
index 9bdd471..0000000
+++ /dev/null
@@ -1,1050 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for radio communication.
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include <openthread/platform/radio.h>
-
-#include "common/logging.hpp"
-#include "utils/code_utils.h"
-
-#include "utils/soft_source_match_table.h"
-
-#include "board_config.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_system.h"
-#include "pa_conversions_efr32.h"
-#include "platform-band.h"
-#include "rail.h"
-#include "rail_config.h"
-#include "rail_ieee802154.h"
-
-enum
-{
-    IEEE802154_MIN_LENGTH      = 5,
-    IEEE802154_MAX_LENGTH      = 127,
-    IEEE802154_ACK_LENGTH      = 5,
-    IEEE802154_FRAME_TYPE_MASK = 0x7,
-    IEEE802154_FRAME_TYPE_ACK  = 0x2,
-    IEEE802154_FRAME_PENDING   = 1 << 4,
-    IEEE802154_ACK_REQUEST     = 1 << 5,
-    IEEE802154_DSN_OFFSET      = 2,
-};
-
-enum
-{
-    EFR32_RECEIVE_SENSITIVITY    = -100, // dBm
-    EFR32_RSSI_AVERAGING_TIME    = 16,   // us
-    EFR32_RSSI_AVERAGING_TIMEOUT = 300,  // us
-};
-
-enum
-{
-    EFR32_SCHEDULER_SAMPLE_RSSI_PRIORITY = 10, // High priority
-    EFR32_SCHEDULER_TX_PRIORITY          = 10, // High priority
-    EFR32_SCHEDULER_RX_PRIORITY          = 20, // Low priority
-};
-
-enum
-{
-    EFR32_NUM_BAND_CONFIGS = 1,
-};
-
-typedef enum
-{
-    ENERGY_SCAN_STATUS_IDLE,
-    ENERGY_SCAN_STATUS_IN_PROGRESS,
-    ENERGY_SCAN_STATUS_COMPLETED
-} energyScanStatus;
-
-typedef enum
-{
-    ENERGY_SCAN_MODE_SYNC,
-    ENERGY_SCAN_MODE_ASYNC
-} energyScanMode;
-
-RAIL_Handle_t gRailHandle;
-
-static volatile bool sTransmitBusy      = false;
-static bool          sPromiscuous       = false;
-static bool          sIsSrcMatchEnabled = false;
-static otRadioState  sState             = OT_RADIO_STATE_DISABLED;
-
-static uint8_t      sReceivePsdu[IEEE802154_MAX_LENGTH];
-static otRadioFrame sReceiveFrame;
-static otError      sReceiveError;
-
-static otRadioFrame     sTransmitFrame;
-static uint8_t          sTransmitPsdu[IEEE802154_MAX_LENGTH];
-static volatile otError sTransmitError;
-
-static efr32BandConfig sBandConfigs[EFR32_NUM_BAND_CONFIGS];
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-static efr32RadioCounters sRailDebugCounters;
-#endif
-
-static volatile energyScanStatus sEnergyScanStatus;
-static volatile int8_t           sEnergyScanResultDbm;
-static energyScanMode            sEnergyScanMode;
-
-#define QUARTER_DBM_IN_DBM 4
-#define US_IN_MS 1000
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents);
-
-static const RAIL_IEEE802154_Config_t sRailIeee802154Config = {
-    NULL, // addresses
-    {
-        // ackConfig
-        true, // ackConfig.enable
-        894,  // ackConfig.ackTimeout
-        {
-            // ackConfig.rxTransitions
-            RAIL_RF_STATE_RX, // ackConfig.rxTransitions.success
-            RAIL_RF_STATE_RX, // ackConfig.rxTransitions.error
-        },
-        {
-            // ackConfig.txTransitions
-            RAIL_RF_STATE_RX, // ackConfig.txTransitions.success
-            RAIL_RF_STATE_RX, // ackConfig.txTransitions.error
-        },
-    },
-    {
-        // timings
-        100,      // timings.idleToRx
-        192 - 10, // timings.txToRx
-        100,      // timings.idleToTx
-        192,      // timings.rxToTx
-        0,        // timings.rxSearchTimeout
-        0,        // timings.txToRxSearchTimeout
-    },
-    RAIL_IEEE802154_ACCEPT_STANDARD_FRAMES, // framesMask
-    false,                                  // promiscuousMode
-    false,                                  // isPanCoordinator
-};
-
-RAIL_DECLARE_TX_POWER_VBAT_CURVES_ALT;
-
-static int8_t sTxPowerDbm = OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER;
-
-static efr32BandConfig *sTxBandConfig = NULL;
-static efr32BandConfig *sRxBandConfig = NULL;
-
-static RAIL_Handle_t efr32RailConfigInit(efr32BandConfig *aBandConfig)
-{
-    RAIL_Status_t     status;
-    RAIL_Handle_t     handle;
-    RAIL_DataConfig_t railDataConfig = {
-        TX_PACKET_DATA,
-        RX_PACKET_DATA,
-        PACKET_MODE,
-        PACKET_MODE,
-    };
-
-    handle = RAIL_Init(&aBandConfig->mRailConfig, NULL);
-    assert(handle != NULL);
-
-    status = RAIL_ConfigData(handle, &railDataConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    RAIL_Idle(handle, RAIL_IDLE, true);
-
-    status = RAIL_ConfigCal(handle, RAIL_CAL_ALL);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    if (aBandConfig->mChannelConfig != NULL)
-    {
-        RAIL_ConfigChannels(handle, aBandConfig->mChannelConfig, NULL);
-    }
-    else
-    {
-        status = RAIL_IEEE802154_Config2p4GHzRadio(handle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-
-    status = RAIL_IEEE802154_Init(handle, &sRailIeee802154Config);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_ConfigEvents(handle, RAIL_EVENTS_ALL,
-                               RAIL_EVENT_RX_ACK_TIMEOUT |                      //
-                                   RAIL_EVENTS_TX_COMPLETION |                  //
-                                   RAIL_EVENT_RX_PACKET_RECEIVED |              //
-                                   RAIL_EVENT_RSSI_AVERAGE_DONE |               //
-                                   RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND | //
-                                   RAIL_EVENT_CAL_NEEDED |                      //
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-                                   RAIL_EVENT_CONFIG_SCHEDULED |   //
-                                   RAIL_EVENT_CONFIG_UNSCHEDULED | //
-#endif
-                                   RAIL_EVENT_SCHEDULER_STATUS //
-    );
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    uint16_t actualLength = RAIL_SetTxFifo(handle, aBandConfig->mRailTxFifo, 0, sizeof(aBandConfig->mRailTxFifo));
-    assert(actualLength == sizeof(aBandConfig->mRailTxFifo));
-
-    return handle;
-}
-
-static void efr32RadioSetTxPower(RAIL_Handle_t               aRailHandle,
-                                 const RAIL_ChannelConfig_t *aChannelConfig,
-                                 int8_t                      aPowerDbm)
-{
-    RAIL_Status_t                       status;
-    const RAIL_TxPowerCurvesConfigAlt_t txPowerCurvesConfig = RAIL_DECLARE_TX_POWER_CURVES_CONFIG_ALT;
-    RAIL_TxPowerConfig_t                txPowerConfig       = {RAIL_TX_POWER_MODE_2P4_HP, 3300, 10};
-
-    status = RAIL_InitTxPowerCurvesAlt(&txPowerCurvesConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_ConfigTxPower(aRailHandle, &txPowerConfig);
-    assert(status == RAIL_STATUS_NO_ERROR);
-
-    status = RAIL_SetTxPowerDbm(aRailHandle, ((RAIL_TxPower_t)aPowerDbm) * 10);
-    assert(status == RAIL_STATUS_NO_ERROR);
-}
-
-static efr32BandConfig *efr32RadioGetBandConfig(uint8_t aChannel)
-{
-    efr32BandConfig *config = NULL;
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        if ((sBandConfigs[i].mChannelMin <= aChannel) && (aChannel <= sBandConfigs[i].mChannelMax))
-        {
-            config = &sBandConfigs[i];
-            break;
-        }
-    }
-
-    return config;
-}
-
-static void efr32BandConfigInit(void (*aEventCallback)(RAIL_Handle_t railHandle, RAIL_Events_t events))
-{
-    uint8_t index = 0;
-
-#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
-    sBandConfigs[index].mRailConfig.eventsCallback = aEventCallback;
-    sBandConfigs[index].mRailConfig.protocol       = NULL;
-    sBandConfigs[index].mRailConfig.scheduler      = &sBandConfigs[index].mRailSchedState;
-    sBandConfigs[index].mChannelConfig             = NULL;
-    sBandConfigs[index].mChannelMin                = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN;
-    sBandConfigs[index].mChannelMax                = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX;
-
-    assert((sBandConfigs[index].mRailHandle = efr32RailConfigInit(&sBandConfigs[index])) != NULL);
-    index++;
-#endif
-}
-
-void efr32RadioInit(void)
-{
-    efr32BandConfigInit(RAILCb_Generic);
-
-    sReceiveFrame.mLength  = 0;
-    sReceiveFrame.mPsdu    = sReceivePsdu;
-    sTransmitFrame.mLength = 0;
-    sTransmitFrame.mPsdu   = sTransmitPsdu;
-
-    sRxBandConfig = efr32RadioGetBandConfig(OPENTHREAD_CONFIG_DEFAULT_CHANNEL);
-    assert(sRxBandConfig != NULL);
-
-    sTxBandConfig = sRxBandConfig;
-    efr32RadioSetTxPower(sTxBandConfig->mRailHandle, sTxBandConfig->mChannelConfig, sTxPowerDbm);
-
-    gRailHandle = sTxBandConfig->mRailHandle; // global handle for alarms.
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-    sTransmitError    = OT_ERROR_NONE;
-    sTransmitBusy     = false;
-
-    otLogInfoPlat("Initialized", NULL);
-}
-
-void efr32RadioDeinit(void)
-{
-    RAIL_Status_t status;
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        RAIL_Idle(sBandConfigs[i].mRailHandle, RAIL_IDLE_FORCE_SHUTDOWN_CLEAR_FLAGS, true);
-
-        status = RAIL_IEEE802154_Deinit(sBandConfigs[i].mRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-        sBandConfigs[i].mRailHandle = NULL;
-    }
-
-    sTxBandConfig = NULL;
-    sRxBandConfig = NULL;
-}
-
-static otError efr32StartEnergyScan(energyScanMode aMode, uint16_t aChannel, RAIL_Time_t aAveragingTimeUs)
-{
-    RAIL_Status_t status;
-    otError       error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(sEnergyScanStatus == ENERGY_SCAN_STATUS_IDLE, error = OT_ERROR_BUSY);
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IN_PROGRESS;
-    sEnergyScanMode   = aMode;
-
-    RAIL_Idle(sRxBandConfig->mRailHandle, RAIL_IDLE, true);
-
-    RAIL_SchedulerInfo_t scanSchedulerInfo = {.priority        = RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY,
-                                              .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-                                              .transactionTime = aAveragingTimeUs};
-
-    status = RAIL_StartAverageRssi(sRxBandConfig->mRailHandle, aChannel, aAveragingTimeUs, &scanSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-exit:
-    return error;
-}
-
-void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint64_t eui64;
-    uint8_t *eui64Ptr = NULL;
-
-    eui64    = SYSTEM_GetUnique();
-    eui64Ptr = (uint8_t *)&eui64;
-
-    for (uint8_t i = 0; i < OT_EXT_ADDRESS_SIZE; i++)
-    {
-        aIeeeEui64[i] = eui64Ptr[(OT_EXT_ADDRESS_SIZE - 1) - i];
-    }
-}
-
-void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("PANID=%X", aPanId);
-
-    utilsSoftSrcMatchSetPanId(aPanId);
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        status = RAIL_IEEE802154_SetPanId(sBandConfigs[i].mRailHandle, aPanId, 0);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-}
-
-void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], aAddress->m8[4],
-                  aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]);
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        status = RAIL_IEEE802154_SetLongAddress(sBandConfigs[i].mRailHandle, (uint8_t *)aAddress->m8, 0);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-}
-
-void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    otLogInfoPlat("ShortAddr=%X", aAddress);
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        status = RAIL_IEEE802154_SetShortAddress(sBandConfigs[i].mRailHandle, aAddress, 0);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-}
-
-bool otPlatRadioIsEnabled(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return (sState != OT_RADIO_STATE_DISABLED);
-}
-
-otError otPlatRadioEnable(otInstance *aInstance)
-{
-    otEXPECT(!otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioDisable(otInstance *aInstance)
-{
-    otEXPECT(otPlatRadioIsEnabled(aInstance));
-
-    otLogInfoPlat("State=OT_RADIO_STATE_DISABLED", NULL);
-    sState = OT_RADIO_STATE_DISABLED;
-
-exit:
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioSleep(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED),
-                    error = OT_ERROR_INVALID_STATE);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL);
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        RAIL_Idle(sBandConfigs[i].mRailHandle, RAIL_IDLE, true);
-    }
-    sState = OT_RADIO_STATE_SLEEP;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
-{
-    otError          error = OT_ERROR_NONE;
-    RAIL_Status_t    status;
-    efr32BandConfig *config;
-
-    OT_UNUSED_VARIABLE(aInstance);
-    otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    if (sRxBandConfig != config)
-    {
-        RAIL_Idle(sRxBandConfig->mRailHandle, RAIL_IDLE, false);
-        sRxBandConfig = config;
-    }
-
-    RAIL_SchedulerInfo_t bgRxSchedulerInfo = {
-        .priority = RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY,
-        // sliptime/transaction time is not used for bg rx
-    };
-
-    status = RAIL_StartRx(sRxBandConfig->mRailHandle, aChannel, &bgRxSchedulerInfo);
-    otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
-
-    otLogInfoPlat("State=OT_RADIO_STATE_RECEIVE", NULL);
-    sState                 = OT_RADIO_STATE_RECEIVE;
-    sReceiveFrame.mChannel = aChannel;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
-{
-    otError           error      = OT_ERROR_NONE;
-    RAIL_CsmaConfig_t csmaConfig = RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA;
-    RAIL_TxOptions_t  txOptions  = RAIL_TX_OPTIONS_NONE;
-    efr32BandConfig * config;
-    RAIL_Status_t     status;
-    uint8_t           frameLength;
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    sRailDebugCounters.mRailPlatTxTriggered++;
-#endif
-
-    assert(sTransmitBusy == false);
-
-    otEXPECT_ACTION((sState != OT_RADIO_STATE_DISABLED) && (sState != OT_RADIO_STATE_TRANSMIT),
-                    error = OT_ERROR_INVALID_STATE);
-
-    config = efr32RadioGetBandConfig(aFrame->mChannel);
-    otEXPECT_ACTION(config != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    sState         = OT_RADIO_STATE_TRANSMIT;
-    sTransmitError = OT_ERROR_NONE;
-    sTransmitBusy  = true;
-
-    if (sTxBandConfig != config)
-    {
-        efr32RadioSetTxPower(config->mRailHandle, config->mChannelConfig, sTxPowerDbm);
-        sTxBandConfig = config;
-    }
-
-    frameLength = (uint8_t)aFrame->mLength;
-    RAIL_WriteTxFifo(sTxBandConfig->mRailHandle, &frameLength, sizeof frameLength, true);
-    RAIL_WriteTxFifo(sTxBandConfig->mRailHandle, aFrame->mPsdu, frameLength - 2, false);
-
-    RAIL_SchedulerInfo_t txSchedulerInfo = {
-        .priority        = RADIO_SCHEDULER_TX_PRIORITY,
-        .slipTime        = RADIO_SCHEDULER_CHANNEL_SLIP_TIME,
-        .transactionTime = 0, // will be calculated later if DMP is used
-    };
-
-    if (aFrame->mPsdu[0] & IEEE802154_ACK_REQUEST)
-    {
-        txOptions |= RAIL_TX_OPTION_WAIT_FOR_ACK;
-
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time we wait for ACK
-        if (RAIL_GetSymbolRate(gRailHandle) > 0)
-        {
-            txSchedulerInfo.transactionTime += 12 * 1e6 / RAIL_GetSymbolRate(gRailHandle);
-        }
-        else
-        {
-            txSchedulerInfo.transactionTime += 12 * RADIO_TIMING_DEFAULT_SYMBOLTIME_US;
-        }
-#endif
-    }
-
-#if RADIO_CONFIG_DMP_SUPPORT
-    // time needed for the frame itself
-    // 4B preamble, 1B SFD, 1B PHR is not counted in frameLength
-    if (RAIL_GetBitRate(gRailHandle) > 0)
-    {
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * 8 * 1e6 / RAIL_GetBitRate(gRailHandle);
-    }
-    else
-    { // assume 250kbps
-        txSchedulerInfo.transactionTime = (frameLength + 4 + 1 + 1) * RADIO_TIMING_DEFAULT_BYTETIME_US;
-    }
-#endif
-
-    if (aFrame->mInfo.mTxInfo.mCsmaCaEnabled)
-    {
-#if RADIO_CONFIG_DMP_SUPPORT
-        // time needed for CSMA/CA
-        txSchedulerInfo.transactionTime += RADIO_TIMING_CSMA_OVERHEAD_US;
-#endif
-        status =
-            RAIL_StartCcaCsmaTx(sTxBandConfig->mRailHandle, aFrame->mChannel, txOptions, &csmaConfig, &txSchedulerInfo);
-    }
-    else
-    {
-        status = RAIL_StartTx(sTxBandConfig->mRailHandle, aFrame->mChannel, txOptions, &txSchedulerInfo);
-    }
-
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStarted++;
-#endif
-        otPlatRadioTxStarted(aInstance, aFrame);
-    }
-    else
-    {
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailTxStartFailed++;
-#endif
-        sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-        sTransmitBusy  = false;
-    }
-
-exit:
-    return error;
-}
-
-otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return &sTransmitFrame;
-}
-
-int8_t otPlatRadioGetRssi(otInstance *aInstance)
-{
-    otError  error;
-    uint32_t start;
-    int8_t   rssi = OT_RADIO_RSSI_INVALID;
-
-    OT_UNUSED_VARIABLE(aInstance);
-
-    error = efr32StartEnergyScan(ENERGY_SCAN_MODE_SYNC, sReceiveFrame.mChannel, EFR32_RSSI_AVERAGING_TIME);
-    otEXPECT(error == OT_ERROR_NONE);
-
-    start = RAIL_GetTime();
-
-    // waiting for the event RAIL_EVENT_RSSI_AVERAGE_DONE
-    while (sEnergyScanStatus == ENERGY_SCAN_STATUS_IN_PROGRESS &&
-           ((RAIL_GetTime() - start) < EFR32_RSSI_AVERAGING_TIMEOUT))
-        ;
-
-    if (sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        rssi = sEnergyScanResultDbm;
-    }
-
-    sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-exit:
-    return rssi;
-}
-
-otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_ENERGY_SCAN;
-}
-
-bool otPlatRadioGetPromiscuous(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return sPromiscuous;
-}
-
-void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    sPromiscuous = aEnable;
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        status = RAIL_IEEE802154_SetPromiscuousMode(sBandConfigs[i].mRailHandle, aEnable);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-}
-
-void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    // set Frame Pending bit for all outgoing ACKs if aEnable is false
-    sIsSrcMatchEnabled = aEnable;
-}
-
-static void processNextRxPacket(otInstance *aInstance, RAIL_Handle_t aRailHandle)
-{
-    RAIL_RxPacketHandle_t  packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    RAIL_RxPacketInfo_t    packetInfo;
-    RAIL_RxPacketDetails_t packetDetails;
-    RAIL_Status_t          status;
-    uint16_t               length;
-
-    packetHandle = RAIL_GetRxPacketInfo(aRailHandle, RAIL_RX_PACKET_HANDLE_OLDEST, &packetInfo);
-
-    otEXPECT_ACTION(packetHandle != RAIL_RX_PACKET_HANDLE_INVALID &&
-                        packetInfo.packetStatus == RAIL_RX_PACKET_READY_SUCCESS,
-                    packetHandle = RAIL_RX_PACKET_HANDLE_INVALID);
-
-    packetDetails.timeReceived.timePosition     = RAIL_PACKET_TIME_INVALID;
-    packetDetails.timeReceived.totalPacketBytes = 0;
-    status                                      = RAIL_GetRxPacketDetails(aRailHandle, packetHandle, &packetDetails);
-    otEXPECT(status == RAIL_STATUS_NO_ERROR);
-
-    length = packetInfo.packetBytes + 1;
-
-    // check the length in recv packet info structure
-    otEXPECT(length == packetInfo.firstPortionData[0]);
-
-    // check the length validity of recv packet
-    otEXPECT(length >= IEEE802154_MIN_LENGTH && length <= IEEE802154_MAX_LENGTH);
-
-    otLogInfoPlat("Received data:%d", length);
-
-    // skip length byte
-    assert(packetInfo.firstPortionBytes > 0);
-    packetInfo.firstPortionData++;
-    packetInfo.firstPortionBytes--;
-    packetInfo.packetBytes--;
-
-    // read packet
-    memcpy(sReceiveFrame.mPsdu, packetInfo.firstPortionData, packetInfo.firstPortionBytes);
-    memcpy(sReceiveFrame.mPsdu + packetInfo.firstPortionBytes, packetInfo.lastPortionData,
-           packetInfo.packetBytes - packetInfo.firstPortionBytes);
-
-    status = RAIL_ReleaseRxPacket(aRailHandle, packetHandle);
-    if (status == RAIL_STATUS_NO_ERROR)
-    {
-        packetHandle = RAIL_RX_PACKET_HANDLE_INVALID;
-    }
-
-    sReceiveFrame.mLength = length;
-
-    if (packetDetails.isAck)
-    {
-        assert((length == IEEE802154_ACK_LENGTH) &&
-               (sReceiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK);
-
-        RAIL_YieldRadio(gRailHandle);
-        sTransmitBusy = false;
-
-        if (sReceiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET])
-        {
-            sTransmitError = OT_ERROR_NONE;
-        }
-        else
-        {
-            sTransmitError = OT_ERROR_NO_ACK;
-        }
-    }
-    else
-    {
-        otEXPECT(length != IEEE802154_ACK_LENGTH);
-
-        sReceiveError = OT_ERROR_NONE;
-
-        sReceiveFrame.mInfo.mRxInfo.mRssi = packetDetails.rssi;
-        sReceiveFrame.mInfo.mRxInfo.mLqi  = packetDetails.lqi;
-
-        // TODO: grab timestamp and handle conversion to msec/usec and RAIL_GetRxTimeSyncWordEndAlt
-        // sReceiveFrame.mInfo.mRxInfo.mMsec = packetDetails.packetTime;
-        // sReceiveFrame.mInfo.mRxInfo.mUsec = packetDetails.packetTime;
-
-        // TODO Set this flag only when the packet is really acknowledged with frame pending set.
-        // See https://github.com/openthread/openthread/pull/3785
-        sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending = true;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-        }
-        else
-#endif
-        {
-            // signal MAC layer for each received frame if promiscuous is enabled
-            // otherwise only signal MAC layer for non-ACK frame
-            if (sPromiscuous || sReceiveFrame.mLength > IEEE802154_ACK_LENGTH)
-            {
-                otLogInfoPlat("Received %d bytes", sReceiveFrame.mLength);
-                otPlatRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-                sRailDebugCounters.mRailPlatRadioReceiveDoneCbCount++;
-#endif
-            }
-        }
-    }
-
-    otSysEventSignalPending();
-
-exit:
-
-    if (packetHandle != RAIL_RX_PACKET_HANDLE_INVALID)
-    {
-        RAIL_ReleaseRxPacket(aRailHandle, packetHandle);
-    }
-}
-
-static void ieee802154DataRequestCommand(RAIL_Handle_t aRailHandle)
-{
-    RAIL_Status_t status;
-
-    if (sIsSrcMatchEnabled)
-    {
-        RAIL_IEEE802154_Address_t sourceAddress;
-
-        status = RAIL_IEEE802154_GetAddress(aRailHandle, &sourceAddress);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-        if ((sourceAddress.length == RAIL_IEEE802154_LongAddress &&
-             utilsSoftSrcMatchExtFindEntry((otExtAddress *)sourceAddress.longAddress) >= 0) ||
-            (sourceAddress.length == RAIL_IEEE802154_ShortAddress &&
-             utilsSoftSrcMatchShortFindEntry(sourceAddress.shortAddress) >= 0))
-        {
-            status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-            assert(status == RAIL_STATUS_NO_ERROR);
-        }
-    }
-    else
-    {
-        status = RAIL_IEEE802154_SetFramePending(aRailHandle);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-}
-
-static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents)
-{
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-    if (aEvents & RAIL_EVENT_CONFIG_SCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigScheduled++;
-    }
-    if (aEvents & RAIL_EVENT_CONFIG_UNSCHEDULED)
-    {
-        sRailDebugCounters.mRailEventConfigUnScheduled++;
-    }
-#endif
-    if (aEvents & RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND)
-    {
-        ieee802154DataRequestCommand(aRailHandle);
-    }
-    if (aEvents & RAIL_EVENTS_TX_COMPLETION)
-    {
-        if (aEvents & RAIL_EVENT_TX_PACKET_SENT)
-        {
-            if ((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0)
-            {
-                RAIL_YieldRadio(aRailHandle);
-                sTransmitError = OT_ERROR_NONE;
-                sTransmitBusy  = false;
-            }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventPacketSent++;
-#endif
-        }
-        else if (aEvents & RAIL_EVENT_TX_CHANNEL_BUSY)
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventChannelBusy++;
-#endif
-        }
-        else
-        {
-            RAIL_YieldRadio(aRailHandle);
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventTxAbort++;
-#endif
-        }
-    }
-
-    if (aEvents & RAIL_EVENT_RX_ACK_TIMEOUT)
-    {
-        RAIL_YieldRadio(aRailHandle);
-        sTransmitError = OT_ERROR_NO_ACK;
-        sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventNoAck++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RX_PACKET_RECEIVED)
-    {
-        RAIL_HoldRxPacket(aRailHandle);
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventPacketReceived++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_CAL_NEEDED)
-    {
-        RAIL_Status_t status;
-
-        status = RAIL_Calibrate(aRailHandle, NULL, RAIL_CAL_ALL_PENDING);
-        assert(status == RAIL_STATUS_NO_ERROR);
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventCalNeeded++;
-#endif
-    }
-
-    if (aEvents & RAIL_EVENT_RSSI_AVERAGE_DONE)
-    {
-        const int16_t energyScanResultQuarterDbm = RAIL_GetAverageRssi(aRailHandle);
-        RAIL_YieldRadio(aRailHandle);
-
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_COMPLETED;
-
-        if (energyScanResultQuarterDbm == RAIL_RSSI_INVALID)
-        {
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-        else
-        {
-            sEnergyScanResultDbm = energyScanResultQuarterDbm / QUARTER_DBM_IN_DBM;
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioEnergyScanDoneCbCount++;
-#endif
-    }
-    if (aEvents & RAIL_EVENT_SCHEDULER_STATUS)
-    {
-        RAIL_SchedulerStatus_t status = RAIL_GetSchedulerStatus(aRailHandle);
-
-        assert(status != RAIL_SCHEDULER_STATUS_INTERNAL_ERROR);
-
-        if (status == RAIL_SCHEDULER_STATUS_CCA_CSMA_TX_FAIL || status == RAIL_SCHEDULER_STATUS_SINGLE_TX_FAIL ||
-            status == RAIL_SCHEDULER_STATUS_SCHEDULED_TX_FAIL ||
-            (status == RAIL_SCHEDULER_STATUS_SCHEDULE_FAIL && sTransmitBusy) ||
-            (status == RAIL_SCHEDULER_STATUS_EVENT_INTERRUPTED && sTransmitBusy))
-        {
-            sTransmitError = OT_ERROR_ABORT;
-            sTransmitBusy  = false;
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-            sRailDebugCounters.mRailEventSchedulerStatusError++;
-#endif
-        }
-        else if (status == RAIL_SCHEDULER_STATUS_AVERAGE_RSSI_FAIL)
-        {
-            sEnergyScanStatus    = ENERGY_SCAN_STATUS_COMPLETED;
-            sEnergyScanResultDbm = OT_RADIO_RSSI_INVALID;
-        }
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        else if (sTransmitBusy)
-        {
-            sRailDebugCounters.mRailEventsSchedulerStatusLastStatus = status;
-            sRailDebugCounters.mRailEventsSchedulerStatusTransmitBusy++;
-        }
-#endif
-    }
-
-    otSysEventSignalPending();
-}
-
-otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return efr32StartEnergyScan(ENERGY_SCAN_MODE_ASYNC, aScanChannel, (RAIL_Time_t)aScanDuration * US_IN_MS);
-}
-
-void efr32RadioProcess(otInstance *aInstance)
-{
-    // We should process the received packet first. Adding it at the end of this function,
-    // will delay the stack notification until the next call to efr32RadioProcess()
-    processNextRxPacket(aInstance, sRxBandConfig->mRailHandle);
-
-    if (sState == OT_RADIO_STATE_TRANSMIT && sTransmitBusy == false)
-    {
-        if (sTransmitError != OT_ERROR_NONE)
-        {
-            otLogDebgPlat("Transmit failed ErrorCode=%d", sTransmitError);
-        }
-
-        sState = OT_RADIO_STATE_RECEIVE;
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioTransmitDone(aInstance, &sTransmitFrame, sTransmitError);
-        }
-        else
-#endif
-            if (((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) || (sTransmitError != OT_ERROR_NONE))
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, sTransmitError);
-        }
-        else
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, &sReceiveFrame, sTransmitError);
-        }
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailPlatRadioTxDoneCbCount++;
-#endif
-
-        otSysEventSignalPending();
-    }
-    else if (sEnergyScanMode == ENERGY_SCAN_MODE_ASYNC && sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
-    {
-        sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
-        otPlatRadioEnergyScanDone(aInstance, sEnergyScanResultDbm);
-        otSysEventSignalPending();
-
-#if RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
-        sRailDebugCounters.mRailEventEnergyScanCompleted++;
-#endif
-    }
-}
-
-otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
-    *aPower = sTxPowerDbm;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    RAIL_Status_t status;
-
-    for (uint8_t i = 0; i < EFR32_NUM_BAND_CONFIGS; i++)
-    {
-        status = RAIL_SetTxPowerDbm(sBandConfigs[i].mRailHandle, ((RAIL_TxPower_t)aPower) * 10);
-        assert(status == RAIL_STATUS_NO_ERROR);
-    }
-
-    sTxPowerDbm = aPower;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aThreshold);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aThreshold);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return EFR32_RECEIVE_SENSITIVITY;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/rail_config.h b/third_party/openthread/repo/examples/platforms/efr32mg21/rail_config.h
deleted file mode 100644 (file)
index 72c7c05..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __RAIL_CONFIG_H__
-#define __RAIL_CONFIG_H__
-
-#include "board_config.h"
-#include "rail_types.h"
-#include <stdint.h>
-
-#define RADIO_CONFIG_XTAL_FREQUENCY 38400000UL
-
-#endif // __RAIL_CONFIG_H__
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/Makefile.am
deleted file mode 100644 (file)
index 5404255..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-
-# Always package (e.g. for 'make dist') these subdirectories.
-
-DIST_SUBDIRS                            = \
-    sleepy-demo-mtd                       \
-    sleepy-demo-ftd                       \
-    $(NULL)
-
-# Always build (e.g. for 'make all') these subdirectories.
-
-SUBDIRS                                 = \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-SUBDIRS                                += sleepy-demo-mtd sleepy-demo-ftd
-endif
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/README.md b/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/README.md
deleted file mode 100644 (file)
index 462cc9f..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# EFR32MG21 Sleepy Demo Example
-
-The EFR32 Sleepy applications demonstrates Sleepy End Device behavior using the EFR32's low power EM2 mode. The steps below will take you through the process of building and running the demo
-
-For setting up the build environment refer to [examples/platforms/efr32mg21/README.md](../README.md).
-
-## 1. Build
-
-```bash
-$ cd <path-to-openthread>
-$ ./bootstrap
-$ make -f examples/Makefile-efr32mg21 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BOARD=BRD4180A
-```
-
-Convert the resulting executables into S-Record format and append a s37 suffix.
-
-```bash
-$ cd output/efr32mg21/bin
-$ arm-none-eabi-objcopy -O srec sleepy-demo-mtd sleepy-demo-mtd.s37
-$ arm-none-eabi-objcopy -O srec sleepy-demo-ftd sleepy-demo-ftd.s37
-```
-
-In Silicon Labs Simplicity Studio flash one device with the sleepy-demo-mtd.s37 image and the other device with the sleepy-demo-ftd.s37 image.
-
-For instructions on flashing firmware see [examples/platforms/efr32mg21/README.md](../README.md#flash-binaries)
-
-## 2. Starting nodes
-
-For demonstration purposes the network settings are hardcoded within the source files. The devices start Thread and form a network within a few seconds of powering on. In a real-life application the devices should implement and go through a commissioning process to create a network and add devices.
-
-When the sleepy-demo-ftd device is started in the CLI the user shall see:
-
-```
-sleepy-demo-ftd started
-sleepy-demo-ftd changed to leader
-```
-
-When the sleepy-demo-mtd device starts it joins the pre-configured Thread network before disabling Rx-On-Idle to become a Sleepy-End-Device.
-
-Use the command "child table" in the FTD console and observe the R flag of the child is 0.
-
-```
-> child table
-| ID  | RLOC16 | Timeout    | Age        | LQ In | C_VN |R|S|D|N| Extended MAC     |
-+-----+--------+------------+------------+-------+------+-+-+-+-+------------------+
-|   1 | 0x8401 |        240 |          3 |     3 |    3 |0|1|0|0| 8e8582dbd78c243c |
-
-Done
-```
-
-## 3. MTD behavior on wake-up
-
-MTD wakes up every 5 seconds and sends a multicast UDP message containing the string "mtd is awake". The FTD listens on the multicast address and will toggle LED 0 and display a message in the CLI showing "Message Received: mtd is awake".
-
-## 4. Monitoring power consumption of the MTD
-
-Open the Energy Profiler within Silicon Labs Simplicity Studio. Within the Quick Access menu select Start Energy Capture... and select the MTD device. When operating as a Sleepy End Device with no LEDs on the current should be under 20-80 microamps with occasional spikes during waking and polling the parent. With the LED on the MTD has a current consumption of approximately 1mA.
-
-When operating as a Minimal End Device with the Rx on Idle observe that the current is in the order of 10ma.
-
-With further configuration of GPIOs and peripherals it is possible to reduce the sleepy current consumption further.
-
-## 5. Notes on sleeping, sleepy callback and interrupts
-
-To allow the EFR32 to enter sleepy mode the application must register a callback with efr32SetSleepCallback. The return value of callback is used to indicate that the application has no further work to do and that it is safe to go into a low power mode. The callback is called with interrupts disabled so should do the minimum required to check if it can sleep.
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/Makefile.am
deleted file mode 100644 (file)
index 9384967..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-include $(top_srcdir)/examples/platforms/Makefile.platform.am
-
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-$(top_builddir)/examples/platforms/efr32mg21/libopenthread-efr32mg21.a:
-       (cd $(top_builddir)/examples/platforms/efr32mg21/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg21.a )
-
-bin_PROGRAMS                                                                  = \
-    $(NULL)
-
-CPPFLAGS_COMMON                                                              += \
-    -DEFR32_SERIES2_CONFIG1_MICRO                                               \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -Wno-sign-compare                                                           \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG21_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG21P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg2x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-LDADD_COMMON                                                                 += \
-    $(NULL)
-
-LDFLAGS_COMMON                                                               += \
-    $(NULL)
-
-LIBTOOLFLAGS_COMMON                                                          += \
-    $(NULL)
-
-SOURCES_COMMON                                                               += \
-    main.c                                                                      \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-LDADD_COMMON                                                                 += \
-    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                         \
-    $(NULL)
-endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-bin_PROGRAMS                                                                 += \
-    sleepy-demo-ftd                                                             \
-    $(NULL)
-endif
-
-sleepy_demo_ftd_CPPFLAGS                                                      = \
-    $(CPPFLAGS_COMMON)                                                          \
-    $(NULL)
-
-sleepy_demo_ftd_LDADD                                                         = \
-    $(top_builddir)/src/cli/libopenthread-cli-ftd.a                             \
-    $(top_builddir)/src/core/libopenthread-ftd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(top_builddir)/src/core/libopenthread-ftd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(NULL)
-
-sleepy_demo_ftd_LDFLAGS                                                       = \
-    $(LDFLAGS_COMMON)                                                           \
-    $(NULL)
-
-sleepy_demo_ftd_LIBTOOLFLAGS                                                  = \
-    $(LIBTOOLFLAGS_COMMON)                                                      \
-    $(NULL)
-
-sleepy_demo_ftd_SOURCES                                                       = \
-    $(SOURCES_COMMON)                                                           \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_LINKER_MAP
-sleepy_demo_ftd_LDFLAGS += -Wl,-Map=sleepy-demo-ftd.map
-endif
-
-if OPENTHREAD_BUILD_COVERAGE
-CPPFLAGS_COMMON                                                              += \
-    -DOPENTHREAD_ENABLE_COVERAGE                                                \
-    $(NULL)
-
-CLEANFILES = $(wildcard *.gcda *.gcno)
-endif # OPENTHREAD_BUILD_COVERAGE
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/main.c b/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/main.c
deleted file mode 100644 (file)
index e54fe82..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "bsp.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "gpiointerrupt.h"
-#include "hal-config-board.h"
-#include "hal_common.h"
-#include "openthread-system.h"
-#include <assert.h>
-#include <common/logging.hpp>
-#include <openthread-core-config.h>
-#include <string.h>
-#include <openthread/cli.h>
-#include <openthread/config.h>
-#include <openthread/dataset_ftd.h>
-#include <openthread/diag.h>
-#include <openthread/instance.h>
-#include <openthread/message.h>
-#include <openthread/tasklet.h>
-#include <openthread/thread.h>
-#include <openthread/udp.h>
-#include <openthread/platform/logging.h>
-
-// Constants
-#define MULTICAST_ADDR "ff03::1"
-#define MULTICAST_PORT 123
-#define RECV_PORT 234
-#define MTD_MESSAGE "mtd button"
-#define FTD_MESSAGE "ftd button"
-
-// Types
-typedef struct ButtonArray
-{
-    GPIO_Port_TypeDef port;
-    unsigned int      pin;
-} ButtonArray_t;
-
-// Prototypes
-void setNetworkConfiguration(otInstance *aInstance);
-void handleNetifStateChanged(uint32_t aFlags, void *aContext);
-void gpioInit(void (*gpioCallback)(uint8_t pin));
-void buttonCallback(uint8_t pin);
-void initUdp(void);
-void applicationTick(void);
-void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
-
-// Variables
-static otInstance *        instance;
-static otUdpSocket         sFtdSocket;
-static bool                sLedOn             = false;
-static bool                sHaveSwitchAddress = false;
-static otIp6Address        sSwitchAddress;
-static bool                sFtdButtonPressed              = false;
-static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
-
-void otTaskletsSignalPending(otInstance *aInstance)
-{
-    (void)aInstance;
-}
-
-int main(int argc, char *argv[])
-{
-    otSysInit(argc, argv);
-    gpioInit(buttonCallback);
-
-    instance = otInstanceInitSingle();
-    assert(instance);
-
-    otCliUartInit(instance);
-    otCliOutputFormat("sleepy-demo-ftd started\r\n");
-
-    setNetworkConfiguration(instance);
-    otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
-    initUdp();
-
-    otIp6SetEnabled(instance, true);
-    otThreadSetEnabled(instance, true);
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-        applicationTick();
-    }
-
-    otInstanceFinalize(instance);
-    return 0;
-}
-
-/*
- * Provide, if required an "otPlatLog()" function
- */
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-    OT_UNUSED_VARIABLE(aFormat);
-
-    va_list ap;
-    va_start(ap, aFormat);
-    otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
-    va_end(ap);
-}
-#endif
-
-/**
- * Override default network settings, such as panid, so the devices can join a network
- */
-void setNetworkConfiguration(otInstance *aInstance)
-{
-    static char          aNetworkName[] = "SleepyEFR32";
-    otOperationalDataset aDataset;
-
-    memset(&aDataset, 0, sizeof(otOperationalDataset));
-
-    /*
-     * Fields that can be configured in otOperationDataset to override defaults:
-     *     Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
-     *     Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
-     */
-    aDataset.mActiveTimestamp                      = 1;
-    aDataset.mComponents.mIsActiveTimestampPresent = true;
-
-    /* Set Channel to 15 */
-    aDataset.mChannel                      = 15;
-    aDataset.mComponents.mIsChannelPresent = true;
-
-    /* Set Pan ID to 2222 */
-    aDataset.mPanId                      = (otPanId)0x2222;
-    aDataset.mComponents.mIsPanIdPresent = true;
-
-    /* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
-    uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
-    aDataset.mComponents.mIsExtendedPanIdPresent = true;
-
-    /* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
-    uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
-    aDataset.mComponents.mIsMasterKeyPresent = true;
-
-    /* Set Network Name to SleepyEFR32 */
-    size_t length = strlen(aNetworkName);
-    assert(length <= OT_NETWORK_NAME_MAX_SIZE);
-    memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
-    aDataset.mComponents.mIsNetworkNamePresent = true;
-
-    otDatasetSetActive(aInstance, &aDataset);
-}
-
-void handleNetifStateChanged(uint32_t aFlags, void *aContext)
-{
-    if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
-    {
-        otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
-
-        switch (changedRole)
-        {
-        case OT_DEVICE_ROLE_LEADER:
-            otCliOutputFormat("sleepy-demo-ftd changed to leader\r\n");
-            break;
-        case OT_DEVICE_ROLE_ROUTER:
-            otCliOutputFormat("sleepy-demo-ftd changed to router\r\n");
-            break;
-
-        case OT_DEVICE_ROLE_CHILD:
-            break;
-
-        case OT_DEVICE_ROLE_DETACHED:
-        case OT_DEVICE_ROLE_DISABLED:
-            break;
-        }
-    }
-}
-
-void gpioInit(void (*callback)(uint8_t pin))
-{
-    // set up button GPIOs to input with pullups
-    for (int i = 0; i < BSP_BUTTON_COUNT; i++)
-    {
-        GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
-    }
-    // set up interrupt based callback function on falling edge
-    GPIOINT_Init();
-    GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
-    GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
-    GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
-    GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
-
-    BSP_LedsInit();
-    BSP_LedClear(0);
-    BSP_LedClear(1);
-}
-
-void initUdp(void)
-{
-    otError    error;
-    otSockAddr sockaddr;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-
-    otIp6AddressFromString(MULTICAST_ADDR, &sockaddr.mAddress);
-    sockaddr.mPort = MULTICAST_PORT;
-
-    error = otUdpOpen(instance, &sFtdSocket, sFtdReceiveCallback, NULL);
-    if (error != OT_ERROR_NONE)
-    {
-        otCliOutputFormat("FTD failed to open udp multicast\r\n");
-        return;
-    }
-
-    error = otUdpBind(instance, &sFtdSocket, &sockaddr);
-    if (error != OT_ERROR_NONE)
-    {
-        otUdpClose(instance, &sFtdSocket);
-        otCliOutputFormat("FTD failed to bind udp multicast\r\n");
-        return;
-    }
-}
-
-void buttonCallback(uint8_t pin)
-{
-    OT_UNUSED_VARIABLE(pin);
-    sFtdButtonPressed = true;
-}
-
-void applicationTick(void)
-{
-    otError       error = 0;
-    otMessageInfo messageInfo;
-    otMessage *   message = NULL;
-    char *        payload = FTD_MESSAGE;
-
-    if (sFtdButtonPressed == true)
-    {
-        sFtdButtonPressed = false;
-
-        if (sHaveSwitchAddress)
-        {
-            memset(&messageInfo, 0, sizeof(messageInfo));
-            memcpy(&messageInfo.mPeerAddr, &sSwitchAddress, sizeof messageInfo.mPeerAddr);
-            messageInfo.mPeerPort = RECV_PORT;
-
-            message = otUdpNewMessage(instance, NULL);
-
-            if (message != NULL)
-            {
-                error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
-
-                if (error == OT_ERROR_NONE)
-                {
-                    error = otUdpSend(instance, &sFtdSocket, message, &messageInfo);
-
-                    if (error == OT_ERROR_NONE)
-                    {
-                        return;
-                    }
-                }
-            }
-
-            if (message != NULL)
-            {
-                otMessageFree(message);
-            }
-        }
-    }
-}
-
-void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aMessage);
-    OT_UNUSED_VARIABLE(aMessageInfo);
-    uint8_t buf[1500];
-    int     length;
-
-    sLedOn = !sLedOn;
-
-    if (sLedOn)
-    {
-        BSP_LedSet(0);
-    }
-    else
-    {
-        BSP_LedClear(0);
-    }
-
-    length      = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
-    buf[length] = '\0';
-    otCliOutputFormat("Message Received: %s\r\n", buf);
-
-    sHaveSwitchAddress = true;
-    memcpy(&sSwitchAddress, &aMessageInfo->mPeerAddr, sizeof sSwitchAddress);
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-mtd/Makefile.am b/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-mtd/Makefile.am
deleted file mode 100644 (file)
index 4903172..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
-include $(top_srcdir)/examples/platforms/Makefile.platform.am
-
-override CFLAGS   := $(filter-out -Wconversion,$(CFLAGS))
-override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
-
-EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
-
-SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
-
-$(top_builddir)/examples/platforms/efr32mg21/libopenthread-efr32mg21.a:
-       (cd $(top_builddir)/examples/platforms/efr32mg21/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg21.a )
-
-bin_PROGRAMS                                                                  = \
-    $(NULL)
-
-CPPFLAGS_COMMON                                                              += \
-    -DEFR32_SERIES2_CONFIG1_MICRO                                               \
-    -DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\"      \
-    -DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\"       \
-    -Wno-sign-compare                                                           \
-    -I$(top_srcdir)/examples/platforms                                          \
-    -I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR)             \
-    -I$(top_srcdir)/include                                                     \
-    -I$(top_srcdir)/src/core                                                    \
-    -I$(top_srcdir)/third_party/silabs/rail_config                              \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/bsp                                    \
-    -I$(SDK_SRC_DIR)/hardware/kit/common/drivers                                \
-    -I$(SDK_SRC_DIR)/hardware/kit/EFR32MG21_$(BOARD)/config                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32                     \
-    -I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config              \
-    -I$(SDK_SRC_DIR)/platform/common/inc                                        \
-    -I$(SDK_SRC_DIR)/platform/CMSIS/Include                                     \
-    -I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG21P/Include             \
-    -I$(SDK_SRC_DIR)/platform/emdrv/common/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc                           \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config                              \
-    -I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc                                 \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc                                  \
-    -I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config                               \
-    -I$(SDK_SRC_DIR)/platform/emlib/inc                                         \
-    -I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32                         \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg2x               \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex        \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/common                             \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal                                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32                          \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154                \
-    -I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions              \
-    -I$(SDK_SRC_DIR)/platform/service/mpu/inc                                   \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/config                         \
-    -I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc                            \
-    -I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control                      \
-    -I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include                 \
-    -Wno-unused-parameter                                                       \
-    -Wno-missing-field-initializers                                             \
-    $(NULL)
-
-LDADD_COMMON                                                                 += \
-    $(NULL)
-
-LDFLAGS_COMMON                                                               += \
-    $(NULL)
-
-LIBTOOLFLAGS_COMMON                                                          += \
-    $(NULL)
-
-SOURCES_COMMON                                                               += \
-    main.c                                                                      \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-LDADD_COMMON                                                                 += \
-    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                         \
-    $(NULL)
-endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
-
-if OPENTHREAD_ENABLE_EXECUTABLE
-bin_PROGRAMS                                                                 += \
-    sleepy-demo-mtd                                                             \
-    $(NULL)
-endif
-
-sleepy_demo_mtd_CPPFLAGS                                                      = \
-    $(CPPFLAGS_COMMON)                                                          \
-    $(NULL)
-
-sleepy_demo_mtd_LDADD                                                         = \
-    $(top_builddir)/src/cli/libopenthread-cli-mtd.a                             \
-    $(top_builddir)/src/core/libopenthread-mtd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(top_builddir)/src/core/libopenthread-mtd.a                                \
-    $(LDADD_COMMON)                                                             \
-    $(NULL)
-
-sleepy_demo_mtd_LDFLAGS                                                       = \
-    $(LDFLAGS_COMMON)                                                           \
-    $(NULL)
-
-sleepy_demo_mtd_LIBTOOLFLAGS                                                  = \
-    $(LIBTOOLFLAGS_COMMON)                                                      \
-    $(NULL)
-
-sleepy_demo_mtd_SOURCES                                                       = \
-    $(SOURCES_COMMON)                                                           \
-    $(NULL)
-
-if OPENTHREAD_ENABLE_LINKER_MAP
-sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
-endif
-
-if OPENTHREAD_BUILD_COVERAGE
-CPPFLAGS_COMMON                                                              += \
-    -DOPENTHREAD_ENABLE_COVERAGE                                                \
-    $(NULL)
-
-CLEANFILES = $(wildcard *.gcda *.gcno)
-endif # OPENTHREAD_BUILD_COVERAGE
-
-include $(abs_top_nlbuild_autotools_dir)/automake/post.am
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-mtd/main.c b/third_party/openthread/repo/examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-mtd/main.c
deleted file mode 100644 (file)
index ebb3169..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <string.h>
-
-#include "bsp.h"
-#include "em_cmu.h"
-#include "em_emu.h"
-#include "gpiointerrupt.h"
-#include "hal-config-board.h"
-#include "hal_common.h"
-#include "openthread-system.h"
-#include "platform-efr32.h"
-#include <common/logging.hpp>
-#include <openthread-core-config.h>
-#include <openthread/cli.h>
-#include <openthread/config.h>
-#include <openthread/dataset_ftd.h>
-#include <openthread/diag.h>
-#include <openthread/instance.h>
-#include <openthread/link.h>
-#include <openthread/message.h>
-#include <openthread/tasklet.h>
-#include <openthread/thread.h>
-#include <openthread/udp.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/logging.h>
-
-// Constants
-#define MULTICAST_ADDR "ff03::1"
-#define MULTICAST_PORT 123
-#define RECV_PORT 234
-#define SLEEPY_POLL_PERIOD_MS 5000
-#define MTD_MESSAGE "mtd is awake"
-#define FTD_MESSAGE "ftd button"
-
-// Types
-typedef struct ButtonArray
-{
-    GPIO_Port_TypeDef port;
-    unsigned int      pin;
-} ButtonArray_t;
-
-// Prototypes
-void deviceOutOfSleepCb(void);
-bool sleepCb(void);
-void setNetworkConfiguration(otInstance *aInstance);
-void handleNetifStateChanged(uint32_t aFlags, void *aContext);
-void gpioInit(void (*gpioCallback)(uint8_t pin));
-void buttonCallback(uint8_t pin);
-void initUdp(void);
-void applicationTick(void);
-void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
-
-// Variables
-static otInstance *        instance;
-static otUdpSocket         sMtdSocket;
-static otSockAddr          sMulticastSockAddr;
-static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
-static bool                sButtonPressed                 = false;
-static bool                sRxOnIdleButtonPressed         = false;
-static bool                sLedOn                         = false;
-static bool                sAllowDeepSleep                = false;
-static bool                sTaskletsPendingSem            = true;
-
-int main(int argc, char *argv[])
-{
-    otLinkModeConfig config;
-
-    otSysInit(argc, argv);
-    gpioInit(buttonCallback);
-
-    instance = otInstanceInitSingle();
-    assert(instance);
-
-    otCliUartInit(instance);
-
-    otLinkSetPollPeriod(instance, SLEEPY_POLL_PERIOD_MS);
-    setNetworkConfiguration(instance);
-    otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
-
-    config.mRxOnWhenIdle       = true;
-    config.mSecureDataRequests = true;
-    config.mDeviceType         = 0;
-    config.mNetworkData        = 0;
-    otThreadSetLinkMode(instance, config);
-
-    initUdp();
-    otIp6SetEnabled(instance, true);
-    otThreadSetEnabled(instance, true);
-    efr32SetSleepCallback(sleepCb, deviceOutOfSleepCb);
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-
-        applicationTick();
-
-        // Put the EFR32 into deep sleep if callback sleepCb permits.
-        efr32Sleep();
-    }
-
-    otInstanceFinalize(instance);
-    return 0;
-}
-
-void deviceOutOfSleepCb(void)
-{
-    static uint32_t udpPacketSendTimer = 0;
-
-    if (udpPacketSendTimer == 0)
-    {
-        udpPacketSendTimer = otPlatAlarmMilliGetNow();
-    }
-
-    if ((otPlatAlarmMilliGetNow() - udpPacketSendTimer) >= 5000)
-    {
-        sButtonPressed     = true;
-        udpPacketSendTimer = 0;
-    }
-}
-
-/*
- * Callback from efr32Sleep to indicate if it is ok to go into sleep mode.
- * This runs with interrupts disabled.
- */
-bool sleepCb(void)
-{
-    bool allow;
-    allow               = (sAllowDeepSleep && !sTaskletsPendingSem);
-    sTaskletsPendingSem = false;
-    return allow;
-}
-
-void otTaskletsSignalPending(otInstance *aInstance)
-{
-    (void)aInstance;
-    sTaskletsPendingSem = true;
-}
-
-/*
- * Override default network settings, such as panid, so the devices can join a network
- */
-void setNetworkConfiguration(otInstance *aInstance)
-{
-    static char          aNetworkName[] = "SleepyEFR32";
-    otOperationalDataset aDataset;
-
-    memset(&aDataset, 0, sizeof(otOperationalDataset));
-
-    /*
-     * Fields that can be configured in otOperationDataset to override defaults:
-     *     Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
-     *     Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
-     */
-    aDataset.mActiveTimestamp                      = 1;
-    aDataset.mComponents.mIsActiveTimestampPresent = true;
-
-    /* Set Channel to 15 */
-    aDataset.mChannel                      = 15;
-    aDataset.mComponents.mIsChannelPresent = true;
-
-    /* Set Pan ID to 2222 */
-    aDataset.mPanId                      = (otPanId)0x2222;
-    aDataset.mComponents.mIsPanIdPresent = true;
-
-    /* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
-    uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
-    aDataset.mComponents.mIsExtendedPanIdPresent = true;
-
-    /* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
-    uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
-    memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
-    aDataset.mComponents.mIsMasterKeyPresent = true;
-
-    /* Set Network Name to SleepyEFR32 */
-    size_t length = strlen(aNetworkName);
-    assert(length <= OT_NETWORK_NAME_MAX_SIZE);
-    memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
-    aDataset.mComponents.mIsNetworkNamePresent = true;
-
-    otDatasetSetActive(aInstance, &aDataset);
-}
-
-void handleNetifStateChanged(uint32_t aFlags, void *aContext)
-{
-    otLinkModeConfig config;
-
-    if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
-    {
-        otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
-
-        switch (changedRole)
-        {
-        case OT_DEVICE_ROLE_LEADER:
-        case OT_DEVICE_ROLE_ROUTER:
-            break;
-
-        case OT_DEVICE_ROLE_CHILD:
-            config.mRxOnWhenIdle       = 0;
-            config.mSecureDataRequests = true;
-            config.mDeviceType         = 0;
-            config.mNetworkData        = 0;
-            otThreadSetLinkMode(instance, config);
-            sAllowDeepSleep = true;
-            break;
-
-        case OT_DEVICE_ROLE_DETACHED:
-        case OT_DEVICE_ROLE_DISABLED:
-            break;
-        }
-    }
-}
-
-/*
- * Provide, if required an "otPlatLog()" function
- */
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-    OT_UNUSED_VARIABLE(aFormat);
-
-    va_list ap;
-    va_start(ap, aFormat);
-    otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
-    va_end(ap);
-}
-#endif
-
-void gpioInit(void (*callback)(uint8_t pin))
-{
-    // set up button GPIOs to input with pullups
-    for (int i = 0; i < BSP_BUTTON_COUNT; i++)
-    {
-        GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
-    }
-    // set up interrupt based callback function on falling edge
-    GPIOINT_Init();
-    GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
-    GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
-    GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
-    GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
-
-    BSP_LedsInit();
-    BSP_LedClear(0);
-    BSP_LedClear(1);
-}
-
-void initUdp(void)
-{
-    otError    error;
-    otSockAddr sockaddr;
-
-    memset(&sMulticastSockAddr, 0, sizeof sMulticastSockAddr);
-    otIp6AddressFromString(MULTICAST_ADDR, &sMulticastSockAddr.mAddress);
-    sMulticastSockAddr.mPort = MULTICAST_PORT;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-    sockaddr.mPort = RECV_PORT;
-
-    error = otUdpOpen(instance, &sMtdSocket, mtdReceiveCallback, NULL);
-
-    if (error != OT_ERROR_NONE)
-    {
-        return;
-    }
-
-    error = otUdpBind(instance, &sMtdSocket, &sockaddr);
-
-    if (error != OT_ERROR_NONE)
-    {
-        otUdpClose(instance, &sMtdSocket);
-        return;
-    }
-}
-
-void buttonCallback(uint8_t pin)
-{
-    if ((pin & 0x01) == 0x01)
-    {
-        sButtonPressed = true;
-    }
-    else if ((pin & 0x01) == 0x00)
-    {
-        sRxOnIdleButtonPressed = true;
-    }
-}
-
-void applicationTick(void)
-{
-    otError          error = 0;
-    otMessageInfo    messageInfo;
-    otMessage *      message = NULL;
-    char *           payload = MTD_MESSAGE;
-    otLinkModeConfig config;
-
-    if (sRxOnIdleButtonPressed == true)
-    {
-        sRxOnIdleButtonPressed     = false;
-        sAllowDeepSleep            = !sAllowDeepSleep;
-        config.mRxOnWhenIdle       = !sAllowDeepSleep;
-        config.mSecureDataRequests = true;
-        config.mDeviceType         = 0;
-        config.mNetworkData        = 0;
-        otThreadSetLinkMode(instance, config);
-    }
-
-    if (sButtonPressed == true)
-    {
-        sButtonPressed = false;
-
-        memset(&messageInfo, 0, sizeof(messageInfo));
-        memcpy(&messageInfo.mPeerAddr, &sMulticastSockAddr.mAddress, sizeof messageInfo.mPeerAddr);
-        messageInfo.mPeerPort = sMulticastSockAddr.mPort;
-
-        message = otUdpNewMessage(instance, NULL);
-
-        if (message != NULL)
-        {
-            error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
-
-            if (error == OT_ERROR_NONE)
-            {
-                error = otUdpSend(instance, &sMtdSocket, message, &messageInfo);
-
-                if (error == OT_ERROR_NONE)
-                {
-                    return;
-                }
-            }
-        }
-
-        if (message != NULL)
-        {
-            otMessageFree(message);
-        }
-    }
-}
-
-void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aMessage);
-    OT_UNUSED_VARIABLE(aMessageInfo);
-    uint8_t buf[1500];
-    int     length;
-
-    length      = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
-    buf[length] = '\0';
-
-    if (strcmp((char *)buf, FTD_MESSAGE) == 0)
-    {
-        sLedOn = !sLedOn;
-
-        if (sLedOn)
-        {
-            BSP_LedSet(0);
-        }
-        else
-        {
-            BSP_LedClear(0);
-        }
-    }
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/startup-gcc.c b/third_party/openthread/repo/examples/platforms/efr32mg21/startup-gcc.c
deleted file mode 100644 (file)
index cf5a60b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements gcc-specific startup code for the efr32.
- */
-
-__extension__ typedef int __guard __attribute__((mode(__DI__)));
-
-int __cxa_guard_acquire(__guard *g)
-{
-    return !*(char *)(g);
-}
-
-void __cxa_guard_release(__guard *g)
-{
-    *(char *)g = 1;
-}
-
-void __cxa_guard_abort(__guard *g)
-{
-    (void)g;
-}
-
-void __cxa_pure_virtual(void)
-{
-    while (1)
-        ;
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/system.c b/third_party/openthread/repo/examples/platforms/efr32mg21/system.c
deleted file mode 100644 (file)
index 32f9346..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief
- *   This file includes the platform-specific initializers.
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-#include <string.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "common/logging.hpp"
-
-#include "bsp.h"
-#include "em_chip.h"
-#include "em_cmu.h"
-#include "em_core.h"
-#include "em_emu.h"
-#include "em_system.h"
-#include "hal-config.h"
-#include "hal_common.h"
-#include "rail.h"
-#include "sl_mpu.h"
-#include "sl_sleeptimer.h"
-
-#include "platform-efr32.h"
-
-#if (HAL_FEM_ENABLE)
-#include "fem-control.h"
-#endif
-
-#define USE_EFR32_LOG (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-
-void halInitChipSpecific(void);
-
-otInstance *sInstance;
-static bool (*sCanSleepCallback)(void);
-static void (*sDeviceOutOfSleepCb)(void);
-
-void otSysInit(int argc, char *argv[])
-{
-    OT_UNUSED_VARIABLE(argc);
-    OT_UNUSED_VARIABLE(argv);
-    sl_status_t status;
-
-    __disable_irq();
-
-#undef FIXED_EXCEPTION
-#define FIXED_EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler)
-#define EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler, priorityLevel, subpriority) \
-    NVIC_SetPriority(deviceIrqn, NVIC_EncodePriority(PRIGROUP_POSITION - 1, priorityLevel, subpriority));
-#include NVIC_CONFIG
-#undef EXCEPTION
-
-    NVIC_SetPriorityGrouping(PRIGROUP_POSITION - 1);
-    CHIP_Init();
-    halInitChipSpecific();
-    BSP_Init(BSP_INIT_BCC);
-
-    CMU_OscillatorEnable(cmuOsc_LFRCO, true, true);
-    CMU_ClockEnable(cmuClock_RTCC, true);
-
-    status = sl_sleeptimer_init();
-    assert(status == SL_STATUS_OK);
-
-#if (HAL_FEM_ENABLE)
-    initFem();
-    wakeupFem();
-#endif
-
-    __enable_irq();
-
-#if USE_EFR32_LOG
-    efr32LogInit();
-#endif
-    efr32RadioInit();
-    efr32AlarmInit();
-    efr32MiscInit();
-}
-
-bool otSysPseudoResetWasRequested(void)
-{
-    return false;
-}
-
-void otSysDeinit(void)
-{
-    efr32RadioDeinit();
-
-#if USE_EFR32_LOG
-    efr32LogDeinit();
-#endif
-}
-
-void efr32SetSleepCallback(bool (*aCallback)(void), void (*aCallbackWake)(void))
-{
-    sCanSleepCallback   = aCallback;
-    sDeviceOutOfSleepCb = aCallbackWake;
-}
-
-void efr32Sleep(void)
-{
-    bool canDeepSleep      = false;
-    int  wakeupProcessTime = 1000;
-    CORE_DECLARE_IRQ_STATE;
-
-    if (RAIL_Sleep(wakeupProcessTime, &canDeepSleep) == RAIL_STATUS_NO_ERROR)
-    {
-        if (canDeepSleep)
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM2(true);
-            }
-            CORE_EXIT_ATOMIC();
-            // TODO OT will handle an interrupt here and it mustn't call any RAIL APIs
-
-            while (RAIL_Wake(0) != RAIL_STATUS_NO_ERROR)
-            {
-            }
-
-            if (sDeviceOutOfSleepCb != NULL)
-            {
-                sDeviceOutOfSleepCb();
-            }
-        }
-        else
-        {
-            CORE_ENTER_ATOMIC();
-            if (sCanSleepCallback != NULL && sCanSleepCallback())
-            {
-                EMU_EnterEM1();
-            }
-            CORE_EXIT_ATOMIC();
-        }
-    }
-}
-
-void otSysProcessDrivers(otInstance *aInstance)
-{
-    sInstance = aInstance;
-
-    // should sleep and wait for interrupts here
-
-    efr32UartProcess();
-    efr32RadioProcess(aInstance);
-    efr32AlarmProcess(aInstance);
-}
-
-__WEAK void otSysEventSignalPending(void)
-{
-    // Intentionally empty
-}
diff --git a/third_party/openthread/repo/examples/platforms/efr32mg21/uart.c b/third_party/openthread/repo/examples/platforms/efr32mg21/uart.c
deleted file mode 100644 (file)
index 9d93a3b..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for UART communication.
- *
- */
-
-#include <stddef.h>
-
-#include "openthread-system.h"
-#include <openthread/platform/uart.h>
-
-#include "utils/code_utils.h"
-
-#include "em_core.h"
-#include "uartdrv.h"
-
-#include "hal-config.h"
-
-enum
-{
-    kReceiveFifoSize = 128,
-};
-
-#define USART_PORT USART0
-#define USART_PORT_RX_IRQn USART0_RX_IRQn
-
-#define USART_INIT                                                                        \
-    {                                                                                     \
-        USART_PORT,                                           /* USART port */            \
-            115200,                                           /* Baud rate */             \
-            BSP_SERIAL_APP_TX_PORT,                           /* USART Tx port number */  \
-            BSP_SERIAL_APP_RX_PORT,                           /* USART Rx port number */  \
-            BSP_SERIAL_APP_TX_PIN,                            /* USART Tx pin number */   \
-            BSP_SERIAL_APP_RX_PIN,                            /* USART Rx pin number */   \
-            0,                                                /* UART instance number */  \
-            (USART_Stopbits_TypeDef)USART_FRAME_STOPBITS_ONE, /* Stop bits */             \
-            (USART_Parity_TypeDef)USART_FRAME_PARITY_NONE,    /* Parity */                \
-            (USART_OVS_TypeDef)USART_CTRL_OVS_X16,            /* Oversampling mode*/      \
-            false,                                            /* Majority vote disable */ \
-            HAL_SERIAL_APP_FLOW_CONTROL,                      /* Flow control */          \
-            BSP_SERIAL_APP_CTS_PORT,                          /* CTS port number */       \
-            BSP_SERIAL_APP_CTS_PIN,                           /* CTS pin number */        \
-            BSP_SERIAL_APP_RTS_PORT,                          /* RTS port number */       \
-            BSP_SERIAL_APP_RTS_PIN,                           /* RTS pin number */        \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartRxQueue,      /* RX operation queue */    \
-            (UARTDRV_Buffer_FifoQueue_t *)&sUartTxQueue,      /* TX operation queue */    \
-    }
-
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_RX_BUFS, sUartRxQueue);
-DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_TX_BUFS, sUartTxQueue);
-
-static UARTDRV_HandleData_t sUartHandleData;
-static UARTDRV_Handle_t     sUartHandle = &sUartHandleData;
-static uint8_t              sReceiveBuffer[2];
-static const uint8_t *      sTransmitBuffer = NULL;
-static volatile uint16_t    sTransmitLength = 0;
-
-typedef struct ReceiveFifo_t
-{
-    // The data buffer
-    uint8_t mBuffer[kReceiveFifoSize];
-    // The offset of the first item written to the list.
-    volatile uint16_t mHead;
-    // The offset of the next item to be written to the list.
-    volatile uint16_t mTail;
-} ReceiveFifo_t;
-
-static ReceiveFifo_t sReceiveFifo;
-
-static void processReceive(void);
-
-static void receiveDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    // We can only write if incrementing mTail doesn't equal mHead
-    if (sReceiveFifo.mHead != (sReceiveFifo.mTail + 1) % kReceiveFifoSize)
-    {
-        sReceiveFifo.mBuffer[sReceiveFifo.mTail] = aData[0];
-        sReceiveFifo.mTail                       = (sReceiveFifo.mTail + 1) % kReceiveFifoSize;
-    }
-
-    UARTDRV_Receive(aHandle, aData, 1, receiveDone);
-    otSysEventSignalPending();
-}
-
-static void transmitDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
-{
-    sTransmitLength = 0;
-    otSysEventSignalPending();
-}
-
-static void processReceive(void)
-{
-    // Copy tail to prevent multiple reads
-    uint16_t tail = sReceiveFifo.mTail;
-
-    // If the data wraps around, process the first part
-    if (sReceiveFifo.mHead > tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, kReceiveFifoSize - sReceiveFifo.mHead);
-
-        // Reset the buffer mHead back to zero.
-        sReceiveFifo.mHead = 0;
-    }
-
-    // For any data remaining, process it
-    if (sReceiveFifo.mHead != tail)
-    {
-        otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, tail - sReceiveFifo.mHead);
-
-        // Set mHead to the local tail we have cached
-        sReceiveFifo.mHead = tail;
-    }
-}
-
-otError otPlatUartFlush(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-static void processTransmit(void)
-{
-    if (sTransmitBuffer != NULL && sTransmitLength == 0)
-    {
-        sTransmitBuffer = NULL;
-        otPlatUartSendDone();
-    }
-}
-
-otError otPlatUartEnable(void)
-{
-    UARTDRV_Init_t uartInit = USART_INIT;
-
-    sReceiveFifo.mHead = 0;
-    sReceiveFifo.mTail = 0;
-
-    UARTDRV_Init(sUartHandle, &uartInit);
-
-    for (uint8_t i = 0; i < sizeof(sReceiveBuffer); i++)
-    {
-        UARTDRV_Receive(sUartHandle, &sReceiveBuffer[i], sizeof(sReceiveBuffer[i]), receiveDone);
-    }
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatUartDisable(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(sTransmitBuffer == NULL, error = OT_ERROR_BUSY);
-
-    sTransmitBuffer = aBuf;
-    sTransmitLength = aBufLength;
-
-    UARTDRV_Transmit(sUartHandle, (uint8_t *)sTransmitBuffer, sTransmitLength, transmitDone);
-
-exit:
-    return error;
-}
-
-void efr32UartProcess(void)
-{
-    processReceive();
-    processTransmit();
-}
diff --git a/third_party/openthread/repo/examples/platforms/gp712/uart-socket.c b/third_party/openthread/repo/examples/platforms/gp712/uart-socket.c
deleted file mode 100644 (file)
index b516581..0000000
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- *  Copyright (c) 2016-2017, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file implements the OpenThread platform abstraction for cli over ip socket communication.
- *
- */
-
-#include "alarm_qorvo.h"
-#include "platform_qorvo.h"
-#include "uart_qorvo.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
-
-#include <netdb.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-
-#include <pthread.h>
-
-#include <openthread/config.h>
-
-#include <common/code_utils.hpp>
-#include <openthread/platform/uart.h>
-
-#include "utils/code_utils.h"
-
-#define BUFFER_MAX_SIZE 255
-#define SOCKET_PORT 9190
-#define SOCKET_WRITE(socketInfo, buf, length) \
-    sendto(socketInfo.socketId, (const char *)buf, length, 0, &socketInfo.addr, sizeof(socketInfo.addr))
-#define SOCKET_READ(socketId, buf, length) recv(socketId, buf, length, 0)
-
-typedef struct
-{
-    uint32_t        socketId;
-    bool            isValid;
-    struct sockaddr addr;
-    pthread_t       rfReadThread;
-} PlatSocket_t;
-
-PlatSocket_t PlatSocketConnection;
-int          PlatSocketPipeFd[2];
-int          PlatServerSocketId;
-
-void PlatSocketRxNewConn(uint8_t id);
-void PlatSocketInit(void);
-void PlatSocketDeInit(void);
-int  PlatSocketTxData(uint16_t length, uint8_t *pData, uint32_t socketId);
-
-#define PLAT_UART_MAX_CHAR 1024
-
-uint32_t PlatSocketId = 0;
-
-void PlatSocketSendInput(void *buffer)
-{
-    uint8_t  len = 0;
-    uint8_t *buf = (uint8_t *)buffer;
-    len          = strlen((char *)buf);
-    otPlatUartReceived((uint8_t *)buf, (uint16_t)len);
-    free(buf);
-    buf = 0;
-    len = 0;
-}
-
-void PlatSocketRx(uint16_t length, const char *buffer, uint32_t socketId)
-{
-    uint8_t *buf = 0;
-    PlatSocketId = socketId;
-
-    if (length > 0)
-    {
-        buf = malloc(length + 2);
-        memcpy(buf, buffer, length);
-        buf[length]     = '\n';
-        buf[length + 1] = 0;
-        qorvoAlarmScheduleEventArg(0, PlatSocketSendInput, (void *)buf);
-    }
-}
-
-void PlatSocketClose(uint32_t socketId)
-{
-    OT_UNUSED_VARIABLE(socketId);
-}
-
-otError otPlatUartEnable(void)
-{
-    PlatSocketInit();
-    return OT_ERROR_NONE;
-}
-
-otError otPlatUartDisable(void)
-{
-    PlatSocketDeInit();
-    return OT_ERROR_NONE;
-}
-
-otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    otError error = OT_ERROR_NONE;
-    char    localbuf[PLAT_UART_MAX_CHAR];
-
-    memcpy(localbuf, aBuf, aBufLength);
-    localbuf[aBufLength] = 0;
-    printf("%s", localbuf);
-
-    if (PlatSocketId)
-    {
-        PlatSocketTxData(aBufLength, (uint8_t *)aBuf, PlatSocketId);
-    }
-
-    otPlatUartSendDone();
-    return error;
-}
-
-otError otPlatUartFlush(void)
-{
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-void platformUartInit(void)
-{
-}
-
-void platformUartProcess(void)
-{
-}
-
-int PlatSocketListenForClients()
-{
-    // Setup server side socket
-    int                sockfd;
-    struct sockaddr_in serv_addr;
-    uint32_t           flag = 1;
-    int                ret;
-
-    sockfd = socket(AF_INET, SOCK_STREAM, 0);
-    otEXPECT_ACTION(sockfd >= 0, sockfd = -1);
-
-    // disable Nagle's algorithm to avoid long latency
-    setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag));
-    // allow reuse of the same address
-    setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(flag));
-    memset(&serv_addr, 0, sizeof(serv_addr));
-
-    serv_addr.sin_addr.s_addr = INADDR_ANY;
-    serv_addr.sin_family      = AF_INET;
-    serv_addr.sin_port        = htons(SOCKET_PORT);
-    ret                       = bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
-    otEXPECT_ACTION(ret >= 0, close(sockfd); sockfd = -1);
-    ret = listen(sockfd, 10);
-    otEXPECT_ACTION(ret != -1, exit(1));
-exit:
-    return sockfd;
-}
-
-void PlatSocketRxSignaled(uint8_t id)
-{
-    OT_UNUSED_VARIABLE(id);
-
-    // Dummy callback function to flush pipe
-    uint8_t readChar;
-    // Remove trigger byte from pipe
-    read(PlatSocketPipeFd[0], &readChar, 1);
-}
-
-void *PlatSocketReadThread(void *pClientSocket)
-{
-    char          buffer[BUFFER_MAX_SIZE];
-    PlatSocket_t *clientSocket = ((PlatSocket_t *)pClientSocket);
-
-    memset(buffer, 0, BUFFER_MAX_SIZE);
-
-    while (1)
-    {
-        int readLen = SOCKET_READ(clientSocket->socketId, buffer, BUFFER_MAX_SIZE);
-
-        if (readLen < 0)
-        {
-            perror("Reading socket");
-            break;
-        }
-        else
-        {
-            if (readLen == 0)
-            {
-                break;
-            }
-
-            {
-                uint8_t someByte = 0x12; // No functional use  only using pipe to kick main thread
-
-                PlatSocketRx(readLen, buffer, clientSocket->socketId);
-
-                write(PlatSocketPipeFd[1], &someByte, 1); //[1] = write fd
-            }
-        }
-    }
-
-    clientSocket->isValid = 0;
-    qorvoPlatUnRegisterPollFunction(clientSocket->socketId);
-    close(clientSocket->socketId);
-
-    PlatSocketClose(clientSocket->socketId);
-
-    return NULL;
-}
-
-void PlatSocketRxNewConn(uint8_t id)
-{
-    // Find first non-valid client in list - add here
-    if (PlatSocketConnection.isValid == 0)
-    {
-        // Add new client to client list
-        socklen_t len;
-        len        = sizeof(PlatSocketConnection.addr);
-        int retval = accept(id, (struct sockaddr *)&PlatSocketConnection.addr, (socklen_t *)&len);
-
-        if (retval >= 0)
-        {
-            int retErr;
-            PlatSocketConnection.socketId = retval;
-            retErr =
-                pthread_create(&PlatSocketConnection.rfReadThread, NULL, PlatSocketReadThread, &PlatSocketConnection);
-
-            if (retErr)
-            {
-                close(PlatSocketConnection.socketId);
-            }
-            else
-            {
-                PlatSocketConnection.isValid = 1;
-            }
-        }
-    }
-    else
-    {
-        int tempfd;
-        tempfd = accept(id, (struct sockaddr *)NULL, NULL);
-
-        if (tempfd >= 0)
-        {
-            close(tempfd);
-        }
-    }
-}
-
-/*****************************************************************************
- *                    Public Function Definitions
- *****************************************************************************/
-
-void PlatSocketInit(void)
-{
-    memset(&PlatSocketConnection, 0, sizeof(PlatSocketConnection));
-
-    // in case we are a server, setup listening for client
-    PlatServerSocketId = PlatSocketListenForClients();
-    qorvoPlatRegisterPollFunction(PlatServerSocketId, PlatSocketRxNewConn);
-
-    // hack
-    pipe(PlatSocketPipeFd);
-    qorvoPlatRegisterPollFunction(PlatSocketPipeFd[0], PlatSocketRxSignaled);
-}
-
-void platformUartRestore(void)
-{
-    PlatSocketDeInit();
-}
-
-void PlatSocketDeInit(void)
-{
-    qorvoPlatUnRegisterPollFunction(PlatServerSocketId);
-    close(PlatServerSocketId);
-    qorvoPlatUnRegisterPollFunction(PlatSocketPipeFd[0]);
-    close(PlatSocketPipeFd[0]);
-    close(PlatSocketPipeFd[1]);
-    close(PlatSocketConnection.socketId);
-}
-
-int PlatSocketTxData(uint16_t length, uint8_t *pData, uint32_t socketId)
-{
-    int result = -1;
-
-    // All sockets
-    if (PlatSocketConnection.isValid)
-    {
-        if (PlatSocketConnection.socketId == socketId)
-        {
-            if (SOCKET_WRITE(PlatSocketConnection, (const char *)pData, length) < 0)
-            {
-                perror("TxSocket: Error Writing to client");
-                close(PlatSocketConnection.socketId);
-                PlatSocketConnection.isValid = 0;
-            }
-            else
-            {
-                result = 0;
-            }
-        }
-    }
-
-    return result;
-}
diff --git a/third_party/openthread/repo/examples/platforms/qpg6095/qpg6095.ld b/third_party/openthread/repo/examples/platforms/qpg6095/qpg6095.ld
deleted file mode 100644 (file)
index aa61a2d..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Memory Spaces Definitions */
-MEMORY
-{
-  SYSRAM  (rxw) : ORIGIN = 0x20008000, LENGTH = 0x8000
-  UCRAM  (rxw) : ORIGIN = 0x20010000, LENGTH = 0x8000
-  FLASH (rx) : ORIGIN = 0x04000000, LENGTH = 0x80000
-}
-
-SECTIONS
-{
-    flash_end = 0x4000000 + 0x80000;
-    .vpp   0x0400001C : { LONG(_ivt >> 8);  } > FLASH
-    .mw    0x04000020 : { LONG(0x693A5C81); } > FLASH
-    rts_start_offset = 0x200;
-    rts_start_address = ORIGIN(FLASH) + rts_start_offset;
-    .rt    rts_start_address : {. = ALIGN(4); *(.rt_flash);    } > FLASH
-    .isr_vector : ALIGN(0x800) { _ivt = .; KEEP(*(.isr_vector)); } > FLASH
-
-    __exidx_start = .;
-    .text :       { . = ALIGN(4); *(.text)   *(.text.*);      } > FLASH
-    .rodata :     { . = ALIGN(4); *(.rodata) *(.rodata.*);    } > FLASH
-    __exidx_end = .;
-
-    _slower_retain = ORIGIN(SYSRAM) ; /* Start retained memory in sleep */
-
-    /* Fixed sections */
-    .mw_crc 0x20008000 : { . += 0x4; } > SYSRAM
-    .crc    0x20008004 : { . += 0x4; } > SYSRAM
-    .ret_hw 0x20008008 : { . += 0x138; } > SYSRAM
-    .ret_sw 0x20008140 : { . += 0x80; }  > SYSRAM
-
-    /* Windowed sections */
-    .ram_regmap :  { . += 0x140; } > SYSRAM
-    .events :      { . += 0x10 ; } > SYSRAM
-    .pbm_options : { . += 0x400 ; } > SYSRAM
-
-    .lower_ram_retain_gpmicro_accessible (NOLOAD) :  { . = ALIGN(4); *(.lower_ram_retain_gpmicro_accessible)   *(.lower_ram_retain_gpmicro_accessible.*); } > SYSRAM
-    .lower_ram_retain (NOLOAD) :  { . = ALIGN(4); *(.lower_ram_retain)   *(.lower_ram_retain.*); } > SYSRAM
-
-    .bss :        { . = ALIGN(4); *(.bss) *(COMMON);} > SYSRAM
-
-    _elower_retain = . ; /* End memory to be retained */
-    .lower_ram_noretain (NOLOAD) :  { . = ALIGN(4); *(.lower_ram_noretain)   *(.lower_ram_noretain.*); } > SYSRAM
-    _elower_ram = . ;
-
-    . = ORIGIN(UCRAM);
-
-    PROVIDE(_shigher_retain = .);
-    .higher_ram_retain (NOLOAD) :  { . = ALIGN(4); *(.higher_ram_retain)   *(.higher_ram_retain.*); } > UCRAM
-    PROVIDE(_ehigher_retain = .);
-    .higher_ram_noretain (NOLOAD) :  { . = ALIGN(4); *(.higher_ram_noretain)   *(.higher_ram_noretain.*); } > UCRAM
-    .data :       { . = ALIGN(4); *(.data)   *(.data.*);      } > UCRAM AT > FLASH
-    .bss_uc :     { . = ALIGN(4); *(.bss.*) ;} > UCRAM
-    _ehigher_ram = . ;
-
-    /* remove the debugging information from the standard libraries */
-    /DISCARD/ : {
-        libc.a ( * )
-        libm.a ( * )
-        libgcc.a ( * )
-    }
-
-    .gpNvm flash_end - 0x4000:
-    {
-        gpNvm_Start = . ;
-        . = 0x4000 ;
-        gpNvm_End = . ;
-    } > FLASH
-
-    _etext  = ADDR(.text) + SIZEOF(.text);
-    _sidata = LOADADDR(.data);
-    _sdata  = ADDR(.data);
-    _edata  = ADDR(.data) + ALIGN(SIZEOF(.data), 4);
-    _ldata  = _edata - _sdata;
-    _sbss   = ADDR(.bss);
-    _ebss   = ADDR(.bss)  + ALIGN(SIZEOF(.bss),  4);
-    _lbss   = _ebss - _sbss;
-    /* use UCRAM for stack */
-    _sstack = _ehigher_ram;
-    _estack = ORIGIN(UCRAM) + LENGTH(UCRAM);
-    _sbss_uc = ADDR(.bss_uc);
-    _ebss_uc = ADDR(.bss_uc)  + ALIGN(SIZEOF(.bss_uc),  4);
-    _lbss_uc = _ebss_uc - _sbss_uc;
-
-    __configured_stack_size = 0x1200;
-    __stack_size     = _estack - _sstack;
-    ASSERT(__stack_size >= __configured_stack_size, "STACK too small")
-
-    _elower_ram = ADDR(.lower_ram_retain) + ALIGN(SIZEOF(.lower_ram_retain),  4);
-    __lowerram_retain_size     = _elower_retain - _slower_retain;
-
-    __higherram_retain_size     = SIZEOF(.higher_ram_retain);
-
-    sw_retention_begin = ADDR(.ret_sw);
-    sw_retention_end = ADDR(.ret_sw) + SIZEOF(.ret_sw);
-    ram_regmap_begin   = ADDR(.ram_regmap);
-    events_begin       = ADDR(.events);
-    pbm_options_begin  = ADDR(.pbm_options);
-
-    total_nr_of_events_as_an_address = SIZEOF(.events) / 16;
-}
-
-ENTRY(reset_handler)
-
diff --git a/third_party/openthread/repo/include/openthread/platform/ble.h b/third_party/openthread/repo/include/openthread/platform/ble.h
deleted file mode 100644 (file)
index 0a66bea..0000000
+++ /dev/null
@@ -1,1250 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief
- *   This file defines a generic OpenThread BLE driver HOST interface.
- *
- */
-
-#ifndef OT_PLATFORM_BLE_H_
-#define OT_PLATFORM_BLE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#include <openthread/error.h>
-#include <openthread/instance.h>
-
-/**
- * @addtogroup plat-ble
- *
- * @brief
- *   This module includes the platform abstraction for BLE Host communication.
- *   The platform needs to implement Bluetooth LE 4.2 or higher.
- *
- * @{
- *
- */
-
-enum
-{
-    /**
-     * The size of the Bluetooth Device Address [bytes].
-     */
-    OT_BLE_ADDRESS_LENGTH = 6,
-
-    /**
-     * Time slot duration on PHY layer in microseconds (0.625ms).
-     */
-    OT_BLE_TIMESLOT_UNIT = 625,
-
-    /**
-     * Unit used to calculate connection interval (1.25ms)
-     */
-    OT_BLE_CONN_INTERVAL_UNIT = 2 * OT_BLE_TIMESLOT_UNIT,
-
-    /**
-     * Minimum allowed connection interval in OT_BLE_CONN_INTERVAL_UNIT units (7.5ms).
-     * See v4.2 [Vol 2, Part E] page 946
-     */
-    OT_BLE_CONN_INTERVAL_MIN = 0x0006,
-
-    /**
-     * Maximum allowed connection interval in OT_BLE_CONN_INTERVAL_UNIT units (4s).
-     * See v4.2 [Vol 2, Part E] page 946
-     */
-    OT_BLE_CONN_INTERVAL_MAX = 0x0C80,
-
-    /**
-     * Maximum allowed slave latency in units of connection events.
-     * See v4.2 [Vol 2, Part E] page 946
-     */
-    OT_BLE_CONN_SLAVE_LATENCY_MAX = 0x01F3,
-
-    /**
-     * Minimum allowed connection timeout in units of 10ms (100ms).
-     * See v4.2 [Vol 2, Part E] page 946
-     */
-    OT_BLE_CONN_SUPERVISOR_TIMEOUT_MIN = 0x000A,
-
-    /**
-     * Maximum allowed connection timeout (32s).
-     * See v4.2 [Vol 2, Part E] page 946
-     */
-    OT_BLE_CONN_SUPERVISOR_TIMEOUT_MAX = 0x0C80,
-
-    /**
-     * Unit used to calculate connection supervisor timeout (10ms).
-     */
-    OT_BLE_CONN_SUPERVISOR_UNIT = 16 * OT_BLE_TIMESLOT_UNIT,
-
-    /**
-     * Maximum length of the device name characteristic [bytes].
-     */
-    OT_BLE_DEV_NAME_MAX_LENGTH = 248,
-
-    /**
-     * Maximum length of advertising data [bytes].
-     */
-    OT_BLE_ADV_DATA_MAX_LENGTH = 31,
-
-    /**
-     * Maximum length of scan response data [bytes].
-     */
-    OT_BLE_SCAN_RESPONSE_MAX_LENGTH = 31,
-
-    /**
-     * Minimum allowed interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (20ms).
-     */
-    OT_BLE_ADV_INTERVAL_MIN = 0x0020,
-
-    /**
-     * Maximum allowed interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (10.24s).
-     */
-    OT_BLE_ADV_INTERVAL_MAX = 0x4000,
-
-    /**
-     * Unit used to calculate interval duration (0.625ms).
-     */
-    OT_BLE_ADV_INTERVAL_UNIT = OT_BLE_TIMESLOT_UNIT,
-
-    /**
-     * Minimum allowed scan interval (2.5ms).
-     */
-    OT_BLE_SCAN_INTERVAL_MIN = 0x0004,
-
-    /**
-     * Maximum allowed scan interval (10.24s).
-     */
-    OT_BLE_SCAN_INTERVAL_MAX = 0x4000,
-
-    /**
-     * Unit used to calculate scan interval duration (0.625ms).
-     */
-    OT_BLE_SCAN_INTERVAL_UNIT = OT_BLE_TIMESLOT_UNIT,
-
-    /**
-     * Minimum allowed scan window in OT_BLE_TIMESLOT_UNIT units (2.5ms).
-     */
-    OT_BLE_SCAN_WINDOW_MIN = 0x0004,
-
-    /**
-     * Maximum allowed scan window in OT_BLE_TIMESLOT_UNIT units (10.24s).
-     */
-    OT_BLE_SCAN_WINDOW_MAX = 0x4000,
-
-    /**
-     * Unit used to calculate scan window duration (0.625ms).
-     */
-    OT_BLE_SCAN_WINDOW_UNIT = OT_BLE_TIMESLOT_UNIT,
-
-    /**
-     * BLE HCI code for remote user terminated connection.
-     */
-    OT_BLE_HCI_REMOTE_USER_TERMINATED = 0x13,
-
-    /**
-     * Value of invalid/unknown handle.
-     */
-    OT_BLE_INVALID_HANDLE = 0x0000,
-
-    /**
-     * Maximum size of BLE Characteristic [bytes].
-     */
-    OT_BLE_CHARACTERISTIC_MAX_LENGTH = 512,
-
-    /**
-     * Maximum value of ATT_MTU [bytes].
-     */
-    OT_BLE_ATT_MTU_MAX = 511,
-
-    /**
-     * Length of full BLE UUID in bytes.
-     */
-    OT_BLE_UUID_LENGTH = 16,
-
-    /**
-     * Uuid of Client Configuration Characteristic Descriptor.
-     */
-    OT_BLE_UUID_CCCD = 0x2902,
-
-};
-
-/// Convert the advertising interval from [ms] to [ble symbol times].
-#define OT_BLE_MS_TO_TICKS(x) (((x)*1000) / OT_BLE_ADV_INTERVAL_UNIT)
-
-/**
- * This enum represents BLE Device Address types.
- *
- */
-typedef enum otPlatBleAddressType
-{
-    OT_BLE_ADDRESS_TYPE_PUBLIC                        = 0, ///< Bluetooth public device address.
-    OT_BLE_ADDRESS_TYPE_RANDOM_STATIC                 = 1, ///< Bluetooth random static address.
-    OT_BLE_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE     = 2, ///< Bluetooth random private resolvable address.
-    OT_BLE_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE = 3, ///< Bluetooth random private non-resolvable address.
-} otPlatBleAddressType;
-
-/**
- * This enumeration defines the characterstic properties flags for a
- * Client Characteristic Configuration Descriptor (CCCD).
- *
- * See v4.2 [Vol 3, Part G] 3.3.1.1 Characteristic Properties - Table 3.5
- */
-typedef enum otPlatBleCccdFlags
-{
-    /**
-     * If set, permits broadcasts of the Characteristic Value using Characteristic Configuration Descriptor.
-     */
-    OT_BLE_CHAR_PROP_BROADCAST = (1 << 0),
-
-    /**
-     * If set, permits reads of the Characteristic Value.
-     */
-    OT_BLE_CHAR_PROP_READ = (1 << 1),
-
-    /**
-     * If set, permit writes of the Characteristic Value without response.
-     */
-    OT_BLE_CHAR_PROP_WRITE_NO_RESPONSE = (1 << 2),
-
-    /**
-     * If set, permits writes of the Characteristic Value with response.
-     */
-    OT_BLE_CHAR_PROP_WRITE = (1 << 3),
-
-    /**
-     * If set, permits notifications of a Characteristic Value without acknowledgement.
-     */
-    OT_BLE_CHAR_PROP_NOTIFY = (1 << 4),
-
-    /**
-     * If set, permits indications of a Characteristic Value with acknowledgement.
-     */
-    OT_BLE_CHAR_PROP_INDICATE = (1 << 5),
-
-    /**
-     * If set, permits signed writes to the Characteristic Value.
-     */
-    OT_BLE_CHAR_PROP_AUTH_SIGNED_WRITE = (1 << 6),
-
-    /**
-     * If set, additional characteristic properties are defined in the Characteristic Extended Properties Descriptor.
-     */
-    OT_BLE_CHAR_PROP_EXTENDED = (1 << 7),
-
-} otPlatBleCccdFlags;
-
-/**
- * This structure represents BLE Device Address.
- *
- */
-typedef struct otPlatBleDeviceAddr
-{
-    uint8_t mAddrType;                    ///< Bluetooth device address type.
-    uint8_t mAddr[OT_BLE_ADDRESS_LENGTH]; ///< An 48-bit address of Bluetooth device in LSB format.
-} otPlatBleDeviceAddr;
-
-/**
- * This enumeration defines flags for BLE advertisement mode.
- *
- */
-typedef enum otPlatBleAdvMode
-{
-    /**
-     * If set, advertising device will allow connections to be initiated.
-     */
-    OT_BLE_ADV_MODE_CONNECTABLE = (1 << 0),
-
-    /**
-     * If set, advertising device will respond to scan requests.
-     */
-    OT_BLE_ADV_MODE_SCANNABLE = (1 << 1),
-} otPlatBleAdvMode;
-
-/**
- * This structure represents BLE connection parameters.
- *
- */
-typedef struct otPlatBleGapConnParams
-{
-    /**
-     * Preferred minimum connection interval in OT_BLE_TIMESLOT_UNIT units.
-     * Shall be in OT_BLE_CONN_INTERVAL_MIN and OT_BLE_CONN_INTERVAL_MAX range.
-     */
-    uint16_t mConnMinInterval;
-
-    /**
-     * Preferred maximum connection interval in OT_BLE_TIMESLOT_UNIT units.
-     * Shall be in OT_BLE_CONN_INTERVAL_MIN and OT_BLE_CONN_INTERVAL_MAX range.
-     */
-    uint16_t mConnMaxInterval;
-
-    /**
-     * Slave Latency in number of connection events.
-     * Shall not exceed OT_BLE_CONN_SLAVE_LATENCY_MAX value.
-     */
-    uint16_t mConnSlaveLatency;
-
-    /**
-     * Defines connection timeout parameter in OT_BLE_CONN_SUPERVISOR_UNIT units. Shall be in
-     * OT_BLE_CONN_SUPERVISOR_TIMEOUT_MIN and OT_BLE_CONN_SUPERVISOR_TIMEOUT_MIN range.
-     */
-    uint16_t mConnSupervisionTimeout;
-
-} otPlatBleGapConnParams;
-
-/**
- * This enumeration represents BLE UUID value.
- *
- */
-typedef enum otPlatBleUuidType
-{
-    OT_BLE_UUID_TYPE_NONE = 0, ///< UUID uninitialized value.
-    OT_BLE_UUID_TYPE_16   = 1, ///< UUID represented by 16-bit value.
-    OT_BLE_UUID_TYPE_32   = 2, ///< UUID represented by 32-bit value.
-    OT_BLE_UUID_TYPE_128  = 3, ///< UUID represented by 128-bit value.
-} otPlatBleUuidType;
-
-/**
- * This structure represents BLE UUID value.
- *
- */
-typedef union otPlatBleUuidValue
-{
-    uint8_t *mUuid128; ///< A pointer to 128-bit UUID value.
-    uint32_t mUuid32;  ///< A 32-bit UUID value.
-    uint16_t mUuid16;  ///< A 16-bit UUID value.
-} otPlatBleUuidValue;
-
-/**
- * This structure represents BLE UUID.
- *
- */
-typedef struct otPlatBleUuid
-{
-    otPlatBleUuidType  mType;  ///< A type of UUID in @p mValue.
-    otPlatBleUuidValue mValue; ///< A value of UUID.
-} otPlatBleUuid;
-
-/**
- * This structure represents GATT Characteristic.
- *
- */
-typedef struct otPlatBleGattCharacteristic
-{
-    otPlatBleUuid mUuid;        ///< [in]  A UUID value of a characteristic.
-    uint16_t      mHandleValue; ///< [out] Characteristic value handle.
-    uint16_t      mHandleCccd;  ///< [out] CCCD handle or OT_BLE_INVALID_HANDLE if CCCD is not present.
-    uint8_t       mProperties;  ///< [in]  Characteristic properties.
-} otPlatBleGattCharacteristic;
-
-/**
- * This structure represents GATT Descriptor.
- *
- */
-typedef struct otPlatBleGattDescriptor
-{
-    otPlatBleUuid mUuid;   ///< A UUID value of descriptor.
-    uint16_t      mHandle; ///< Descriptor handle.
-} otPlatBleGattDescriptor;
-
-/**
- * Registration descriptor for a GATT service.
- *
- */
-typedef struct otPlatBleGattService
-{
-    /**
-     * Pointer to service UUID; use BLE_UUIDxx_DECLARE macros to declare
-     * proper UUID; NULL if there are no more characteristics in the service.
-     */
-    const otPlatBleUuid mUuid;
-
-    /**
-     * Handle of service; written to by stack after call to
-     * otPlatBleGattServerServicesRegister.
-     */
-    uint16_t mHandle;
-
-    /**
-     * Array of characteristic definitions corresponding to characteristics
-     * belonging to this service.
-     */
-    otPlatBleGattCharacteristic *mCharacteristics;
-} otPlatBleGattService;
-
-/**
- * This structure represents an BLE packet.
- *
- */
-typedef struct otBleRadioPacket
-{
-    uint8_t *mValue;  ///< The value of an attribute
-    uint16_t mLength; ///< Length of the @p mValue.
-    int8_t   mPower;  ///< Transmit/receive power in dBm.
-} otBleRadioPacket;
-
-/**
- * The enum indicates the outcome of the L2CAP connection request procedure.
- * See Bluetooth v5.0 | Vol 3, Part A, 4.23, Table 4.20.
- */
-typedef enum otPlatBleL2capError
-{
-    OT_BLE_L2C_ERROR_NONE           = 0x00, ///< Connection successful.
-    OT_BLE_L2C_ERROR_INVALID_PSM    = 0x02, ///< Connection refused – LE_PSM not supported.
-    OT_BLE_L2C_ERROR_NO_MEM         = 0x04, ///< Connection refused – no resources available.
-    OT_BLE_L2C_ERROR_INVALID_PARAMS = 0x0b, ///< Connection refused – unacceptable parameters.
-} otPlatBleL2capError;
-
-/*******************************************************************************
- * @section Bluetooth Low Energy management.
- ******************************************************************************/
-
-/**
- * Enable the Bluetooth Low Energy radio.
- *
- * @note BLE Device should use the highest ATT_MTU supported that does not
- * exceed OT_BLE_ATT_MTU_MAX octets.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::OT_ERROR_NONE         Successfully enabled.
- * @retval ::OT_ERROR_FAILED       The BLE radio could not be enabled.
- */
-otError otPlatBleEnable(otInstance *aInstance);
-
-/**
- * Disable the Bluetooth Low Energy radio.
- *
- * When disabled, the BLE stack will flush event queues and not generate new
- * events. The BLE peripheral is turned off or put into a low power sleep
- * state. Any dynamic memory used by the stack should be released,
- * but static memory may remain reserved.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::OT_ERROR_NONE        Successfully transitioned to disabled.
- * @retval ::OT_ERROR_FAILED      The BLE radio could not be disabled.
- */
-otError otPlatBleDisable(otInstance *aInstance);
-
-/**
- * Reset the Bluetooth Low Energy subsystem.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::OT_ERROR_NONE        Successfully reset.
- * @retval ::OT_ERROR_FAILED      The BLE stack could not be reset.
- */
-otError otPlatBleReset(otInstance *aInstance);
-
-/**
- * Check whether Bluetooth Low Energy radio is enabled or not.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::true   Bluetooth Low Energy radio is enabled.
- * @retval ::false  Bluetooth Low Energy radio is disabled.
- */
-bool otPlatBleIsEnabled(otInstance *aInstance);
-
-/**
- * Callback sent when Bluetooth Low Energy is ready after being enabled.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- */
-extern void otPlatBleOnEnabled(otInstance *aInstance);
-
-/****************************************************************************
- * @section Bluetooth Low Energy GAP.
- ***************************************************************************/
-
-/**
- * Gets Bluetooth Device Address.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[out] aAddress   The pointer to Bluetooth Device Address.
- *
- * @retval ::OT_ERROR_NONE          Request has been successfully done.
- * @retval ::OT_ERROR_INVALID_ARGS  Invalid parameters has been supplied.
- */
-otError otPlatBleGapAddressGet(otInstance *aInstance, otPlatBleDeviceAddr *aAddress);
-
-/**
- * Sets Bluetooth Device Address.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in] aAddress    The pointer to Bluetooth Device Address.
- *
- * @retval ::OT_ERROR_NONE          Request has been successfully done.
- * @retval ::OT_ERROR_INVALID_ARGS  Invalid parameters has been supplied.
- */
-otError otPlatBleGapAddressSet(otInstance *aInstance, const otPlatBleDeviceAddr *aAddress);
-
-/**
- * Sets BLE device name and appearance that is visible as GATT Based service.
- *
- * The BLE Host stack should set the security mode 1, level 1 (no security) for
- * those characteristics.
- *
- * @param[in] aInstance    The OpenThread instance structure.
- * @param[in] aDeviceName  A pointer to device name string (null terminated).
- *                         Shall not exceed OT_BLE_DEV_NAME_MAX_LENGTH.
- * @param[in] aAppearance  The value of appearance characteristic.
- *
- * @retval ::OT_ERROR_NONE          Connection parameters have been
- *                                  successfully set.
- * @retval ::OT_ERROR_INVALID_ARGS  Invalid parameters has been supplied.
- */
-otError otPlatBleGapServiceSet(otInstance *aInstance, const char *aDeviceName, uint16_t aAppearance);
-
-/**
- * Sets desired BLE Connection Parameters.
- *
- * @param[in] aInstance    The OpenThread instance structure.
- * @param[in] aConnParams  A pointer to connection parameters structure.
- *
- * @retval ::OT_ERROR_NONE          Connection parameters have been
- *                                  successfully set.
- * @retval ::OT_ERROR_INVALID_ARGS  Invalid connection parameters have been
- *                                  supplied.
- */
-otError otPlatBleGapConnParamsSet(otInstance *aInstance, const otPlatBleGapConnParams *aConnParams);
-
-/**
- * Sets BLE Advertising packet content.
- *
- * @note This function shall be used only for BLE Peripheral role.
- *
- * @param[in] aInstance       The OpenThread instance structure.
- * @param[in] aAdvData        A pointer to advertising data content in raw format.
- * @param[in] aAdvDataLength  The size of advertising data.
- *                            Shall not exceed OT_BLE_ADV_DATA_MAX_LENGTH.
- *
- * @retval ::OT_ERROR_NONE          Advertising data has been successfully set.
- * @retval ::OT_ERROR_INVALID_ARGS  Invalid advertising data has been supplied.
- */
-otError otPlatBleGapAdvDataSet(otInstance *aInstance, const uint8_t *aAdvData, uint8_t aAdvDataLength);
-
-/**
- * Sets BLE Scan Response packet content.
- *
- * @note This function shall be used only for BLE Peripheral role.
- *
- * @param[in] aInstance            The OpenThread instance structure.
- * @param[in] aScanResponse        A pointer to scan response data in raw format.
- * @param[in] aScanResponseLength  The size of scan response data.
- *                                 Shall not exceed OT_BLE_SCAN_RESPONSE_MAX_LENGTH.
- *
- * @retval ::OT_ERROR_NONE         Scan response data has been successfully set.
- * @retval ::OT_ERROR_INVALID_ARGS Invalid scan response data has been supplied.
- */
-otError otPlatBleGapScanResponseSet(otInstance *aInstance, const uint8_t *aScanResponse, uint8_t aScanResponseLength);
-
-/**
- * Starts BLE Advertising procedure.
- *
- * The BLE device shall use undirected advertising with no filter applied.
- * A single BLE Advertising packet must be sent on all advertising
- * channels (37, 38 and 39).
- *
- * @note This function shall be used only for BLE Peripheral role.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aInterval  The interval between subsequent advertising packets
- *                       in OT_BLE_ADV_INTERVAL_UNIT units.
- *                       Shall be within OT_BLE_ADV_INTERVAL_MIN and
- *                       OT_BLE_ADV_INTERVAL_MAX range.
- * @param[in] aType      The advertisement properties as a bitmask:
- *                       whether it is connectable | scannable.
- *
- * @retval ::OT_ERROR_NONE           Advertising procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid interval value has been supplied.
- */
-otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval, uint8_t aType);
-
-/**
- * Stops BLE Advertising procedure.
- *
- * @note This function shall be used only for BLE Peripheral role.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::OT_ERROR_NONE           Advertising procedure has been stopped.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- */
-otError otPlatBleGapAdvStop(otInstance *aInstance);
-
-/**
- * The BLE driver calls this method to notify OpenThread that BLE Device has
- * been connected.
- *
- * @param[in]  aInstance     The OpenThread instance structure.
- * @param[in]  aConnectionId The identifier of the open connection.
- *
- */
-extern void otPlatBleGapOnConnected(otInstance *aInstance, uint16_t aConnectionId);
-
-/**
- * The BLE driver calls this method to notify OpenThread that the BLE Device
- * has been disconnected.
- *
- * @param[in]  aInstance     The OpenThread instance structure.
- * @param[in]  aConnectionId The identifier of the closed connection.
- *
- */
-extern void otPlatBleGapOnDisconnected(otInstance *aInstance, uint16_t aConnectionId);
-
-/**
- * Starts BLE Scanning procedure.
- *
- * @note This function shall be used only for BLE Central role.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aInterval  The scanning interval in OT_BLE_SCAN_INTERVAL_UNIT
- *                       units. Shall be in OT_BLE_SCAN_INTERVAL_MIN and
- *                       OT_BLE_SCAN_INTERVAL_MAX range.
- * @param[in] aWindow    The scanning window in OT_BLE_SCAN_WINDOW_UNIT units.
- *                       Shall be in OT_BLE_SCAN_WINDOW_MIN and OT_BLE_SCAN_WINDOW_MAX
- *                       range.
- *
- * @retval ::OT_ERROR_NONE           Scanning procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid interval or window value has been
- *                                   supplied.
- */
-otError otPlatBleGapScanStart(otInstance *aInstance, uint16_t aInterval, uint16_t aWindow);
-
-/**
- * Stops BLE Scanning procedure.
- *
- * @note This function shall be used only for BLE Central role.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::OT_ERROR_NONE           Scanning procedure has been stopped.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- */
-otError otPlatBleGapScanStop(otInstance *aInstance);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an advertisement
- * packet has been received.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aAddress   An address of the advertising device.
- * @param[in]  aPacket    A pointer to the received packet.
- *
- */
-extern void otPlatBleGapOnAdvReceived(otInstance *aInstance, otPlatBleDeviceAddr *aAddress, otBleRadioPacket *aPacket);
-
-/**
- * The BLE driver calls this method to notify OpenThread that a scan response packet has been received.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aAddress   An address of the advertising device.
- * @param[in]  aPacket    A pointer to the received packet.
- *
- */
-extern void otPlatBleGapOnScanRespReceived(otInstance *         aInstance,
-                                           otPlatBleDeviceAddr *aAddress,
-                                           otBleRadioPacket *   aPacket);
-
-/**
- * Starts BLE Connection procedure.
- *
- * @note This function shall be used only for BLE Central role.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aAddress   An address of the advertising device.
- * @param[in] aInterval  The scanning interval in OT_BLE_SCAN_INTERVAL_UNIT units. Shall be in
- *                       OT_BLE_SCAN_INTERVAL_MIN and OT_BLE_SCAN_INTERVAL_MAX range.
- * @param[in] aWindow    The scanning window in OT_BLE_SCAN_WINDOW_UNIT units. Shall be in
- *                       OT_BLE_SCAN_WINDOW_MIN and OT_BLE_SCAN_WINDOW_MAX range.
- *
- * @retval ::OT_ERROR_NONE           Connection procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid address, interval or window value has been supplied.
- */
-otError otPlatBleGapConnect(otInstance *aInstance, otPlatBleDeviceAddr *aAddress, uint16_t aInterval, uint16_t aWindow);
-
-/**
- * Disconnects BLE connection.
- *
- * The BLE device shall indicate the OT_BLE_HCI_REMOTE_USER_TERMINATED HCI code reason.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::OT_ERROR_NONE           Disconnection procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- */
-otError otPlatBleGapDisconnect(otInstance *aInstance);
-
-/*******************************************************************************
- * @section Bluetooth Low Energy GATT Common.
- *******************************************************************************/
-
-/**
- * Registers vendor specific UUID Base.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aUuid      A pointer to vendor specific 128-bit UUID Base.
- *
- */
-otError otPlatBleGattVendorUuidRegister(otInstance *aInstance, const otPlatBleUuid *aUuid);
-
-/**
- * Reads currently use value of ATT_MTU.
- *
- * @param[in]   aInstance  The OpenThread instance structure.
- * @param[out]  aMtu       A pointer contains current ATT_MTU value.
- *
- * @retval ::OT_ERROR_NONE     ATT_MTU value has been placed in @p aMtu.
- * @retval ::OT_ERROR_FAILED   BLE Device cannot determine its ATT_MTU.
- */
-otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu);
-
-/*******************************************************************************
- * @section Bluetooth Low Energy GATT Client.
- ******************************************************************************/
-
-/**
- * Sends ATT Read Request.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aHandle    The handle of the attribute to be read.
- *
- * @retval ::OT_ERROR_NONE           ATT Write Request has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid handle value has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientRead(otInstance *aInstance, uint16_t aHandle);
-
-/**
- * The BLE driver calls this method to notify OpenThread that ATT Read Response
- * packet has been received.
- *
- * This method is called only if @p otPlatBleGattClientRead was previously requested.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aPacket    A pointer to the packet contains read value.
- *
- */
-extern void otPlatBleGattClientOnReadResponse(otInstance *aInstance, otBleRadioPacket *aPacket);
-
-/**
- * Sends ATT Write Request.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aHandle    The handle of the attribute to be written.
- * @param[in] aPacket    A pointer to the packet contains value to be
- *                       written to the attribute.
- *
- * @retval ::OT_ERROR_NONE           ATT Write Request has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid handle value, data or data length has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientWrite(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket);
-
-/**
- * The BLE driver calls this method to notify OpenThread that ATT Write Response
- * packet has been received.
- *
- * This method is called only if @p otPlatBleGattClientWrite was previously requested.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aHandle    The handle on which ATT Write Response has been sent.
- *
- */
-
-extern void otPlatBleGattClientOnWriteResponse(otInstance *aInstance, uint16_t aHandle);
-/**
- * Subscribes for characteristic indications.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance    The OpenThread instance structure.
- * @param[in] aHandle      The handle of the attribute to be written.
- * @param[in] aSubscribing True if subscribing, otherwise unsubscribing.
- *
- * @retval ::OT_ERROR_NONE           Subscription has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid handle value, data or data length has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientSubscribeRequest(otInstance *aInstance, uint16_t aHandle, bool aSubscribing);
-
-/**
- * The BLE driver calls this method to notify OpenThread that subscribe response
- * has been received.
- *
- * This method is called only if @p otPlatBleGattClienSubscribe was previously requested.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aHandle    The handle on which ATT Write Response has been sent.
- *
- */
-extern void otPlatBleGattClientOnSubscribeResponse(otInstance *aInstance, uint16_t aHandle);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an ATT Handle Value
- * Indication has been received.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aHandle    The handle on which ATT Handle Value Indication has been sent.
- * @param[in] aPacket    A pointer to the packet contains indicated value.
- *
- */
-extern void otPlatBleGattClientOnIndication(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket);
-
-/**
- * Performs GATT Primary Service Discovery of all services available.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- * @retval ::OT_ERROR_NONE           Service Discovery procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid service UUID has been provided.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientServicesDiscover(otInstance *aInstance);
-
-/**
- * Performs GATT Primary Service Discovery by UUID procedure of specific service.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aUuid      The UUID of a service to be registered.
- *
- * @retval ::OT_ERROR_NONE           Service Discovery procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid service UUID has been provided.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientServiceDiscover(otInstance *aInstance, const otPlatBleUuid *aUuid);
-
-/**
- * The BLE driver calls this method to notify OpenThread that the next entry
- * from GATT Primary Service Discovery has been found.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance     The OpenThread instance structure.
- * @param[in] aStartHandle  The start handle of a service.
- * @param[in] aEndHandle    The end handle of a service.
- * @param[in] aServiceUuid  The Uuid16 for the service entry.
- * @param[in] aError        The value of OT_ERROR_NONE indicates that service has been found
- *                          and structure @p aStartHandle and @p aEndHandle contain valid handles.
- *                          OT_ERROR_NOT_FOUND error should be set if service has not been found.
- *                          Otherwise error indicates the reason of failure is used.
- *
- */
-extern void otPlatBleGattClientOnServiceDiscovered(otInstance *aInstance,
-                                                   uint16_t    aStartHandle,
-                                                   uint16_t    aEndHandle,
-                                                   uint16_t    aServiceUuid,
-                                                   otError     aError);
-
-/**
- * Performs GATT Characteristic Discovery of a service.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance     The OpenThread instance structure.
- * @param[in] aStartHandle  The start handle of a service.
- * @param[in] aEndHandle    The end handle of a service.
- *
- * @retval ::OT_ERROR_NONE           Characteristic Discovery procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid start or end handle has been provided.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientCharacteristicsDiscover(otInstance *aInstance, uint16_t aStartHandle, uint16_t aEndHandle);
-
-/**
- * The BLE driver calls this method to notify OpenThread that GATT Characteristic
- * Discovery of a service has been done.
- *
- * In case of success, all elements inside @p aChars should have a valid mHandleValue value.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aChars     A pointer to discovered characteristic list.
- * @param[in] aCount     Number of characteristics in @p aChar list.
- * @param[in] aError     The value of OT_ERROR_NONE indicates that at least one characteristic
- *                       has been found and the total number of them is stored in @p aCount.
- *                       OT_ERROR_NOT_FOUND error should be set if no charactertistics are found.
- *                       Otherwise error indicates the reason of failure is used.
- *
- */
-extern void otPlatBleGattClientOnCharacteristicsDiscoverDone(otInstance *                 aInstance,
-                                                             otPlatBleGattCharacteristic *aChars,
-                                                             uint16_t                     aCount,
-                                                             otError                      aError);
-
-/**
- * Performs GATT Descriptor Discovery.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance     The OpenThread instance structure.
- * @param[in] aStartHandle  The start handle.
- * @param[in] aEndHandle    The end handle.
- *
- * @retval ::OT_ERROR_NONE           Descriptor Discovery procedure has been started.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid start or end handle has been provided.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientDescriptorsDiscover(otInstance *aInstance, uint16_t aStartHandle, uint16_t aEndHandle);
-
-/**
- * The BLE driver calls this method to notify OpenThread that GATT Descriptor
- * Discovery has been done.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aDescs     A pointer to discovered descriptor list.
- * @param[in] aCount     Number of descriptors in @p aDescs list.
- * @param[in] aError     The value of OT_ERROR_NONE indicates that at least one descriptor
- *                       has been found and the total number of them is stored in @p aCount.
- *                       OT_ERROR_NOT_FOUND error should be set if no descriptors are found.
- *                       Otherwise error indicates the reason of failure is used.
- *
- */
-extern void otPlatBleGattClientOnDescriptorsDiscoverDone(otInstance *             aInstance,
-                                                         otPlatBleGattDescriptor *aDescs,
-                                                         uint16_t                 aCount,
-                                                         otError                  aError);
-
-/**
- * Sends Exchange MTU Request.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aMtu       A value of GATT Client receive MTU size.
- *
- * @retval ::OT_ERROR_NONE           Exchange MTU Request has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid aMtu has been provided.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattClientMtuExchangeRequest(otInstance *aInstance, uint16_t aMtu);
-
-/**
- * The BLE driver calls this method to notify OpenThread that Exchange MTU
- * Response has been received.
- *
- * @note This function shall be used only for GATT Client.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aMtu       Attribute server receive MTU size.
- * @param[in] aError     The value of OT_ERROR_NONE indicates that valid
- *                       Exchange MTU Response has been received. Otherwise error
- *                       indicates the reason of failure is used.
- *
- */
-extern void otPlatBleGattClientOnMtuExchangeResponse(otInstance *aInstance, uint16_t aMtu, otError aError);
-
-/*******************************************************************************
- * @section Bluetooth Low Energy GATT Server.
- ******************************************************************************/
-
-/**
- * Registers a list of GATT Services and their enclosed Characteristics.
- * The generated handles will be written back into this structure when the
- * BLE stack is enabled.
- *
- * @note This function shall be used only for GATT Server.
- *
- * @param[in]   aInstance  The OpenThread instance structure.
- * @param[in]   aServices  Null terminated array of service structures to register.
- *
- * @retval ::OT_ERROR_NONE           Service has been successfully registered.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid service UUID has been provided.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattServerServicesRegister(otInstance *aInstance, otPlatBleGattService *aServices);
-
-/**
- * Sends ATT Handle Value Indication.
- *
- * @note This function shall be used only for GATT Server.
- *
- * @param[in] aInstance   The OpenThread instance structure.
- * @param[in] aHandle     The handle of the attribute to be indicated.
- * @param[in] aPacket     A pointer to the packet contains value to be indicated.
- *
- * @retval ::OT_ERROR_NONE           ATT Handle Value Indication has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid handle value, data or data length has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- */
-otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an ATT Handle
- * Value Confirmation has been received.
- *
- * This method is called only if @p otPlatBleGattServerIndicate was previously requested.
- *
- * @note This function shall be used only for GATT Server.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aHandle    The handle on which ATT Handle Value Confirmation has been sent.
- *
- */
-extern void otPlatBleGattServerOnIndicationConfirmation(otInstance *aInstance, uint16_t aHandle);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an ATT Write Request
- * packet has been received.
- *
- * @note This function shall be used only for GATT Server.
- *
- * @param[in] aInstance   The OpenThread instance structure.
- * @param[in] aHandle     The handle of the attribute to be written.
- * @param[in] aPacket     A pointer to the packet contains value to be written to the attribute.
- *
- */
-extern void otPlatBleGattServerOnWriteRequest(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an ATT Read Request
- * packet has been received.
- *
- * @note This function shall be used only for GATT Server.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aHandle    The handle of the attribute to be read.
- * @param[out] aPacket    A pointer to the packet to be filled with pointers to attribute data to be read.
- *
- */
-extern void otPlatBleGattServerOnReadRequest(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an ATT Subscription
- * Request packet has been received.
- *
- * @note This function shall be used only for GATT Server.
- *
- * @param[in] aInstance    The OpenThread instance structure.
- * @param[in] aHandle      The handle of the attribute to be written.
- * @param[in] aSubscribing True if subscribing, otherwise unsubscribing.
- *
- */
-extern void otPlatBleGattServerOnSubscribeRequest(otInstance *aInstance, uint16_t aHandle, bool aSubscribing);
-
-/****************************************************************************
- * @section Bluetooth Low Energy L2CAP Connection Oriented Channels.
- ***************************************************************************/
-
-/**
- * Sends LE Credit Based Connection Request.
- *
- * @note Platform layer is responsible for credits management and segmentation (MPS).
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aPsm       The value of LE Protocol/Service Multiplexer.
- * @param[in]  aMtu       The value specifies the maximum SDU size (in octets) that the L2CAP
- *                        layer entity sending the LE Credit Based Connection Request can receive
- *                        on this channel.
- * @param[out] aCid       The source CID represents a channel endpoint on the device.
- *
- * @retval ::OT_ERROR_NONE           LE Credit Based Connection Request has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state e.g. not in the GAP connection.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid parameters has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- *
- */
-otError otPlatBleL2capConnectionRequest(otInstance *aInstance, uint16_t aPsm, uint16_t aMtu, uint16_t *aCid);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an LE Credit Based Connection
- * Request packet has been received.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aPsm       The value of LE Protocol/Service Multiplexer.
- * @param[in]  aMtu       The value specifies the maximum SDU size (in octets) that the L2CAP
- *                        layer entity sending the LE Credit Based Connection Request can receive
- *                        on this channel.
- * @param[in]  aPeerCid   The CID represents a channel endpoint on the peer device.
- *
- */
-extern void otPlatBleL2capOnConnectionRequest(otInstance *aInstance, uint16_t aPsm, uint16_t aMtu, uint16_t aPeerCid);
-
-/**
- * Sends LE Credit Based Connection Response.
- *
- * @note Platform layer is responsible for credits management and segmentation (MPS).
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aError     The error value indicates the outcome of the connection request.
- * @param[in]  aMtu       The value specifies the maximum SDU size (in octets) that the L2CAP
- *                        layer entity sending the LE Credit Based Connection Response can receive
- *                        on this channel.
- * @param[out] aCid       The source CID represents a channel endpoint on the device. If @p aResult
- *                        value is different from @p OT_BLE_L2C_ERROR_NONE, this variable is
- *                        unused and should be set to NULL.
- *
- * @retval ::OT_ERROR_NONE           LE Credit Based Connection Response has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state e.g. not in the GAP connection.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid parameters has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- *
- */
-otError otPlatBleL2capConnectionResponse(otInstance *        aInstance,
-                                         otPlatBleL2capError aError,
-                                         uint16_t            aMtu,
-                                         uint16_t *          aCid);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an LE Credit Based Connection
- * Response packet has been received.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- * @param[in]  aError     The error value indicates the outcome of the connection request.
- * @param[in]  aMtu       The value specifies the maximum SDU size (in octets) that the L2CAP
- *                        layer entity sending the LE Credit Based Connection Response can receive
- *                        on this channel.
- * @param[in]  aPeerCid   The CID represents a channel endpoint on the peer device.
- *
- */
-extern void otPlatBleL2capOnConnectionResponse(otInstance *        aInstance,
-                                               otPlatBleL2capError aError,
-                                               uint16_t            aMtu,
-                                               uint16_t            aPeerCid);
-
-/**
- * Sends an SDU on an L2CAP channel.
- *
- * @note Platform layer is responsible for credits management and segmentation (MPS).
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aLocalCid  The local channel endpoint ID value.
- * @param[in] aPeerCid   The peer channel endpoint ID value.
- * @param[in] aPacket    A pointer to the packet containing SDU.
- *
- * @retval ::OT_ERROR_NONE           LE Credit Based Connection Request has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state e.g. not in the GAP connection.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid parameters has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- *
- */
-otError otPlatBleL2capSduSend(otInstance *aInstance, uint16_t aLocalCid, uint16_t aPeerCid, otBleRadioPacket *aPacket);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an L2CAP SDU has been received.
- *
- * @note Platform layer is responsible for credits management and segmentation (MPS).
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aLocalCid  The local channel endpoint ID value.
- * @param[in] aPeerCid   The peer channel endpoint ID value.
- * @param[in] aPacket    A pointer to the packet containing SDU.
- *
- */
-extern void otPlatBleL2capOnSduReceived(otInstance *      aInstance,
-                                        uint16_t          aLocalCid,
-                                        uint16_t          aPeerCid,
-                                        otBleRadioPacket *aPacket);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an L2CAP SDU has been sent.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- *
- */
-extern void otPlatBleL2capOnSduSent(otInstance *aInstance);
-
-/**
- * Sends an L2CAP Disconnection Request.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aLocalCid  The local channel endpoint ID value.
- * @param[in] aPeerCid   The peer channel endpoint ID value.
- *
- * @retval ::OT_ERROR_NONE           L2CAP Disconnection Request has been sent.
- * @retval ::OT_ERROR_INVALID_STATE  BLE Device is in invalid state e.g. not in the GAP connection.
- * @retval ::OT_ERROR_INVALID_ARGS   Invalid parameters has been supplied.
- * @retval ::OT_ERROR_NO_BUFS        No available internal buffer found.
- *
- */
-otError otPlatBleL2capDisconnect(otInstance *aInstance, uint16_t aLocalCid, uint16_t aPeerCid);
-
-/**
- * The BLE driver calls this method to notify OpenThread that an L2CAP Disconnection Request has been
- * received.
- *
- * @note Platform layer is responsible to response with L2CAP Disconnection Response internally.
- *
- * @param[in] aInstance  The OpenThread instance structure.
- * @param[in] aLocalCid  The local channel endpoint ID value.
- * @param[in] aPeerCid   The peer channel endpoint ID value.
- *
- */
-extern void otPlatBleL2capOnDisconnect(otInstance *aInstance, uint16_t aLocalCid, uint16_t aPeerCid);
-
-/**
- * @}
- *
- */
-
-#ifdef __cplusplus
-} // end of extern "C"
-#endif
-
-#endif // OT_PLATFORM_BLE_H_
diff --git a/third_party/openthread/repo/src/core/crypto/pbkdf2_cmac.h b/third_party/openthread/repo/src/core/crypto/pbkdf2_cmac.h
deleted file mode 100644 (file)
index fffb5ba..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief
- *  This file defines the PBKDF2 using CMAC C APIs.
- */
-
-#ifndef PBKDF2_CMAC_H_
-#define PBKDF2_CMAC_H_
-
-#include "openthread-core-config.h"
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define OT_PBKDF2_SALT_MAX_LEN 30 // salt prefix (6) + extended panid (8) + network name (16)
-
-/**
- * This method perform PKCS#5 PBKDF2 using CMAC (AES-CMAC-PRF-128).
- *
- * @param[in]     aPassword          Password to use when generating key.
- * @param[in]     aPasswordLen       Length of password.
- * @param[in]     aSalt              Salt to use when generating key.
- * @param[in]     aSaltLen           Length of salt.
- * @param[in]     aIterationCounter  Iteration count.
- * @param[in]     aKeyLen            Length of generated key in bytes.
- * @param[out]    aKey               A pointer to the generated key.
- *
- */
-void otPbkdf2Cmac(const uint8_t *aPassword,
-                  uint16_t       aPasswordLen,
-                  const uint8_t *aSalt,
-                  uint16_t       aSaltLen,
-                  uint32_t       aIterationCounter,
-                  uint16_t       aKeyLen,
-                  uint8_t *      aKey);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // PBKDF2_CMAC_H_
diff --git a/third_party/openthread/repo/src/core/net/dns_headers.hpp b/third_party/openthread/repo/src/core/net/dns_headers.hpp
deleted file mode 100644 (file)
index 2c0128e..0000000
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- *  Copyright (c) 2017, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes definitions for generating and processing DNS headers.
- */
-
-#ifndef DNS_HEADER_HPP_
-#define DNS_HEADER_HPP_
-
-#include "openthread-core-config.h"
-
-#include "common/encoding.hpp"
-#include "common/message.hpp"
-
-namespace ot {
-
-/**
- * @namespace ot::Dns
- * @brief
- *   This namespace includes definitions for DNS.
- *
- */
-namespace Dns {
-
-using ot::Encoding::BigEndian::HostSwap16;
-using ot::Encoding::BigEndian::HostSwap32;
-
-/**
- * @addtogroup core-dns
- *
- * @brief
- *   This module includes definitions for DNS.
- *
- * @{
- *
- */
-
-/**
- * This class implements DNS header generation and parsing.
- *
- */
-OT_TOOL_PACKED_BEGIN
-class Header
-{
-public:
-    /**
-     * Default constructor for DNS Header.
-     *
-     */
-    Header(void) { memset(this, 0, sizeof(*this)); }
-
-    /**
-     * This method returns the Message ID.
-     *
-     * @returns The Message ID value.
-     *
-     */
-    uint16_t GetMessageId(void) const { return HostSwap16(mMessageId); }
-
-    /**
-     * This method sets the Message ID.
-     *
-     * @param[in]  aMessageId The Message ID value.
-     *
-     */
-    void SetMessageId(uint16_t aMessageId) { mMessageId = HostSwap16(aMessageId); }
-
-    /**
-     * Defines types of DNS message.
-     *
-     */
-    enum Type
-    {
-        kTypeQuery    = 0,
-        kTypeResponse = 1,
-    };
-
-    /**
-     * This method returns the type of the message.
-     *
-     * @returns The type of the message.
-     */
-    Type GetType(void) const { return static_cast<Type>((mFlags[0] & kQrFlagMask) >> kQrFlagOffset); }
-
-    /**
-     * This method sets the type of the message.
-     *
-     * @param[in]  aType The type of the message.
-     *
-     */
-    void SetType(Type aType)
-    {
-        mFlags[0] &= ~kQrFlagMask;
-        mFlags[0] |= static_cast<uint8_t>(aType) << kQrFlagOffset;
-    }
-
-    /**
-     * Defines types of query.
-     *
-     */
-    enum QueryType
-    {
-        kQueryTypeStandard = 0,
-        kQueryTypeInverse  = 1,
-        kQueryTypeStatus   = 2,
-        kQueryTypeNotify   = 4,
-        kQueryTypeUpdate   = 5
-    };
-
-    /**
-     * This method returns the type of the query.
-     *
-     * @returns The type of the query.
-     */
-    QueryType GetQueryType(void) const { return static_cast<QueryType>((mFlags[0] & kOpCodeMask) >> kOpCodeOffset); }
-
-    /**
-     * This method sets the type of the query.
-     *
-     * @param[in]  aType The type of the query.
-     *
-     */
-    void SetQueryType(QueryType aType)
-    {
-        mFlags[0] &= ~kOpCodeMask;
-        mFlags[0] |= static_cast<uint8_t>(aType) << kOpCodeOffset;
-    }
-
-    /**
-     * This method specifies in response message if the responding name server is an
-     * authority for the domain name in question section.
-     *
-     * @returns True if Authoritative Answer flag (AA) is set in the header, false otherwise.
-     */
-    bool IsAuthoritativeAnswerFlagSet(void) const { return (mFlags[0] & kAaFlagMask) == kAaFlagMask; }
-
-    /**
-     * This method clears the Authoritative Answer flag (AA) in the header.
-     *
-     */
-    void ClearAuthoritativeAnswerFlag(void) { mFlags[0] &= ~kAaFlagMask; }
-
-    /**
-     * This method sets the Authoritative Answer flag (AA) in the header.
-     *
-     */
-    void SetAuthoritativeAnswerFlag(void) { mFlags[0] |= kAaFlagMask; }
-
-    /**
-     * This method specifies if message is truncated.
-     *
-     * @returns True if Truncation flag (TC) is set in the header, false otherwise.
-     */
-    bool IsTruncationFlagSet(void) const { return (mFlags[0] & kTcFlagMask) == kTcFlagMask; }
-
-    /**
-     * This method clears the Truncation flag (TC) in the header.
-     *
-     */
-    void ClearTruncationFlag(void) { mFlags[0] &= ~kTcFlagMask; }
-
-    /**
-     * This method sets the Truncation flag (TC) in the header.
-     *
-     */
-    void SetTruncationFlag(void) { mFlags[0] |= kTcFlagMask; }
-
-    /**
-     * This method specifies if resolver wants to direct the name server to pursue
-     * the query recursively.
-     *
-     * @returns True if Recursion Desired flag (RD) is set in the header, false otherwise.
-     */
-    bool IsRecursionDesiredFlagSet(void) const { return (mFlags[0] & kRdFlagMask) == kRdFlagMask; }
-
-    /**
-     * This method clears the Recursion Desired flag (RD) in the header.
-     *
-     */
-    void ClearRecursionDesiredFlag(void) { mFlags[0] &= ~kRdFlagMask; }
-
-    /**
-     * This method sets the Recursion Desired flag (RD) in the header.
-     *
-     */
-    void SetRecursionDesiredFlag(void) { mFlags[0] |= kRdFlagMask; }
-
-    /**
-     * This method denotes whether recursive query support is available in the name server.
-     *
-     * @returns True if Recursion Available flag (RA) is set in the header, false otherwise.
-     */
-    bool IsRecursionAvailableFlagSet(void) const { return (mFlags[1] & kRaFlagMask) == kRaFlagMask; }
-
-    /**
-     * This method clears the Recursion Available flag (RA) in the header.
-     *
-     */
-    void ClearRecursionAvailableFlag(void) { mFlags[1] &= ~kRaFlagMask; }
-
-    /**
-     * This method sets the Recursion Available flag (RA) in the header.
-     *
-     */
-    void SetRecursionAvailableFlag(void) { mFlags[1] |= kRaFlagMask; }
-
-    /**
-     * Defines response codes.
-     *
-     */
-    enum Response
-    {
-        kResponseSuccess        = 0,
-        kResponseFormatError    = 1,
-        kResponseServerFailure  = 2,
-        kResponseNameError      = 3,
-        kResponseNotImplemented = 4,
-        kResponseRefused        = 5,
-        kResponseNotAuth        = 9,
-        kResponseNotZone        = 10,
-        kResponseBadName        = 20,
-        kResponseBadAlg         = 21,
-        kResponseBadTruncation  = 22,
-    };
-
-    /**
-     * This method returns the response code.
-     *
-     * @returns The response code from the header.
-     */
-    Response GetResponseCode(void) const { return static_cast<Response>((mFlags[1] & kRCodeMask) >> kRCodeOffset); }
-
-    /**
-     * This method sets the response code.
-     *
-     * @param[in]  aResponse The type of the response.
-     *
-     */
-    void SetResponseCode(Response aResponse)
-    {
-        mFlags[1] &= ~kRCodeMask;
-        mFlags[1] |= static_cast<uint8_t>(aResponse) << kRCodeOffset;
-    }
-
-    /**
-     * This method returns the number of entries in question section.
-     *
-     * @returns The number of entries in question section.
-     *
-     */
-    uint16_t GetQuestionCount(void) const { return HostSwap16(mQdCount); }
-
-    /**
-     * This method sets the number of entries in question section.
-     *
-     * @param[in]  aCount The number of entries in question section.
-     *
-     */
-    void SetQuestionCount(uint16_t aCount) { mQdCount = HostSwap16(aCount); }
-
-    /**
-     * This method returns the number of entries in answer section.
-     *
-     * @returns The number of entries in answer section.
-     *
-     */
-    uint16_t GetAnswerCount(void) const { return HostSwap16(mAnCount); }
-
-    /**
-     * This method sets the number of entries in answer section.
-     *
-     * @param[in]  aCount The number of entries in answer section.
-     *
-     */
-    void SetAnswerCount(uint16_t aCount) { mAnCount = HostSwap16(aCount); }
-
-    /**
-     * This method returns the number of entries in authority records section.
-     *
-     * @returns The number of entries in authority records section.
-     *
-     */
-    uint16_t GetAuthorityRecordsCount(void) const { return HostSwap16(mNsCount); }
-
-    /**
-     * This method sets the number of entries in authority records section.
-     *
-     * @param[in]  aCount The number of entries in authority records section.
-     *
-     */
-    void SetAuthorityRecordsCount(uint16_t aCount) { mNsCount = HostSwap16(aCount); }
-
-    /**
-     * This method returns the number of entries in additional records section.
-     *
-     * @returns The number of entries in additional records section.
-     *
-     */
-    uint16_t GetAdditionalRecordsCount(void) const { return HostSwap16(mArCount); }
-
-    /**
-     * This method sets the number of entries in additional records section.
-     *
-     * @param[in]  aCount The number of entries in additional records section.
-     *
-     */
-    void SetAdditionalRecordsCount(uint16_t aCount) { mArCount = HostSwap16(aCount); }
-
-private:
-    /**
-     * Protocol Constants (RFC 1035).
-     *
-     */
-    enum
-    {
-        kQrFlagOffset = 7,                     ///< QR Flag offset.
-        kQrFlagMask   = 0x01 << kQrFlagOffset, ///< QR Flag mask.
-        kOpCodeOffset = 3,                     ///< OpCode field offset.
-        kOpCodeMask   = 0x0f << kOpCodeOffset, ///< OpCode field mask.
-        kAaFlagOffset = 2,                     ///< AA Flag offset.
-        kAaFlagMask   = 0x01 << kAaFlagOffset, ///< AA Flag mask.
-        kTcFlagOffset = 1,                     ///< TC Flag offset.
-        kTcFlagMask   = 0x01 << kTcFlagOffset, ///< TC Flag mask.
-        kRdFlagOffset = 0,                     ///< RD Flag offset.
-        kRdFlagMask   = 0x01 << kRdFlagOffset, ///< RD Flag mask.
-
-        kRaFlagOffset = 7,                     ///< RA Flag offset.
-        kRaFlagMask   = 0x01 << kRaFlagOffset, ///< RA Flag mask.
-        kRCodeOffset  = 0,                     ///< RCODE field offset.
-        kRCodeMask    = 0x0f << kRCodeOffset,  ///< RCODE field mask.
-    };
-
-    uint16_t
-             mMessageId; ///< A message identifier that is used by the requester to match up replies to outstanding queries.
-    uint8_t  mFlags[2]; ///< DNS header flags.
-    uint16_t mQdCount;  ///< A number specifying the number of entries in the question section.
-    uint16_t mAnCount;  ///< A number specifying the number of entries in the answer section.
-    uint16_t mNsCount;  ///< A number specifying the number of entries in the authority records section.
-    uint16_t mArCount;  ///< A number specifying the number of entries in the additional records section.
-
-} OT_TOOL_PACKED_END;
-
-/**
- * This class implements Resource Record body format (RR).
- *
- */
-OT_TOOL_PACKED_BEGIN
-class ResourceRecord
-{
-public:
-    /**
-     * This method returns the type of the resource record.
-     *
-     * @returns The type of the resource record.
-     */
-    uint16_t GetType(void) const { return HostSwap16(mType); }
-
-    /**
-     * This method sets the type of the resource record.
-     *
-     * @param[in]  aType The type of the resource record.
-     *
-     */
-    void SetType(uint16_t aType) { mType = HostSwap16(aType); }
-
-    /**
-     * This method returns the class of the resource record.
-     *
-     * @returns The class of the resource record.
-     */
-    uint16_t GetClass(void) const { return HostSwap16(mClass); }
-
-    /**
-     * This method sets the class of the resource record.
-     *
-     * @param[in]  aClass The class of the resource record.
-     *
-     */
-    void SetClass(uint16_t aClass) { mClass = HostSwap16(aClass); }
-
-    /**
-     * This method returns the time to live field of the resource record.
-     *
-     * @returns The time to live field of the resource record.
-     */
-    uint32_t GetTtl(void) const { return HostSwap32(mTtl); }
-
-    /**
-     * This method sets the time to live field of the resource record.
-     *
-     * @param[in]  aTtl The time to live field of the resource record.
-     *
-     */
-    void SetTtl(uint32_t aTtl) { mTtl = HostSwap32(aTtl); }
-
-    /**
-     * This method returns the length of the resource record.
-     *
-     * @returns The length of the resource record.
-     */
-    uint16_t GetLength(void) const { return HostSwap16(mLength); }
-
-    /**
-     * This method sets the length of the resource record.
-     *
-     * @param[in]  aLength The length of the resource record.
-     *
-     */
-    void SetLength(uint16_t aLength) { mLength = HostSwap16(aLength); }
-
-private:
-    uint16_t mType;   ///< The type of the data in RDATA section.
-    uint16_t mClass;  ///< The class of the data in RDATA section.
-    uint32_t mTtl;    ///< Specifies the maximum time that the resource record may be cached.
-    uint16_t mLength; ///< The length of RDATA section in bytes.
-
-} OT_TOOL_PACKED_END;
-
-/**
- * This class implements Resource Record body format of AAAA type.
- *
- */
-OT_TOOL_PACKED_BEGIN
-class ResourceRecordAaaa : public ResourceRecord
-{
-public:
-    enum
-    {
-        kType   = 0x1C, ///< AAAA Resource Record type.
-        kClass  = 0x01, ///< The value of the Internet class.
-        kLength = 16,   ///< Size of the AAAA Resource Record type.
-    };
-
-    /**
-     * This method initializes the AAAA Resource Record.
-     *
-     */
-    void Init(void)
-    {
-        ResourceRecord::SetType(kType);
-        ResourceRecord::SetClass(kClass);
-        ResourceRecord::SetTtl(0);
-        ResourceRecord::SetLength(kLength);
-        memset(&mAddress, 0, sizeof(mAddress));
-    }
-
-    /**
-     * This method sets the IPv6 address of the resource record.
-     *
-     * @param[in]  aAddress The IPv6 address of the resource record.
-     *
-     */
-    void SetAddress(otIp6Address &aAddress) { mAddress = aAddress; }
-
-    /**
-     * This method returns the reference to IPv6 address of the resource record.
-     *
-     * @returns The reference to IPv6 address of the resource record.
-     */
-    otIp6Address &GetAddress(void) { return mAddress; }
-
-private:
-    otIp6Address mAddress; ///< IPv6 Address of AAAA Resource Record.
-
-} OT_TOOL_PACKED_END;
-
-/**
- * This class implements Question format.
- *
- */
-OT_TOOL_PACKED_BEGIN
-class Question
-{
-public:
-    /**
-     * Constructor for Question.
-     *
-     */
-    Question(uint16_t aType, uint16_t aClass)
-    {
-        SetType(aType);
-        SetClass(aClass);
-    };
-
-    /**
-     * This method returns the type of the question.
-     *
-     * @returns The type of the question.
-     */
-    uint16_t GetType(void) const { return HostSwap16(mType); }
-
-    /**
-     * This method sets the type of the question.
-     *
-     * @param[in]  aType The type of the question.
-     *
-     */
-    void SetType(uint16_t aType) { mType = HostSwap16(aType); }
-
-    /**
-     * This method returns the class of the question.
-     *
-     * @returns The class of the question.
-     */
-    uint16_t GetClass(void) const { return HostSwap16(mClass); }
-
-    /**
-     * This method sets the class of the question.
-     *
-     * @param[in]  aClass The class of the question.
-     *
-     */
-    void SetClass(uint16_t aClass) { mClass = HostSwap16(aClass); }
-
-private:
-    uint16_t mType;  ///< The type of the data in question section.
-    uint16_t mClass; ///< The class of the data in question section.
-
-} OT_TOOL_PACKED_END;
-
-/**
- * This class implements Question format of AAAA type.
- *
- */
-class QuestionAaaa : public Question
-{
-public:
-    enum
-    {
-        kType  = 0x1C, ///< AAAA Resource Record type.
-        kClass = 0x01, ///< The value of the Internet class.
-    };
-
-    /**
-     * Default constructor for AAAA Question.
-     *
-     */
-    QuestionAaaa(void)
-        : Question(kType, kClass)
-    {
-    }
-
-    /**
-     * This method appends request data to the message.
-     *
-     * @param[in]  aMessage  A reference to the message.
-     *
-     * @retval OT_ERROR_NONE     Successfully appended the bytes.
-     * @retval OT_ERROR_NO_BUFS  Insufficient available buffers to grow the message.
-     *
-     */
-    otError AppendTo(Message &aMessage) const { return aMessage.Append(this, sizeof(*this)); }
-};
-
-/**
- * @}
- *
- */
-
-} // namespace Dns
-} // namespace ot
-
-#endif // DNS_HEADER_HPP_
diff --git a/third_party/openthread/repo/src/posix/platform/max_power_table.hpp b/third_party/openthread/repo/src/posix/platform/max_power_table.hpp
deleted file mode 100644 (file)
index f72cfa5..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OT_POSIX_PLATFORM_MAX_POWER_TABLE_HPP_
-#define OT_POSIX_PLATFORM_MAX_POWER_TABLE_HPP_
-
-#include "core/radio/radio.hpp"
-
-namespace ot {
-namespace Posix {
-
-class MaxPowerTable
-{
-public:
-    static const int8_t kPowerDefault = 30; ///< Default power 1 watt (30 dBm).
-
-    MaxPowerTable(void) { memset(mPowerTable, kPowerForbidden, sizeof(mPowerTable)); }
-
-    /**
-     * This method gets the max allowed transmit power of channel @p aChannel.
-     *
-     * @params[in]  aChannel    The radio channel number.
-     *
-     * @returns The max allowed transmit power in dBm.
-     *
-     */
-    int8_t GetTransmitPower(uint8_t aChannel) const { return mPowerTable[aChannel - Radio::kChannelMin]; }
-
-    /**
-     * This method sets the max allowed transmit power of channel @p aChannel.
-     *
-     * @params[in]  aChannel    The radio channel number.
-     * @params[in]  aPower      The max allowed transmit power in dBm.
-     *
-     */
-    void SetTransmitPower(uint8_t aChannel, int8_t aPower) { mPowerTable[aChannel - Radio::kChannelMin] = aPower; }
-
-    /**
-     * This method gets the allowed channel masks.
-     *
-     * All channels of max power value of 0x7f is considered forbidden.
-     *
-     */
-    uint32_t GetAllowedChannelMask(void) const
-    {
-        uint32_t channelMask = 0;
-
-        for (uint8_t i = Radio::kChannelMin; i <= Radio::kChannelMax; ++i)
-        {
-            if (mPowerTable[i - Radio::kChannelMin] != kPowerForbidden)
-            {
-                channelMask |= (1 << i);
-            }
-        }
-
-        return channelMask;
-    }
-
-private:
-    static const int8_t kPowerForbidden = 0x7f;
-
-    int8_t mPowerTable[Radio::kChannelMax - Radio::kChannelMin + 1];
-};
-
-} // namespace Posix
-} // namespace ot
-
-#endif // OT_POSIX_PLATFORM_MAX_POWER_TABLE_HPP_
diff --git a/third_party/openthread/repo/tests/scripts/thread-cert/Cert_5_3_06b_RouterIdMask.py b/third_party/openthread/repo/tests/scripts/thread-cert/Cert_5_3_06b_RouterIdMask.py
deleted file mode 100755 (executable)
index 4f86b41..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (c) 2016, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-import unittest
-
-import thread_cert
-
-LEADER = 1
-ROUTER1 = 2
-ROUTER2 = 3
-
-
-class Cert_5_3_6_RouterIdMask(thread_cert.TestCase):
-    TOPOLOGY = {
-        LEADER: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'whitelist': [ROUTER1]
-        },
-        ROUTER1: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_selection_jitter': 1,
-            'whitelist': [LEADER, ROUTER2]
-        },
-        ROUTER2: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_selection_jitter': 1,
-            'whitelist': [ROUTER1]
-        },
-    }
-
-    def test(self):
-        self.nodes[LEADER].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[LEADER].get_state(), 'leader')
-
-        self.nodes[ROUTER1].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[ROUTER1].get_state(), 'router')
-
-        self.nodes[ROUTER2].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[ROUTER2].get_state(), 'router')
-
-        self.nodes[ROUTER1].stop()
-        self.nodes[ROUTER2].stop()
-
-        self.simulator.go(300)
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/openthread/repo/tests/scripts/thread-cert/Cert_5_7_01_CoapDiagCommands_A.py b/third_party/openthread/repo/tests/scripts/thread-cert/Cert_5_7_01_CoapDiagCommands_A.py
deleted file mode 100755 (executable)
index 4eafce9..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-import unittest
-
-import config
-import mle
-import network_diag
-import network_layer
-import thread_cert
-from network_diag import TlvType
-
-LEADER = 1
-ROUTER1 = 2
-REED1 = 3
-SED1 = 4
-MED1 = 5
-FED1 = 6
-
-DUT = ROUTER1
-MTDS = [MED1, SED1]
-
-
-class Cert_5_7_01_CoapDiagCommands_A(thread_cert.TestCase):
-    SUPPORT_NCP = False
-
-    TOPOLOGY = {
-        LEADER: {
-            'whitelist': [ROUTER1],
-        },
-        ROUTER1: {
-            'whitelist': [LEADER, REED1, SED1, MED1, FED1],
-            'router_selection_jitter': 1
-        },
-        REED1: {
-            'whitelist': [ROUTER1],
-            'router_upgrade_threshold': 0
-        },
-        SED1: {
-            'is_mtd': True,
-            'mode': 's',
-            'whitelist': [ROUTER1],
-            'timeout': config.DEFAULT_CHILD_TIMEOUT
-        },
-        MED1: {
-            'is_mtd': True,
-            'mode': 'rsn',
-            'whitelist': [ROUTER1]
-        },
-        FED1: {
-            'whitelist': [ROUTER1],
-            'router_upgrade_threshold': 0
-        },
-    }
-
-    def test(self):
-        # 1 - Form topology
-        self.nodes[LEADER].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[LEADER].get_state(), 'leader')
-
-        self.nodes[ROUTER1].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[ROUTER1].get_state(), 'router')
-
-        self.nodes[REED1].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[REED1].get_state(), 'child')
-
-        self.nodes[SED1].start()
-        self.simulator.go(10)
-        self.assertEqual(self.nodes[SED1].get_state(), 'child')
-
-        self.nodes[MED1].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[MED1].get_state(), 'child')
-
-        self.nodes[FED1].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[FED1].get_state(), 'child')
-
-        dut_rloc = self.nodes[DUT].get_ip6_address(config.ADDRESS_TYPE.RLOC)
-
-        # 2 - Leader sends DIAG_GET.req
-        tlv_types = [
-            TlvType.EXT_ADDRESS, TlvType.ADDRESS16, TlvType.MODE, TlvType.CONNECTIVITY, TlvType.ROUTE64,
-            TlvType.LEADER_DATA, TlvType.NETWORK_DATA, TlvType.IPV6_ADDRESS_LIST, TlvType.CHANNEL_PAGES
-        ]
-        self.nodes[LEADER].send_network_diag_get(dut_rloc, tlv_types)
-        self.simulator.go(2)
-
-        dut_messages = self.simulator.get_messages_sent_by(DUT)
-
-        diag_get_rsp = dut_messages.next_coap_message(code='2.04')
-        diag_get_rsp.assertCoapMessageContainsTlv(network_layer.MacExtendedAddress)
-        diag_get_rsp.assertCoapMessageContainsTlv(mle.Address16)
-        diag_get_rsp.assertCoapMessageContainsTlv(mle.Mode)
-        diag_get_rsp.assertCoapMessageContainsTlv(mle.Connectivity)
-        diag_get_rsp.assertCoapMessageContainsTlv(mle.Route64)
-        diag_get_rsp.assertCoapMessageContainsTlv(mle.LeaderData)
-        diag_get_rsp.assertCoapMessageContainsTlv(mle.NetworkData)
-        diag_get_rsp.assertCoapMessageContainsTlv(network_diag.Ipv6AddressList)
-        diag_get_rsp.assertCoapMessageContainsTlv(network_diag.ChannelPages)
-
-        # 3 - Leader sends DIAG_GET.req (MAC Counters TLV type included)
-        self.nodes[LEADER].send_network_diag_get(dut_rloc, [TlvType.MAC_COUNTERS])
-        self.simulator.go(2)
-
-        dut_messages = self.simulator.get_messages_sent_by(DUT)
-        diag_get_rsp = dut_messages.next_coap_message(code='2.04')
-        diag_get_rsp.assertCoapMessageContainsTlv(network_diag.MacCounters)
-        mac_counters = diag_get_rsp.get_coap_message_tlv(network_diag.MacCounters)
-
-        # 4 - Leader sends DIAG_GET.req (Timeout/Polling Period TLV type included)
-        self.nodes[LEADER].send_network_diag_get(dut_rloc, [TlvType.POLLING_PERIOD])
-        self.simulator.go(2)
-
-        dut_messages = self.simulator.get_messages_sent_by(DUT)
-        diag_get_rsp = dut_messages.next_coap_message(code='2.04')
-        diag_get_rsp.assertCoapMessageDoesNotContainTlv(mle.Timeout)
-
-        # 5 - Leader sends DIAG_GET.req (Battery Level and Supply Voltage TLV types included)
-        self.nodes[LEADER].send_network_diag_get(dut_rloc, [TlvType.BATTERY_LEVEL, TlvType.SUPPLY_VOLTAGE])
-        self.simulator.go(2)
-
-        dut_messages = self.simulator.get_messages_sent_by(DUT)
-        diag_get_rsp = dut_messages.next_coap_message(code='2.04')
-        diag_get_rsp.assertCoapMessageContainsOptionalTlv(network_diag.BatteryLevel)
-        diag_get_rsp.assertCoapMessageContainsOptionalTlv(network_diag.SupplyVoltage)
-
-        # 6 - Leader sends DIAG_GET.req (Child Table TLV types included)
-        self.nodes[LEADER].send_network_diag_get(dut_rloc, [TlvType.CHILD_TABLE])
-        self.simulator.go(2)
-
-        dut_messages = self.simulator.get_messages_sent_by(DUT)
-        diag_get_rsp = dut_messages.next_coap_message(code='2.04')
-        diag_get_rsp.assertCoapMessageContainsTlv(network_diag.ChildTable)
-        child_table = diag_get_rsp.get_coap_message_tlv(network_diag.ChildTable)
-        self.assertEqual(len(child_table.children), 4)
-        # TODO(wgtdkp): more validations
-
-        # 7 - Leader sends DIAG_RST.ntf (MAC Counters TLV type included)
-        self.nodes[LEADER].send_network_diag_reset(dut_rloc, [TlvType.MAC_COUNTERS])
-        self.simulator.go(2)
-
-        dut_messages = self.simulator.get_messages_sent_by(DUT)
-
-        # Make sure the response is there.
-        dut_messages.next_coap_message(code='2.04')
-
-        # 8 - Leader Sends DIAG_GET.req (MAC Counters TLV type included)
-        self.nodes[LEADER].send_network_diag_get(dut_rloc, [TlvType.MAC_COUNTERS])
-        self.simulator.go(2)
-
-        dut_messages = self.simulator.get_messages_sent_by(DUT)
-        diag_get_rsp = dut_messages.next_coap_message(code='2.04')
-        diag_get_rsp.assertCoapMessageContainsTlv(network_diag.MacCounters)
-        reset_mac_counters = diag_get_rsp.get_coap_message_tlv(network_diag.MacCounters)
-
-        self.assertEqual(len(mac_counters.counters), len(reset_mac_counters.counters))
-        for old_counter, new_counter in zip(mac_counters.counters, reset_mac_counters.counters):
-            self.assertTrue(new_counter == 0 or new_counter < old_counter)
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_02_REEDAttach_MED.py b/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_02_REEDAttach_MED.py
deleted file mode 100755 (executable)
index 4acdf73..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (c) 2018, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-import unittest
-
-import thread_cert
-from command import check_parent_request
-from command import check_child_id_request
-from command import check_child_update_request_from_child
-from command import CheckType
-import config
-import mle
-
-LEADER = 1
-REED = 2
-MED = 3
-
-
-class Cert_6_1_2_REEDAttach_MED(thread_cert.TestCase):
-    TOPOLOGY = {
-        LEADER: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'whitelist': [REED]
-        },
-        REED: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_upgrade_threshold': 0,
-            'whitelist': [LEADER, MED]
-        },
-        MED: {
-            'is_mtd': True,
-            'mode': 'rsn',
-            'panid': 0xface,
-            'timeout': config.DEFAULT_CHILD_TIMEOUT,
-            'whitelist': [REED]
-        },
-    }
-
-    def test(self):
-        self.nodes[LEADER].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[LEADER].get_state(), 'leader')
-
-        self.nodes[REED].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[REED].get_state(), 'child')
-
-        self.nodes[MED].start()
-
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[MED].get_state(), 'child')
-        self.assertEqual(self.nodes[REED].get_state(), 'router')
-        med_messages = self.simulator.get_messages_sent_by(MED)
-
-        # Step 2 - DUT sends MLE Parent Request
-        msg = med_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        check_parent_request(msg, is_first_request=True)
-
-        # Step 4 - DUT sends MLE Parent Request again
-        msg = med_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        check_parent_request(msg, is_first_request=False)
-
-        # Step 6 - DUT sends Child ID Request
-        msg = med_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST, sent_to_node=self.nodes[REED])
-        check_child_id_request(
-            msg,
-            address_registration=CheckType.CONTAIN,
-            tlv_request=CheckType.CONTAIN,
-            mle_frame_counter=CheckType.OPTIONAL,
-            route64=CheckType.OPTIONAL,
-        )
-
-        # Wait additional DEFAULT_CHILD_TIMEOUT to ensure the keep-alive
-        # message (child update request from MED) happens.
-        self.simulator.go(config.DEFAULT_CHILD_TIMEOUT)
-        med_messages = self.simulator.get_messages_sent_by(MED)
-
-        # Step 8 - DUT sends Child Update messages
-        msg = med_messages.next_mle_message(mle.CommandType.CHILD_UPDATE_REQUEST)
-        check_child_update_request_from_child(
-            msg,
-            source_address=CheckType.CONTAIN,
-            leader_data=CheckType.CONTAIN,
-        )
-
-        # Step 10 - Leader sends ICMPv6 echo request, to DUT link local address
-        med_addrs = self.nodes[MED].get_addrs()
-        for addr in med_addrs:
-            if addr[0:4] == 'fe80':
-                self.assertTrue(self.nodes[REED].ping(addr))
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_02_REEDAttach_SED.py b/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_02_REEDAttach_SED.py
deleted file mode 100755 (executable)
index a4d7fe9..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (c) 2018, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-import unittest
-
-import thread_cert
-from command import check_parent_request
-from command import check_child_id_request
-from command import CheckType
-import config
-import mac802154
-import message
-import mle
-
-LEADER = 1
-REED = 2
-SED = 3
-
-
-class Cert_6_1_2_REEDAttach_SED(thread_cert.TestCase):
-    TOPOLOGY = {
-        LEADER: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'whitelist': [REED]
-        },
-        REED: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_upgrade_threshold': 0,
-            'whitelist': [LEADER, SED]
-        },
-        SED: {
-            'is_mtd': True,
-            'mode': 's',
-            'panid': 0xface,
-            'timeout': config.DEFAULT_CHILD_TIMEOUT,
-            'whitelist': [REED]
-        },
-    }
-
-    def test(self):
-        self.nodes[LEADER].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[LEADER].get_state(), 'leader')
-
-        self.nodes[REED].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[REED].get_state(), 'child')
-
-        self.nodes[SED].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[SED].get_state(), 'child')
-        self.assertEqual(self.nodes[REED].get_state(), 'router')
-
-        sed_messages = self.simulator.get_messages_sent_by(SED)
-
-        # Step 2 - DUT sends MLE Parent Request
-        msg = sed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        check_parent_request(msg, is_first_request=True)
-
-        # Step 4 - DUT sends MLE Parent Request again
-        msg = sed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        check_parent_request(msg, is_first_request=False)
-
-        # Step 6 - DUT sends Child ID Request
-        msg = sed_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST, sent_to_node=self.nodes[REED])
-        check_child_id_request(
-            msg,
-            address_registration=CheckType.CONTAIN,
-            tlv_request=CheckType.CONTAIN,
-            mle_frame_counter=CheckType.OPTIONAL,
-            route64=CheckType.OPTIONAL,
-        )
-
-        # Wait DEFAULT_CHILD_TIMEOUT seconds,
-        # ensure SED has received the CHILD_ID_RESPONSE,
-        # and the next data requests would be keep-alive messages
-        self.simulator.go(config.DEFAULT_CHILD_TIMEOUT)
-        sed_messages = self.simulator.get_messages_sent_by(SED)
-
-        # Step 11 - SED sends periodic 802.15.4 Data Request messages
-        msg = sed_messages.next_message()
-        self.assertEqual(
-            False, msg.isMacAddressTypeLong())  # Extra check, keep-alive messages are of short types of mac address
-        self.assertEqual(msg.type, message.MessageType.COMMAND)
-        self.assertEqual(
-            msg.mac_header.command_type,
-            mac802154.MacHeader.CommandIdentifier.DATA_REQUEST,
-        )
-
-        # Step 12 - REED sends ICMPv6 echo request, to DUT link local address
-        sed_addrs = self.nodes[SED].get_addrs()
-        for addr in sed_addrs:
-            if addr[0:4] == 'fe80':
-                self.assertTrue(self.nodes[REED].ping(addr))
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_06_REEDAttachLinkQuality_ED.py b/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_06_REEDAttachLinkQuality_ED.py
deleted file mode 100755 (executable)
index 6d96b54..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (c) 2016, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-import unittest
-
-import mle
-import thread_cert
-
-LEADER = 1
-REED = 2
-ROUTER2 = 3
-ED = 4
-
-
-class Cert_6_1_6_REEDAttachLinkQuality_ED(thread_cert.TestCase):
-    TOPOLOGY = {
-        LEADER: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'whitelist': [REED, ROUTER2]
-        },
-        REED: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_upgrade_threshold': 0,
-            'whitelist': [LEADER, ED]
-        },
-        ROUTER2: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_selection_jitter': 1,
-            'whitelist': [LEADER, (ED, -85)]
-        },
-        ED: {
-            'is_mtd': True,
-            'mode': 'rsn',
-            'panid': 0xface,
-            'whitelist': [REED, ROUTER2]
-        },
-    }
-
-    def test(self):
-        self.nodes[LEADER].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[LEADER].get_state(), 'leader')
-
-        self.nodes[REED].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[REED].get_state(), 'child')
-
-        self.nodes[ROUTER2].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[ROUTER2].get_state(), 'router')
-
-        self.nodes[ED].start()
-        self.simulator.go(10)
-        self.assertEqual(self.nodes[ED].get_state(), 'child')
-        self.assertEqual(self.nodes[REED].get_state(), 'router')
-
-        leader_messages = self.simulator.get_messages_sent_by(LEADER)
-        reed_messages = self.simulator.get_messages_sent_by(REED)
-        ed_messages = self.simulator.get_messages_sent_by(ED)
-        router2_messages = self.simulator.get_messages_sent_by(ROUTER2)
-
-        # 1 - Leader. REED1, Router2
-        leader_messages.next_mle_message(mle.CommandType.ADVERTISEMENT)
-
-        reed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-
-        reed_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.CHILD_ID_RESPONSE)
-
-        router2_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-
-        router2_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.CHILD_ID_RESPONSE)
-
-        msg = router2_messages.next_coap_message("0.02")
-        msg.assertCoapMessageRequestUriPath("/a/as")
-
-        msg = leader_messages.next_coap_message("2.04")
-
-        router2_messages.next_mle_message(mle.CommandType.ADVERTISEMENT)
-
-        # 3 - ED
-        msg = ed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        msg.assertSentWithHopLimit(255)
-        msg.assertSentToDestinationAddress("ff02::2")
-        msg.assertMleMessageContainsTlv(mle.Mode)
-        msg.assertMleMessageContainsTlv(mle.Challenge)
-        msg.assertMleMessageContainsTlv(mle.ScanMask)
-        msg.assertMleMessageContainsTlv(mle.Version)
-
-        scan_mask_tlv = msg.get_mle_message_tlv(mle.ScanMask)
-        self.assertEqual(1, scan_mask_tlv.router)
-        self.assertEqual(0, scan_mask_tlv.end_device)
-
-        # 4 - Router2
-        msg = router2_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-        msg.assertSentToNode(self.nodes[ED])
-
-        # 5 - ED
-        msg = ed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        msg.assertSentWithHopLimit(255)
-        msg.assertSentToDestinationAddress("ff02::2")
-        msg.assertMleMessageContainsTlv(mle.Mode)
-        msg.assertMleMessageContainsTlv(mle.Challenge)
-        msg.assertMleMessageContainsTlv(mle.ScanMask)
-        msg.assertMleMessageContainsTlv(mle.Version)
-
-        scan_mask_tlv = msg.get_mle_message_tlv(mle.ScanMask)
-        self.assertEqual(1, scan_mask_tlv.router)
-        self.assertEqual(1, scan_mask_tlv.end_device)
-
-        # 6 - REED
-        msg = router2_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-        msg.assertSentToNode(self.nodes[ED])
-
-        msg = reed_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-        msg.assertSentToNode(self.nodes[ED])
-
-        # 7 - ED
-        msg = ed_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST)
-        msg.assertMleMessageContainsTlv(mle.AddressRegistration)
-        msg.assertMleMessageContainsTlv(mle.LinkLayerFrameCounter)
-        msg.assertMleMessageContainsTlv(mle.Mode)
-        msg.assertMleMessageContainsTlv(mle.Response)
-        msg.assertMleMessageContainsTlv(mle.Timeout)
-        msg.assertMleMessageContainsTlv(mle.TlvRequest)
-        msg.assertMleMessageContainsTlv(mle.Version)
-        msg.assertMleMessageContainsOptionalTlv(mle.MleFrameCounter)
-        msg.assertSentToNode(self.nodes[REED])
-
-        msg = reed_messages.next_mle_message(mle.CommandType.CHILD_ID_RESPONSE)
-        msg.assertSentToNode(self.nodes[ED])
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_06_REEDAttachLinkQuality_SED.py b/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_06_REEDAttachLinkQuality_SED.py
deleted file mode 100755 (executable)
index 279e266..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-import unittest
-
-import config
-import mle
-import thread_cert
-
-LEADER = 1
-REED = 2
-ROUTER2 = 3
-SED = 4
-
-
-class Cert_6_1_6_REEDAttachLinkQuality_SED(thread_cert.TestCase):
-    TOPOLOGY = {
-        LEADER: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'whitelist': [REED, ROUTER2]
-        },
-        REED: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_upgrade_threshold': 0,
-            'whitelist': [LEADER, SED]
-        },
-        ROUTER2: {
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_selection_jitter': 1,
-            'whitelist': [LEADER, (SED, -85)]
-        },
-        SED: {
-            'is_mtd': True,
-            'mode': 's',
-            'panid': 0xface,
-            'timeout': config.DEFAULT_CHILD_TIMEOUT,
-            'whitelist': [REED, ROUTER2]
-        },
-    }
-
-    def test(self):
-        self.nodes[LEADER].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[LEADER].get_state(), 'leader')
-
-        self.nodes[REED].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[REED].get_state(), 'child')
-
-        self.nodes[ROUTER2].start()
-        self.simulator.go(5)
-        self.assertEqual(self.nodes[ROUTER2].get_state(), 'router')
-
-        self.nodes[SED].start()
-        self.simulator.go(10)
-        self.assertEqual(self.nodes[SED].get_state(), 'child')
-        self.assertEqual(self.nodes[REED].get_state(), 'router')
-
-        leader_messages = self.simulator.get_messages_sent_by(LEADER)
-        reed_messages = self.simulator.get_messages_sent_by(REED)
-        sed_messages = self.simulator.get_messages_sent_by(SED)
-        router2_messages = self.simulator.get_messages_sent_by(ROUTER2)
-
-        # 1 - Leader. REED1, Router2
-        leader_messages.next_mle_message(mle.CommandType.ADVERTISEMENT)
-
-        reed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-
-        reed_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.CHILD_ID_RESPONSE)
-
-        router2_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-
-        router2_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST)
-        leader_messages.next_mle_message(mle.CommandType.CHILD_ID_RESPONSE)
-
-        msg = router2_messages.next_coap_message("0.02")
-        msg.assertCoapMessageRequestUriPath("/a/as")
-
-        msg = leader_messages.next_coap_message("2.04")
-
-        router2_messages.next_mle_message(mle.CommandType.ADVERTISEMENT)
-
-        # 3 - SED
-        msg = sed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        msg.assertSentWithHopLimit(255)
-        msg.assertSentToDestinationAddress("ff02::2")
-        msg.assertMleMessageContainsTlv(mle.Mode)
-        msg.assertMleMessageContainsTlv(mle.Challenge)
-        msg.assertMleMessageContainsTlv(mle.ScanMask)
-        msg.assertMleMessageContainsTlv(mle.Version)
-
-        scan_mask_tlv = msg.get_mle_message_tlv(mle.ScanMask)
-        self.assertEqual(1, scan_mask_tlv.router)
-        self.assertEqual(0, scan_mask_tlv.end_device)
-
-        # 4 - Router2
-        msg = router2_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-        msg.assertSentToNode(self.nodes[SED])
-
-        # 5 - SED
-        msg = sed_messages.next_mle_message(mle.CommandType.PARENT_REQUEST)
-        msg.assertSentWithHopLimit(255)
-        msg.assertSentToDestinationAddress("ff02::2")
-        msg.assertMleMessageContainsTlv(mle.Mode)
-        msg.assertMleMessageContainsTlv(mle.Challenge)
-        msg.assertMleMessageContainsTlv(mle.ScanMask)
-        msg.assertMleMessageContainsTlv(mle.Version)
-
-        scan_mask_tlv = msg.get_mle_message_tlv(mle.ScanMask)
-        self.assertEqual(1, scan_mask_tlv.router)
-        self.assertEqual(1, scan_mask_tlv.end_device)
-
-        # 6 - REED
-        msg = router2_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-        msg.assertSentToNode(self.nodes[SED])
-
-        msg = reed_messages.next_mle_message(mle.CommandType.PARENT_RESPONSE)
-        msg.assertSentToNode(self.nodes[SED])
-
-        # 7 - SED
-        msg = sed_messages.next_mle_message(mle.CommandType.CHILD_ID_REQUEST)
-        msg.assertMleMessageContainsTlv(mle.AddressRegistration)
-        msg.assertMleMessageContainsTlv(mle.LinkLayerFrameCounter)
-        msg.assertMleMessageContainsTlv(mle.Mode)
-        msg.assertMleMessageContainsTlv(mle.Response)
-        msg.assertMleMessageContainsTlv(mle.Timeout)
-        msg.assertMleMessageContainsTlv(mle.TlvRequest)
-        msg.assertMleMessageContainsTlv(mle.Version)
-        msg.assertMleMessageContainsOptionalTlv(mle.MleFrameCounter)
-        msg.assertSentToNode(self.nodes[REED])
-
-        msg = reed_messages.next_mle_message(mle.CommandType.CHILD_ID_RESPONSE)
-        msg.assertSentToNode(self.nodes[SED])
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_09_EDSynchronization.py b/third_party/openthread/repo/tests/scripts/thread-cert/Cert_6_1_09_EDSynchronization.py
deleted file mode 100755 (executable)
index 911576e..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (c) 2016, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-import unittest
-
-import thread_cert
-from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_LINK_REQUEST, MLE_LINK_ACCEPT, CHALLENGE_TLV, LEADER_DATA_TLV, SOURCE_ADDRESS_TLV, VERSION_TLV
-from pktverify.packet_verifier import PacketVerifier
-
-LEADER = 1
-ROUTER1 = 2
-ED = 3
-ROUTER2 = 4
-ROUTER3 = 5
-
-
-class Cert_6_1_9_EDSynchronization(thread_cert.TestCase):
-    TOPOLOGY = {
-        LEADER: {
-            'name': 'LEADER',
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'whitelist': [ROUTER1, ED, ROUTER2]
-        },
-        ROUTER1: {
-            'name': 'ROUTER_1',
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_selection_jitter': 1,
-            'whitelist': [LEADER, ED, ROUTER3]
-        },
-        ED: {
-            'name': 'ED',
-            'panid': 0xface,
-            'router_upgrade_threshold': 0,
-            'whitelist': [LEADER]
-        },
-        ROUTER2: {
-            'name': 'ROUTER_2',
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_selection_jitter': 1,
-            'whitelist': [LEADER, ED, ROUTER3]
-        },
-        ROUTER3: {
-            'name': 'ROUTER_3',
-            'mode': 'rsdn',
-            'panid': 0xface,
-            'router_selection_jitter': 1,
-            'whitelist': [ED, ROUTER1, ROUTER2]
-        },
-    }
-
-    def test(self):
-        self.nodes[LEADER].start()
-        self.simulator.go(3)
-        self.assertEqual(self.nodes[LEADER].get_state(), 'leader')
-
-        self.nodes[ROUTER1].start()
-        self.simulator.go(3)
-        self.assertEqual(self.nodes[ROUTER1].get_state(), 'router')
-
-        self.nodes[ROUTER2].start()
-        self.simulator.go(3)
-        self.assertEqual(self.nodes[ROUTER2].get_state(), 'router')
-
-        self.nodes[ROUTER3].start()
-        self.simulator.go(3)
-        self.assertEqual(self.nodes[ROUTER3].get_state(), 'router')
-
-        self.nodes[ED].start()
-        self.simulator.go(3)
-        self.assertEqual(self.nodes[ED].get_state(), 'child')
-
-        self.nodes[ED].add_whitelist(self.nodes[ROUTER1].get_addr64())
-        self.nodes[ED].add_whitelist(self.nodes[ROUTER2].get_addr64())
-        self.nodes[ED].add_whitelist(self.nodes[ROUTER3].get_addr64())
-        self.nodes[ED].enable_whitelist()
-        self.simulator.go(10)
-
-    def verify(self, pv):
-        pkts = pv.pkts
-        pv.summary.show()
-
-        LEADER = pv.vars['LEADER']
-        ED = pv.vars['ED']
-
-        # Step 3: The DUT MUST send a unicast Link Request
-        # to Router 1, Router 2 & Router 3
-        pkts.filter_wpan_src64(LEADER).filter_wpan_dst64(ED).filter_mle_cmd(MLE_CHILD_ID_RESPONSE).must_next()
-        for i in range(1, 3):
-            _pkts = pkts.copy()
-            _pkts.filter_wpan_src64(ED).filter_wpan_dst64(
-                pv.vars['ROUTER_%d' % i]).filter_mle_cmd(MLE_LINK_REQUEST).must_next().must_verify(
-                    lambda p: {CHALLENGE_TLV, LEADER_DATA_TLV, SOURCE_ADDRESS_TLV, VERSION_TLV} <= set(p.mle.tlv.type))
-
-            # Step 4: Router_1, Router_2 & Router_3 MUST all send a
-            # Link Accept message to the DUT
-            _pkts.filter_wpan_src64(pv.vars['ROUTER_%d' %
-                                            i]).filter_wpan_dst64(ED).filter_mle_cmd(MLE_LINK_ACCEPT).must_next()
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/aes_alt.h b/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/aes_alt.h
deleted file mode 100644 (file)
index fd6f5da..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2019 Nordic Semiconductor ASA
- *
- * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
- */
-
-/**@file
- * @addtogroup mbedtls_glue_aes
- * @{
- */
-#ifndef MBEDTLS_AES_ALT_H
-#define MBEDTLS_AES_ALT_H
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "../config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#define CC310_MBEDTLS_AES_CONTEXT_WORDS         (24)    //!< AES context size in words in nrf_cc310_mbedcrypto library.
-#define VANILLA_MBEDTLS_AES_CONTEXT_WORDS       (70)    //!< AES context size in words in standard mbed TLS.
-#define VANILLA_MBEDTLS_AES_XTS_CONTEXT_WORDS   (140)   //!< AES XTS context size in words in standard mbed TLS.
-
-#if defined(MBEDTLS_AES_ALT)
-
-#include <stdint.h>
-
-
-/** @brief Typedef of mbedcrypto AES glue context.
- */
-typedef struct mbedtls_aes_context
-{
-    union
-    {
-#if defined(CONFIG_CC310_MBEDTLS_AES_C)
-        uint32_t buffer_cc310[CC310_MBEDTLS_AES_CONTEXT_WORDS];                //!< Array the size of an AES context in the nrf_cc310_mbedcrypto library.
-#endif /* CONFIG_CC310_MBEDTLS_AES_C */
-#if defined(CONFIG_VANILLA_MBEDTLS_AES_C)
-        uint32_t buffer_vanilla_mbedtls[VANILLA_MBEDTLS_AES_CONTEXT_WORDS];    //!< Array the size of an AES context in vanilla mbed TLS.
-#endif /* CONFIG_VANILLA_MBEDTLS_AES_C */
-        uint32_t dummy;                                                        //!< Dummy value in case no backend is enabled.
-    } buffer;                                                                  //!< Union with size of the largest enabled backend context.
-    void* handle;   //!< Pointer to the function table in an initialized glue context.
-} mbedtls_aes_context;
-
-
-/** @brief Typedef of mbedcrypto glue AES XTS context
- */
-typedef struct mbedtls_aes_xts_context
-{
-    union
-    {
-#if defined(CONFIG_VANILLA_MBEDTLS_CIPHER_MODE_XTS)
-        uint32_t buffer_vanilla_mbedtls[VANILLA_MBEDTLS_AES_XTS_CONTEXT_WORDS];    //!< Array the size of the memory required for an AES XTS context in vanilla mbed TLS.
-#endif /* CONFIG_VANILLA_MBEDTLS_CIPHER_MODE_XTS */
-        uint32_t dummy;                                                            //!< Dummy value in case no backend is enabled.
-    } buffer;                                                                      //!< Array with length equal to the size of the largest enabled backend.
-    void* handle;   //!< Pointer to the function table in an initialized glue context.
-} mbedtls_aes_xts_context;
-
-#endif /* MBEDTLS_AES_ALT */
-
-#endif /* MBEDTLS_AES_ALT_H */
-
-/** @} */
diff --git a/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/cmac_alt.h b/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/cmac_alt.h
deleted file mode 100644 (file)
index 07e7168..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license
- */
-
-#ifndef MBEDTLS_CMAC_ALT_H
-#define MBEDTLS_CMAC_ALT_H
-
-#if defined(MBEDTLS_CONFIG_FILE)
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-
-
-#include <stddef.h>
-#include <stdint.h>
-
-#if defined(MBEDTLS_CMAC_ALT)
-
-/* hide internal implementation of the struct. Allocate enough space for it.*/
-#define MBEDTLS_CMAC_CONTEXT_SIZE_IN_WORDS          33
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief          CMAC cipher context structure
- */
-struct mbedtls_cmac_context_t{
-    /*! Internal buffer */
-    uint32_t buf[MBEDTLS_CMAC_CONTEXT_SIZE_IN_WORDS];
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* MBEDTLS_CMAC_ALT */
-
-#endif /* MBEDTLS_CMAC_ALT_H */
diff --git a/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/dhm_alt.h b/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include/mbedtls/dhm_alt.h
deleted file mode 100644 (file)
index 19967c9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license
- */
-
-#ifndef MBEDTLS_DHM_ALT_H
-#define MBEDTLS_DHM_ALT_H
-
-
-#if defined(MBEDTLS_DHM_ALT)
-
-
-#if defined(MBEDTLS_CONFIG_FILE)
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include <stddef.h>
-
-/*
- * DHM Error codes
- */
-#define MBEDTLS_ERR_DHM_BAD_INPUT_DATA                    -0x3080  /**< Bad input parameters. */
-#define MBEDTLS_ERR_DHM_READ_PARAMS_FAILED                -0x3100  /**< Reading of the DHM parameters failed. */
-#define MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED                -0x3180  /**< Making of the DHM parameters failed. */
-#define MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED                -0x3200  /**< Reading of the public values failed. */
-#define MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED                -0x3280  /**< Making of the public value failed. */
-#define MBEDTLS_ERR_DHM_CALC_SECRET_FAILED                -0x3300  /**< Calculation of the DHM secret failed. */
-#define MBEDTLS_ERR_DHM_INVALID_FORMAT                    -0x3380  /**< The ASN.1 data is not formatted correctly. */
-#define MBEDTLS_ERR_DHM_ALLOC_FAILED                      -0x3400  /**< Allocation of memory failed. */
-#define MBEDTLS_ERR_DHM_FILE_IO_ERROR                     -0x3480  /**< Read or write of file failed. */
-#define MBEDTLS_ERR_DHM_HW_ACCEL_FAILED                   -0x3500  /**< DHM hardware accelerator failed. */
-#define MBEDTLS_ERR_DHM_SET_GROUP_FAILED                  -0x3580  /**< Setting the modulus and generator failed. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief          The DHM context structure.
- */
-typedef struct
-{
-    size_t len;         /*!<  The size of \p P in Bytes. */
-    mbedtls_mpi P;      /*!<  The prime modulus. */
-    mbedtls_mpi G;      /*!<  The generator. */
-    mbedtls_mpi X;      /*!<  Our secret value. */
-    mbedtls_mpi GX;     /*!<  Our public key = \c G^X mod \c P. */
-    mbedtls_mpi GY;     /*!<  The public key of the peer = \c G^Y mod \c P. */
-    mbedtls_mpi K;      /*!<  The shared secret = \c G^(XY) mod \c P. */
-    mbedtls_mpi RP;     /*!<  The cached value = \c R^2 mod \c P. */
-    mbedtls_mpi Vi;     /*!<  The blinding value. */
-    mbedtls_mpi Vf;     /*!<  The unblinding value. */
-    mbedtls_mpi pX;     /*!<  The previous \c X. */
-}
-mbedtls_dhm_context;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* MBEDTLS_DHM_ALT  - use alternative code */
-#endif  /* MBEDTLS_DHM_ALT_H  - include only once  */
diff --git a/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_abort_freertos.c b/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_abort_freertos.c
deleted file mode 100644 (file)
index a948870..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (c) 2019 Nordic Semiconductor ASA
- *
- * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
- */
-#include <stdint.h>
-#include <stddef.h>
-
-#include "nrf_cc310_platform_abort.h"
-#include "FreeRTOS.h"
-
-/** @brief Definition of platform handle used during abort in FreeRTOS
- *
- * @note Currently not used
- */
-static nrf_cc310_platform_abort_handle_t platform_abort_handle;
-
-
-/** @brief Definition of abort function used for FreeRTOS
- */
-static void abort_function(char const * const reason)
-{
-    configASSERT(!reason);
-}
-
-
-/** @brief Definition of abort API to set in nrf_cc310_platform
- */
-static const nrf_cc310_platform_abort_apis_t apis =
-{
-    .abort_handle = &platform_abort_handle,
-    .abort_fn = abort_function
-};
-
-/** @brief Function to initialize the nrf_cc310_platform abort APIs.
- */
-void nrf_cc310_platform_abort_init(void)
-{
-    nrf_cc310_platform_set_abort(&apis);
-}
diff --git a/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_abort_zephyr.c b/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_abort_zephyr.c
deleted file mode 100644 (file)
index ec18630..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-
-/**
- * Copyright (c) 2019 Nordic Semiconductor ASA
- *
- * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
- */
-#include <kernel.h>
-#include <power/reboot.h>
-//#include <logging/log.h>
-//LOG_MODULE_DECLARE(cc310_platform);
-
-#include "nrf_cc310_platform_abort.h"
-
-
-/** @brief Definition of abort function used for Zephyr
- */
-static void abort_function(char const * const reason)
-{
-       //LOG_ERR("Reason: %s", reason);
-#ifdef CONFIG_REBOOT
-       //LOG_ERR("Rebooting");
-       sys_reboot(SYS_REBOOT_WARM);
-#else
-       //LOG_ERR("Halted");
-       while(1);
-#endif
-}
-
-
-/** @brief Definition of abort API to set in nrf_cc310_platform
- */
-static const nrf_cc310_platform_abort_apis_t apis =
-{
-       .abort_handle = NULL,
-       .abort_fn = abort_function,
-};
-
-/** @brief Function to initialize the nrf_cc310_platform abort APIs.
- */
-void nrf_cc310_platform_abort_init(void)
-{
-       nrf_cc310_platform_set_abort(&apis);
-}
diff --git a/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_mutex_freertos.c b/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_mutex_freertos.c
deleted file mode 100644 (file)
index 71961c1..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/**
- * Copyright (c) 2019 Nordic Semiconductor ASA
- *
- * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
- */
-#include <stdint.h>
-#include <stddef.h>
-
-#include "FreeRTOS.h"
-#include "semphr.h"
-
-#include "nrf_cc310_platform_defines.h"
-#include "nrf_cc310_platform_mutex.h"
-
-
-/** @brief external reference to the cc310 platform mutex APIs*/
-extern nrf_cc310_platform_mutex_apis_t  platform_mutex_apis;
-
-/** @brief Definition of mutex for symmetric cryptography
- */
-static SemaphoreHandle_t sym_mutex_int;
-
-/** @brief Definition of mutex for asymmetric cryptography
- */
-static SemaphoreHandle_t asym_mutex_int;
-
-/** @brief Definition of mutex for random number generation
- */
-static SemaphoreHandle_t rng_mutex_int;
-
-/** @brief Definition of mutex for power management changes
- */
-static SemaphoreHandle_t power_mutex_int;
-
-
-/**@brief Definition of RTOS-independent symmetric cryptography mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t sym_mutex =
-{
-    .mutex = &sym_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-/**@brief Definition of RTOS-independent asymmetric cryptography mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t asym_mutex =
-{
-    .mutex = &asym_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-/**@brief Definition of RTOS-independent random number generation mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t rng_mutex =
-{
-    .mutex = &rng_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-/**@brief Definition of RTOS-independent power management mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t power_mutex =
-{
-    .mutex = &power_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-
-/** @brief Static function to unlock a mutex
- */
-static void mutex_init(nrf_cc310_platform_mutex_t *mutex)
-{
-    /* Ensure that the mutex is valid (not NULL) */
-    if (mutex == NULL) {
-        platform_abort_apis.abort_fn("mutex_init called with NULL parameter");
-    }
-
-    mutex->mutex = (void*)xSemaphoreCreateMutex();
-    if (mutex->mutex == NULL) {
-        platform_abort_apis.abort_fn("Could not create mutex!");
-    }
-
-    /* Set the mask to indicate that the mutex is valid */
-    mutex->flags |= NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID;
-}
-
-
-/** @brief Static function to free a mutex
- */
-static void mutex_free(nrf_cc310_platform_mutex_t *mutex)
-{
-    SemaphoreHandle_t p_mutex;
-
-    /* Ensure that the mutex is valid (not NULL) */
-    if (mutex == NULL) {
-        platform_abort_apis.abort_fn("mutex_free called with NULL parameter");
-    }
-
-    if (mutex->flags == NRF_CC310_PLATFORM_MUTEX_MASK_INVALID) {
-        /*Nothing to free*/
-        return;
-    }
-
-    p_mutex = (SemaphoreHandle_t)mutex->mutex;
-
-    vSemaphoreDelete(p_mutex);
-
-    /* Reset the mutex to invalid state */
-    mutex->flags = NRF_CC310_PLATFORM_MUTEX_MASK_INVALID;
-}
-
-
-/** @brief Static function to lock a mutex
- */
-static int mutex_lock(nrf_cc310_platform_mutex_t *mutex)
-{
-    int ret;
-    SemaphoreHandle_t p_mutex;
-
-    /* Ensure that the mutex is valid (not NULL) */
-    if (mutex == NULL) {
-        platform_abort_apis.abort_fn("mutex_lock called with NULL parameter");
-    }
-
-    /* Ensure that the mutex has been initialized */
-    if (mutex->flags == NRF_CC310_PLATFORM_MUTEX_MASK_INVALID) {
-        return NRF_CC310_PLATFORM_ERROR_MUTEX_NOT_INITIALIZED;
-    }
-
-    p_mutex = (SemaphoreHandle_t)mutex->mutex;
-
-    ret = xSemaphoreTake(p_mutex, portMAX_DELAY);
-    if (ret == pdTRUE) {
-        return NRF_CC310_PLATFORM_SUCCESS;
-    }
-    else {
-        return NRF_CC310_PLATFORM_ERROR_MUTEX_FAILED;
-    }
-}
-
-
-/** @brief Static function to unlock a mutex
- */
-static int mutex_unlock(nrf_cc310_platform_mutex_t * mutex)
-{
-    int ret;
-    SemaphoreHandle_t p_mutex;
-
-    /* Ensure that the mutex is valid (not NULL) */
-    if (mutex == NULL) {
-        platform_abort_apis.abort_fn("mutex_unlock called with NULL parameter");
-    }
-
-    /* Ensure that the mutex has been initialized */
-    if (mutex->flags == NRF_CC310_PLATFORM_MUTEX_MASK_INVALID) {
-        return NRF_CC310_PLATFORM_ERROR_MUTEX_NOT_INITIALIZED;
-    }
-
-    p_mutex = (SemaphoreHandle_t)mutex->mutex;
-
-    ret = xSemaphoreGive(p_mutex);
-    if (ret != pdTRUE) {
-        platform_abort_apis.abort_fn("Could not unlock mutex!");
-    }
-
-    return NRF_CC310_PLATFORM_SUCCESS;
-}
-
-
-/**@brief Constant definition of mutex APIs to set in nrf_cc310_platform
- */
-const nrf_cc310_platform_mutex_apis_t mutex_apis =
-{
-    .mutex_init_fn = mutex_init,
-    .mutex_free_fn = mutex_free,
-    .mutex_lock_fn = mutex_lock,
-    .mutex_unlock_fn = mutex_unlock
-};
-
-
-/** @brief Constant definition of mutexes to set in nrf_cc310_platform
- */
-const nrf_cc310_platform_mutexes_t mutexes =
-{
-    .sym_mutex = &sym_mutex,
-    .asym_mutex = &asym_mutex,
-    .rng_mutex = &rng_mutex,
-    .reserved = NULL,
-    .power_mutex = &power_mutex
-};
-
-/** @brief Function to initiialize the nrf_cc310_platform mutex APIs.
- */
-void nrf_cc310_platform_mutex_init(void)
-{
-    nrf_cc310_platform_set_mutexes(&mutex_apis, &mutexes);
-}
diff --git a/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_mutex_zephyr.c b/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/src/nrf_cc310_platform_mutex_zephyr.c
deleted file mode 100644 (file)
index 0f37e9b..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * Copyright (c) 2019 Nordic Semiconductor ASA
- *
- * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
- */
-#include <stdint.h>
-#include <stddef.h>
-#include <string.h>
-
-#include <zephyr.h>
-#include <kernel.h>
-
-#include "nrf_cc310_platform_defines.h"
-#include "nrf_cc310_platform_mutex.h"
-#include "nrf_cc310_platform_abort.h"
-
-/** @brief External reference to the platforms abort APIs
- *        This is used in case the mutex functions don't
- *                provide return values in their APIs.
- */
-extern nrf_cc310_platform_abort_apis_t platform_abort_apis;
-
-/** @brief Definition of mutex for symmetric cryptography
- */
-K_MUTEX_DEFINE(sym_mutex_int);
-
-/** @brief Definition of mutex for asymmetric cryptography
- */
-K_MUTEX_DEFINE(asym_mutex_int);
-
-/** @brief Definition of mutex for random number generation
-*/
-K_MUTEX_DEFINE(rng_mutex_int);
-
-/** @brief Definition of mutex for power mode changes
-*/
-K_MUTEX_DEFINE(power_mutex_int);
-
-/** @brief Arbritary number of mutexes the system suppors
- */
-#define NUM_MUTEXES 64
-
-/** @brief Structure definition of the mutex slab
- */
-struct k_mem_slab mutex_slab;
-
-/** @brief Definition of buffer used for the mutex slabs
- */
-char __aligned(4) mutex_slab_buffer[NUM_MUTEXES * sizeof(struct k_mutex)];
-
-/**@brief Definition of RTOS-independent symmetric cryptography mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t sym_mutex =
-{
-    .mutex = &sym_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-/**@brief Definition of RTOS-independent asymmetric cryptography mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t asym_mutex =
-{
-    .mutex = &asym_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-/**@brief Definition of RTOS-independent random number generation mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t rng_mutex =
-{
-    .mutex = &rng_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-/**@brief Definition of RTOS-independent power management mutex
- * with NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID set to indicate that
- * allocation is unneccesary
-*/
-nrf_cc310_platform_mutex_t power_mutex =
-{
-    .mutex = &power_mutex_int,
-    .flags = NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID
-};
-
-
-/**@brief static function to initialize a mutex
- */
-static void mutex_init(nrf_cc310_platform_mutex_t *mutex) {
-    int ret;
-    struct k_mutex * p_mutex;
-
-    /* Ensure that the mutex is valid (not NULL) */
-    if (mutex == NULL) {
-        platform_abort_apis.abort_fn(
-            "mutex_init called with NULL parameter");
-    }
-
-    /* Allocate if this has not been initialized statically */
-    if (mutex->flags == NRF_CC310_PLATFORM_MUTEX_MASK_INVALID &&
-        mutex->mutex == NULL) {
-        /* allocate some memory for the mute*/
-        ret = k_mem_slab_alloc(&mutex_slab, &mutex->mutex, K_FOREVER);
-        if(ret != 0 || mutex->mutex == NULL)
-        {
-            /* Allocation failed. Abort all operations */
-            platform_abort_apis.abort_fn(
-                "Could not allocate mutex before initializing");
-        }
-
-        memset(mutex->mutex, 0, sizeof(struct k_mutex));
-
-        /** Set a flag to ensure that mutex is deallocated by the freeing
-         * operation
-         */
-        mutex->flags |= NRF_CC310_PLATFORM_MUTEX_MASK_IS_ALLOCATED;
-    }
-
-    p_mutex = (struct k_mutex *)mutex->mutex;
-    k_mutex_init(p_mutex);
-
-    /* Set the mask to indicate that the mutex is valid */
-    mutex->flags |= NRF_CC310_PLATFORM_MUTEX_MASK_IS_VALID;
-}
-
-
-/** @brief Static function to free a mutex
- */
-static void mutex_free(nrf_cc310_platform_mutex_t *mutex) {
-    /* Ensure that the mutex is valid (not NULL) */
-    if (mutex == NULL) {
-        platform_abort_apis.abort_fn(
-            "mutex_init called with NULL parameter");
-    }
-
-    /* Check if we are freeing a mutex that isn't initialized */
-    if (mutex->flags == NRF_CC310_PLATFORM_MUTEX_MASK_INVALID) {
-        /*Nothing to free*/
-        return;
-    }
-
-    /* Check if the mutex was allocated or being statically defined */
-    if ((mutex->flags & NRF_CC310_PLATFORM_MUTEX_MASK_IS_ALLOCATED) == 0) {
-        k_mem_slab_free(&mutex_slab, mutex->mutex);
-        mutex->mutex = NULL;
-    }
-    else {
-        memset(mutex->mutex, 0, sizeof(struct k_mutex));
-    }
-
-    /* Reset the mutex to invalid state */
-    mutex->flags = NRF_CC310_PLATFORM_MUTEX_MASK_INVALID;
-}
-
-
-/** @brief Static function to lock a mutex
- */
-static int32_t mutex_lock(nrf_cc310_platform_mutex_t *mutex) {
-    int ret;
-    struct k_mutex * p_mutex;
-
-    /* Ensure that the mutex param is valid (not NULL) */
-    if(mutex == NULL) {
-        return NRF_CC310_PLATFORM_ERROR_PARAM_NULL;
-    }
-
-    /* Ensure that the mutex has been initialized */
-    if (mutex->flags == NRF_CC310_PLATFORM_MUTEX_MASK_INVALID) {
-        return NRF_CC310_PLATFORM_ERROR_MUTEX_NOT_INITIALIZED;
-    }
-
-    p_mutex = (struct k_mutex *)mutex->mutex;
-
-    ret = k_mutex_lock(p_mutex, K_FOREVER);
-    if (ret == 0) {
-        return NRF_CC310_PLATFORM_SUCCESS;
-    }
-    else {
-        return NRF_CC310_PLATFORM_ERROR_MUTEX_FAILED;
-    }
-}
-
-
-/** @brief Static function to unlock a mutex
- */
-static int32_t mutex_unlock(nrf_cc310_platform_mutex_t *mutex) {
-    struct k_mutex * p_mutex;
-
-    /* Ensure that the mutex param is valid (not NULL) */
-    if(mutex == NULL) {
-        return NRF_CC310_PLATFORM_ERROR_PARAM_NULL;
-    }
-
-    /* Ensure that the mutex has been initialized */
-    if (mutex->flags == NRF_CC310_PLATFORM_MUTEX_MASK_INVALID) {
-        return NRF_CC310_PLATFORM_ERROR_MUTEX_NOT_INITIALIZED;
-    }
-
-    p_mutex = (struct k_mutex *)mutex->mutex;
-
-    k_mutex_unlock(p_mutex);
-    return NRF_CC310_PLATFORM_SUCCESS;
-}
-
-
-/**@brief Constant definition of mutex APIs to set in nrf_cc310_platform
- */
-static const nrf_cc310_platform_mutex_apis_t mutex_apis =
-{
-    .mutex_init_fn = mutex_init,
-    .mutex_free_fn = mutex_free,
-    .mutex_lock_fn = mutex_lock,
-    .mutex_unlock_fn = mutex_unlock
-};
-
-
-/** @brief Constant definition of mutexes to set in nrf_cc310_platform
- */
-static const nrf_cc310_platform_mutexes_t mutexes =
-{
-    .sym_mutex = &sym_mutex,
-    .asym_mutex = &asym_mutex,
-    .rng_mutex = &rng_mutex,
-    .reserved  = NULL,
-    .power_mutex = &power_mutex,
-};
-
-/** @brief Function to initialize the nrf_cc310_platform mutex APIs
- */
-void nrf_cc310_platform_mutex_init(void)
-{
-    k_mem_slab_init(&mutex_slab,
-            mutex_slab_buffer,
-            sizeof(struct k_mutex),
-            NUM_MUTEXES);
-
-    nrf_cc310_platform_set_mutexes(&mutex_apis, &mutexes);
-}
diff --git a/third_party/openthread/repo/third_party/Qorvo/LICENSE.txt b/third_party/openthread/repo/third_party/Qorvo/LICENSE.txt
deleted file mode 100644 (file)
index 6e24ccb..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-
-Copyright (c) 2012-2016, GreenPeak Technologies
-Copyright (c) 2017-2019, Qorvo Inc
-
-This software is owned by Qorvo Inc
-and protected under applicable copyright laws.
-It is delivered under the terms of the license
-and is intended and supplied for use solely and
-exclusively with products manufactured by
-Qorvo Inc.
-
-THIS SOFTWARE IS PROVIDED IN AN "AS IS"
-CONDITION. NO WARRANTIES, WHETHER EXPRESS,
-IMPLIED OR STATUTORY, INCLUDING, BUT NOT
-LIMITED TO, IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-QORVO INC. SHALL NOT, IN ANY
-CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
-INCIDENTAL OR CONSEQUENTIAL DAMAGES,
-FOR ANY REASON WHATSOEVER.
diff --git a/third_party/openthread/repo/third_party/Qorvo/README.md b/third_party/openthread/repo/third_party/Qorvo/README.md
deleted file mode 100644 (file)
index 6cb98ff..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# Qorvo
-
-## Version
-
-0.8.0.0
-
-## License File
-
-[LICENSE](LICENSE.txt)
-
-## Description
-
-The gp712 folder contains library with the glue code to interface with the kernel drivers for linux based platforms containing the GP712.
-
-The qpg6095 folder contains library with the hal code for the QPG6095.
diff --git a/third_party/ot-br-posix/repo/.travis.yml b/third_party/ot-br-posix/repo/.travis.yml
deleted file mode 100644 (file)
index 85f96c0..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-language: python
-python: "3.6"
-
-dist: bionic
-os: linux
-
-cache:
-  directories:
-  - $HOME/.cache/tools
-
-before_install: ./tests/scripts/bootstrap.sh
-script: .travis/script.sh
-after_success:
-  - .travis/after_success.sh
-
-jobs:
-  include:
-    - env: BUILD_TARGET="docker-check" OTBR_COVERAGE=1 VERBOSE=1
-    - env: BUILD_TARGET="docker-check" OT_POSIX_CONFIG_RCP_BUS=SPI OTBR_COVERAGE=1 VERBOSE=1
-    - env: BUILD_TARGET="openwrt-check" VERBOSE=1
-    - env: BUILD_TARGET="meshcop" OTBR_COVERAGE=1 VERBOSE=1
-    - env: BUILD_TARGET="macOS"
-      os: osx
-      language: "generic"
diff --git a/third_party/ot-br-posix/repo/.travis/after_success.sh b/third_party/ot-br-posix/repo/.travis/after_success.sh
deleted file mode 100755 (executable)
index 9f64999..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-[ -n "$BUILD_TARGET" ] || exit 0
-
-set -e
-
-codecov_upload()
-{
-    curl -s https://codecov.io/bash >codecov
-    chmod a+x codecov
-
-    # Assume gcov by default, and llvm-cov if CC is clang
-    if [[ -z $CC ]]; then
-        ./codecov
-    elif "$CC" --version | grep -q gcc; then
-        ./codecov
-    elif "$CC" --version | grep -q clang; then
-        ./codecov -x "llvm-cov gcov"
-    fi
-}
-
-main()
-{
-    codecov_upload
-}
-
-main "$@"
diff --git a/third_party/ot-br-posix/repo/.travis/check-docker b/third_party/ot-br-posix/repo/.travis/check-docker
deleted file mode 100755 (executable)
index b2140b8..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/bash
-#
-#  Copyright (c) 2018, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-set -euxo pipefail
-
-readonly OT_POSIX_CONFIG_RCP_BUS=${OT_POSIX_CONFIG_RCP_BUS:-UART}
-
-on_exit()
-{
-    local status=$?
-
-    killall socat || true
-    docker stop "${OTBR_DOCKER_PID}" || true
-    killall ot-rcp || true
-    killall socat || true
-
-    return "${status}"
-}
-
-main()
-{
-    docker build -t otbr --build-arg OTBR_OPTIONS=-DOT_POSIX_CONFIG_RCP_BUS="${OT_POSIX_CONFIG_RCP_BUS}" -f etc/docker/Dockerfile .
-
-    # SPI simulation is not available yet, so just verify the binary runs
-    if [[ ${OT_POSIX_CONFIG_RCP_BUS} == SPI ]]; then
-        docker run --rm -it --entrypoint otbr-agent otbr -h | grep 'spi://'
-        return 0
-    fi
-
-    local -r SOCAT_OUTPUT=/tmp/ot-socat
-    socat -d -d pty,raw,echo=0 pty,raw,echo=0 >/dev/null 2>$SOCAT_OUTPUT &
-    while true; do
-        if test "$(head -n2 "$SOCAT_OUTPUT" | wc -l)" = 2; then
-            local -r DEVICE_PTY=$(head -n1 $SOCAT_OUTPUT | grep -o '/dev/.\+')
-            local -r DOCKER_PTY=$(head -n2 $SOCAT_OUTPUT | tail -n1 | grep -o '/dev/.\+')
-            break
-        fi
-        echo 'Waiting for socat ready...'
-        sleep 1
-    done
-
-    trap on_exit EXIT
-
-    # shellcheck disable=SC2094
-    ot-rcp 1 >"$DEVICE_PTY" <"$DEVICE_PTY" &
-
-    readonly OTBR_DOCKER_PID=$(docker run --rm -dit \
-        --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" \
-        --privileged -p 8080:80 --dns=127.0.0.1 --volume "$DOCKER_PTY":/dev/ttyUSB0 otbr)
-    sleep 10
-    sudo lsof -i :8080
-
-    local -r OTBR_WEB_URL="http://127.0.0.1:8080"
-    local -r OT_MASTER_KEY=00112233445566778899aabbccddeeff
-    local -r OT_XPANID=0011223344556677
-    local -r OT_PANID=0xface
-    local -r OT_AGENT_PASSPHRASE=123456
-    local -r OT_CHANNEL=12
-    local -r OT_NETWORK_NAME=OpenThreadDocker
-
-    curl "${OTBR_WEB_URL}"/index.html | grep 'What is OpenThread'
-    curl --header "Content-Type: application/json" --request POST --data "{\"masterKey\":\"${OT_MASTER_KEY}\",\"prefix\":\"fd11:22::\",\"defaultRoute\":true,\"extPanId\":\"${OT_XPANID}\",\"panId\":\"${OT_PANID}\",\"passphrase\":\"${OT_AGENT_PASSPHRASE}\",\"channel\":${OT_CHANNEL},\"networkName\":\"${OT_NETWORK_NAME}\"}" "${OTBR_WEB_URL}"/form_network | grep "success"
-}
-
-main "$@"
diff --git a/third_party/ot-br-posix/repo/.travis/script.sh b/third_party/ot-br-posix/repo/.travis/script.sh
deleted file mode 100755 (executable)
index 5432e6a..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-#
-#  Copyright (c) 2017, The OpenThread Authors.
-#  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. Neither the name of the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#  POSSIBILITY OF SUCH DAMAGE.
-#
-
-set -e
-set -x
-
-export PATH=/usr/local/bin:$PATH
-
-case $BUILD_TARGET in
-    meshcop)
-        ./script/bootstrap
-        ./script/test build
-
-        OT_CLI="ot-cli-mtd" ./script/test meshcop
-        OT_CLI="ot-cli-ftd" ./script/test meshcop
-        OTBR_USE_WEB_COMMISSIONER=1 ./script/test meshcop
-        ;;
-
-    openwrt-check)
-        ./script/test openwrt
-        ;;
-
-    docker-check)
-        .travis/check-docker
-        ;;
-
-    otbr-dbus-check)
-        .travis/check-otbr-dbus
-        ;;
-
-    macOS)
-        # On Travis, brew install fails when a package is already installed, so use reinstall here instead of ./script/bootstrap
-        brew unlink python@2 || true
-        brew reinstall boost cmake cpputest dbus jsoncpp ninja
-        OTBR_OPTIONS='-DOTBR_MDNS=OFF' ./script/test build
-        ;;
-    *)
-        false
-        ;;
-esac
diff --git a/third_party/pigweed/repo/pw_bloat/py/binary_diff.py b/third_party/pigweed/repo/pw_bloat/py/binary_diff.py
deleted file mode 100644 (file)
index 7512051..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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 binary_diff module defines a class which stores size diff information."""
-
-import collections
-import csv
-
-from typing import List, Generator, Type
-
-DiffSegment = collections.namedtuple(
-    'DiffSegment', ['name', 'before', 'after', 'delta', 'capacity'])
-FormattedDiff = collections.namedtuple('FormattedDiff',
-                                       ['segment', 'before', 'delta', 'after'])
-
-
-def format_integer(num: int, force_sign: bool = False) -> str:
-    """Formats a integer with commas."""
-    prefix = '+' if force_sign and num > 0 else ''
-    return '{}{:,}'.format(prefix, num)
-
-
-def format_percent(num: float, force_sign: bool = False) -> str:
-    """Formats a decimal ratio as a percentage."""
-    prefix = '+' if force_sign and num > 0 else ''
-    return '{}{:,.1f}%'.format(prefix, num * 100)
-
-
-class BinaryDiff:
-    """A size diff between two binary files."""
-    def __init__(self, label: str):
-        self.label = label
-        self._segments: collections.OrderedDict = collections.OrderedDict()
-
-    def add_segment(self, segment: DiffSegment):
-        """Adds a segment to the diff."""
-        self._segments[segment.name] = segment
-
-    def formatted_segments(self) -> Generator[FormattedDiff, None, None]:
-        """Yields each of the segments in this diff with formatted data."""
-
-        if not self._segments:
-            yield FormattedDiff('(all)', '(same)', '0', '(same)')
-            return
-
-        has_diff_segment = False
-
-        for segment in self._segments.values():
-            if segment.delta == 0:
-                continue
-
-            has_diff_segment = True
-            yield FormattedDiff(
-                segment.name,
-                format_integer(segment.before),
-                format_integer(segment.delta, force_sign=True),
-                format_integer(segment.after),
-            )
-
-        if not has_diff_segment:
-            yield FormattedDiff('(all)', '(same)', '0', '(same)')
-
-    @classmethod
-    def from_csv(cls: Type['BinaryDiff'], label: str,
-                 raw_csv: List[str]) -> 'BinaryDiff':
-        """Parses a BinaryDiff from bloaty's CSV output."""
-
-        diff = cls(label)
-        reader = csv.reader(raw_csv)
-        for row in reader:
-            diff.add_segment(
-                DiffSegment(row[0], int(row[5]), int(row[7]), int(row[1]),
-                            int(row[3])))
-
-        return diff
diff --git a/third_party/pigweed/repo/pw_bloat/py/bloat.py b/third_party/pigweed/repo/pw_bloat/py/bloat.py
deleted file mode 100755 (executable)
index 8302fcf..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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.
-"""
-bloat is a script which generates a size report card for binary files.
-"""
-
-import argparse
-import logging
-import os
-import subprocess
-import sys
-
-from typing import List, Iterable, Optional
-
-from binary_diff import BinaryDiff
-import bloat_output
-
-import pw_cli.log
-
-_LOG = logging.getLogger(__name__)
-
-
-def parse_args() -> argparse.Namespace:
-    """Parses the script's arguments."""
-    def delimited_list(delimiter: str, items: Optional[int] = None):
-        def _parser(arg: str):
-            args = arg.split(delimiter)
-
-            if items and len(args) != items:
-                raise argparse.ArgumentTypeError(
-                    'Argument must be a '
-                    f'{delimiter}-delimited list with {items} items: "{arg}"')
-
-            return args
-
-        return _parser
-
-    parser = argparse.ArgumentParser(
-        'Generate a size report card for binaries')
-    parser.add_argument('--bloaty-config',
-                        type=delimited_list(';'),
-                        required=True,
-                        help='Data source configuration for Bloaty')
-    parser.add_argument('--full',
-                        action='store_true',
-                        help='Display full bloat breakdown by symbol')
-    parser.add_argument('--labels',
-                        type=delimited_list(';'),
-                        default='',
-                        help='Labels for output binaries')
-    parser.add_argument('--out-dir',
-                        type=str,
-                        required=True,
-                        help='Directory in which to write output files')
-    parser.add_argument('--target',
-                        type=str,
-                        required=True,
-                        help='Build target name')
-    parser.add_argument('--title',
-                        type=str,
-                        default='pw_bloat',
-                        help='Report title')
-    parser.add_argument('--source-filter',
-                        type=str,
-                        help='Bloaty data source filter')
-    parser.add_argument('diff_targets',
-                        type=delimited_list(';', 2),
-                        nargs='+',
-                        metavar='DIFF_TARGET',
-                        help='Binary;base pairs to process')
-
-    return parser.parse_args()
-
-
-def run_bloaty(
-    filename: str,
-    config: str,
-    base_file: Optional[str] = None,
-    data_sources: Iterable[str] = (),
-    extra_args: Iterable[str] = ()
-) -> bytes:
-    """Executes a Bloaty size report on some binary file(s).
-
-    Args:
-        filename: Path to the binary.
-        config: Path to Bloaty config file.
-        base_file: Path to a base binary. If provided, a size diff is performed.
-        data_sources: List of Bloaty data sources for the report.
-        extra_args: Additional command-line arguments to pass to Bloaty.
-
-    Returns:
-        Binary output of the Bloaty invocation.
-
-    Raises:
-        subprocess.CalledProcessError: The Bloaty invocation failed.
-    """
-
-    # TODO(frolv): Point the default bloaty path to a prebuilt in Pigweed.
-    default_bloaty = 'bloaty'
-    bloaty_path = os.getenv('BLOATY_PATH', default_bloaty)
-
-    # yapf: disable
-    cmd = [
-        bloaty_path,
-        '-c', config,
-        '-d', ','.join(data_sources),
-        '--domain', 'vm',
-        filename,
-        *extra_args
-    ]
-    # yapf: enable
-
-    if base_file is not None:
-        cmd.extend(['--', base_file])
-
-    return subprocess.check_output(cmd)
-
-
-def main() -> int:
-    """Program entry point."""
-
-    args = parse_args()
-
-    base_binaries: List[str] = []
-    diff_binaries: List[str] = []
-
-    try:
-        for binary, base in args.diff_targets:
-            diff_binaries.append(binary)
-            base_binaries.append(base)
-    except RuntimeError as err:
-        _LOG.error('%s: %s', sys.argv[0], err)
-        return 1
-
-    data_sources = ['segment_names']
-    if args.full:
-        data_sources.append('fullsymbols')
-
-    # TODO(frolv): CSV output is disabled for full reports as the default Bloaty
-    # breakdown is printed. This script should be modified to print a custom
-    # symbol breakdown in full reports.
-    extra_args = [] if args.full else ['--csv']
-    if args.source_filter:
-        extra_args.extend(['--source-filter', args.source_filter])
-
-    diffs: List[BinaryDiff] = []
-    report = []
-
-    for i, binary in enumerate(diff_binaries):
-        binary_name = (args.labels[i]
-                       if i < len(args.labels) else os.path.basename(binary))
-        try:
-            output = run_bloaty(binary, args.bloaty_config[i],
-                                base_binaries[i], data_sources, extra_args)
-            if not output:
-                continue
-
-            # TODO(frolv): Remove when custom output for full mode is added.
-            if args.full:
-                report.append(binary_name)
-                report.append('-' * len(binary_name))
-                report.append(output.decode())
-                continue
-
-            # Ignore the first row as it displays column names.
-            bloaty_csv = output.decode().splitlines()[1:]
-            diffs.append(BinaryDiff.from_csv(binary_name, bloaty_csv))
-        except subprocess.CalledProcessError:
-            _LOG.error('%s: failed to run diff on %s', sys.argv[0], binary)
-            return 1
-
-    def write_file(filename: str, contents: str) -> None:
-        path = os.path.join(args.out_dir, filename)
-        with open(path, 'w') as output_file:
-            output_file.write(contents)
-        _LOG.debug('Output written to %s', path)
-
-    # TODO(frolv): Remove when custom output for full mode is added.
-    if not args.full:
-        out = bloat_output.TableOutput(args.title,
-                                       diffs,
-                                       charset=bloat_output.LineCharset)
-        report.append(out.diff())
-
-        rst = bloat_output.RstOutput(diffs)
-        write_file(f'{args.target}', rst.diff())
-
-    complete_output = '\n'.join(report) + '\n'
-    write_file(f'{args.target}.txt', complete_output)
-    print(complete_output)
-
-    return 0
-
-
-if __name__ == '__main__':
-    pw_cli.log.install()
-    sys.exit(main())
diff --git a/third_party/pigweed/repo/pw_bloat/py/bloat_output.py b/third_party/pigweed/repo/pw_bloat/py/bloat_output.py
deleted file mode 100644 (file)
index 569cb1f..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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.
-"""Module containing different output formatters for the bloat script."""
-
-import abc
-import enum
-from typing import Callable, Collection, Dict, List, Optional, Tuple, Type
-from typing import Union
-
-from binary_diff import BinaryDiff, FormattedDiff
-
-
-class Output(abc.ABC):
-    """An Output produces a size report card in a specific format."""
-    def __init__(self,
-                 title: Optional[str],
-                 diffs: Collection[BinaryDiff] = ()):
-        self._title = title
-        self._diffs = diffs
-
-    @abc.abstractmethod
-    def diff(self) -> str:
-        """Creates a report card for a size diff between binaries and a base."""
-
-    @abc.abstractmethod
-    def absolute(self) -> str:
-        """Creates a report card for the absolute size breakdown of binaries."""
-
-
-class AsciiCharset(enum.Enum):
-    """Set of ASCII characters for drawing tables."""
-    TL = '+'
-    TM = '+'
-    TR = '+'
-    ML = '+'
-    MM = '+'
-    MR = '+'
-    BL = '+'
-    BM = '+'
-    BR = '+'
-    V = '|'
-    H = '-'
-    HH = '='
-
-
-class LineCharset(enum.Enum):
-    """Set of line-drawing characters for tables."""
-    TL = '┌'
-    TM = '┬'
-    TR = '┐'
-    ML = '├'
-    MM = '┼'
-    MR = '┤'
-    BL = '└'
-    BM = '┴'
-    BR = '┘'
-    V = '│'
-    H = '─'
-    HH = '═'
-
-
-def identity(val: str) -> str:
-    """Returns a string unmodified."""
-    return val
-
-
-class TableOutput(Output):
-    """Tabular output."""
-
-    LABEL_COLUMN = 'Label'
-
-    def __init__(
-            self,
-            title: Optional[str],
-            diffs: Collection[BinaryDiff] = (),
-            charset: Union[Type[AsciiCharset],
-                           Type[LineCharset]] = AsciiCharset,
-            preprocess: Callable[[str], str] = identity,
-            # TODO(frolv): Make this a Literal type.
-            justify: str = 'rjust'):
-        self._cs = charset
-        self._preprocess = preprocess
-        self._justify = justify
-
-        super().__init__(title, diffs)
-
-    def diff(self) -> str:
-        """Build a tabular diff output showing binary size deltas."""
-
-        # Calculate the width of each column in the table.
-        max_label = len(self.LABEL_COLUMN)
-        column_widths = [len(field) for field in FormattedDiff._fields]
-
-        for diff in self._diffs:
-            max_label = max(max_label, len(diff.label))
-            for segment in diff.formatted_segments():
-                for i, val in enumerate(segment):
-                    val = self._preprocess(val)
-                    column_widths[i] = max(column_widths[i], len(val))
-
-        separators = self._row_separators([max_label] + column_widths)
-
-        def title_pad(string: str) -> str:
-            padding = (len(separators['top']) - len(string)) // 2
-            return ' ' * padding + string
-
-        titles = [
-            self._center_align(val.capitalize(), column_widths[i])
-            for i, val in enumerate(FormattedDiff._fields)
-        ]
-        column_names = [self._center_align(self.LABEL_COLUMN, max_label)
-                        ] + titles
-
-        rows: List[str] = []
-
-        if self._title is not None:
-            rows.extend([
-                title_pad(self._title),
-                title_pad(self._cs.H.value * len(self._title)),
-            ])
-
-        rows.extend([
-            separators['top'],
-            self._table_row(column_names),
-            separators['hdg'],
-        ])
-
-        for row, diff in enumerate(self._diffs):
-            subrows: List[str] = []
-
-            for segment in diff.formatted_segments():
-                subrow: List[str] = []
-                label = diff.label if not subrows else ''
-                subrow.append(getattr(label, self._justify)(max_label, ' '))
-                subrow.extend([
-                    getattr(self._preprocess(val),
-                            self._justify)(column_widths[i], ' ')
-                    for i, val in enumerate(segment)
-                ])
-                subrows.append(self._table_row(subrow))
-
-            rows.append('\n'.join(subrows))
-            rows.append(separators['bot' if row == len(self._diffs) -
-                                   1 else 'mid'])
-
-        return '\n'.join(rows)
-
-    def absolute(self) -> str:
-        return ''
-
-    def _row_separators(self, column_widths: List[int]) -> Dict[str, str]:
-        """Returns row separators for a table based on the character set."""
-
-        # Left, middle, and right characters for each of the separator rows.
-        top = (self._cs.TL.value, self._cs.TM.value, self._cs.TR.value)
-        mid = (self._cs.ML.value, self._cs.MM.value, self._cs.MR.value)
-        bot = (self._cs.BL.value, self._cs.BM.value, self._cs.BR.value)
-
-        def sep(chars: Tuple[str, str, str], heading: bool = False) -> str:
-            line = self._cs.HH.value if heading else self._cs.H.value
-            lines = [line * width for width in column_widths]
-            left = f'{chars[0]}{line}'
-            mid = f'{line}{chars[1]}{line}'.join(lines)
-            right = f'{line}{chars[2]}'
-            return f'{left}{mid}{right}'
-
-        return {
-            'top': sep(top),
-            'hdg': sep(mid, True),
-            'mid': sep(mid),
-            'bot': sep(bot),
-        }
-
-    def _table_row(self, vals: Collection[str]) -> str:
-        """Formats a row of the table with the selected character set."""
-        vert = self._cs.V.value
-        main = f' {vert} '.join(vals)
-        return f'{vert} {main} {vert}'
-
-    @staticmethod
-    def _center_align(val: str, width: int) -> str:
-        """Left and right pads a value with spaces to center within a width."""
-        space = width - len(val)
-        padding = ' ' * (space // 2)
-        extra = ' ' if space % 2 == 1 else ''
-        return f'{extra}{padding}{val}{padding}'
-
-
-class RstOutput(TableOutput):
-    """Tabular output in ASCII format, which is also valid RST."""
-    def __init__(self, diffs: Collection[BinaryDiff] = ()):
-        # Use RST line blocks within table cells to force each value to appear
-        # on a new line in the HTML output.
-        def add_rst_block(val: str) -> str:
-            return f'| {val}'
-
-        super().__init__(None,
-                         diffs,
-                         AsciiCharset,
-                         preprocess=add_rst_block,
-                         justify='ljust')
diff --git a/third_party/pigweed/repo/pw_bloat/py/no_bloaty.py b/third_party/pigweed/repo/pw_bloat/py/no_bloaty.py
deleted file mode 100644 (file)
index dbc50b9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Outputs a ReST message indicating that size reports don't work on Windows."""
-
-import os
-import sys
-
-_NO_BLOATY_ERROR: str = '''
-.. note::
-
-  The size reporting tool is not yet available on Windows systems.
-'''
-
-
-def main() -> int:
-    os.makedirs(os.path.dirname(sys.argv[1]), exist_ok=True)
-    with open(sys.argv[1], 'w') as fd:
-        fd.write(_NO_BLOATY_ERROR)
-    return 0
-
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/third_party/pigweed/repo/pw_bloat/py/no_toolchains.py b/third_party/pigweed/repo/pw_bloat/py/no_toolchains.py
deleted file mode 100644 (file)
index 3df6fe5..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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.
-"""Outputs a ReST warning about the size toolchains variable being empty."""
-
-import os
-import sys
-
-_NO_TOOLCHAIN_ERROR: str = '''
-.. warning::
-
-  The ``pw_size_report_toolchains`` build variable is empty for this target.
-  Size reports will not be generated.
-
-  See :ref:`bloat-howto` for details on how to set up size reports.
-'''
-
-
-def main() -> int:
-    os.makedirs(os.path.dirname(sys.argv[1]), exist_ok=True)
-    with open(sys.argv[1], 'w') as fd:
-        fd.write(_NO_TOOLCHAIN_ERROR)
-    return 0
-
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/third_party/pigweed/repo/pw_build/python_script.gni b/third_party/pigweed/repo/pw_build/python_script.gni
deleted file mode 100644 (file)
index 1af9464..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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.
-
-import("//build_overrides/pigweed.gni")
-
-# Defines an action to run a Python script.
-#
-# This wraps a regular Python script action with an invocation of a script-
-# runner script which resolves GN paths to filesystem paths and locates output
-# files for binary targets.
-#
-# The interface to this template is identical to that of a regular "action"
-# which runs a Python script, except for two key differences:
-#
-#   1. Regular GN actions typically require a call to rebase_path to resolve
-#      GN paths to filesystem paths. This template requires that all paths
-#      remain GN paths, but are made absolute.
-#
-#      This means that an "action" argument of the form:
-#
-#        rebase_path("my/relative/path:optional_target", root_build_dir)
-#
-#      Becomes:
-#
-#        get_path_info("my/relative/path:optional_target", "abspath")
-#
-#   2. The behavior of the runner script depends on whether a provided path is a
-#      regular build path or an output path (starting with "$root_out_dir").
-#      If an output path is provided and the path has a target, the script
-#      assumes that the target refers to a file built by Ninja and tries to
-#      locate it within the output directory.
-#
-# Additionally, this template can accept a boolean "stamp" argument. If set to
-# true, the script runner will touch a file to indicate the success of the run.
-# This is provided so that individual Python scripts are not required to define
-# an output file if they do not have one.
-#
-# Path resolution examples (assuming the build directory is //out):
-#
-#           BEFORE                     AFTER
-#
-#   //my_module              ../my_module
-#   //my_module:foo          ../my_module:foo
-#   //my_module/file.txt     ../my_module/file.txt
-#   $root_out_dir/my_module  ../out/obj/my_module
-#   $target_out_dir          ../out/obj/my_module      (in //my_module/BUILD.gn)
-#   $target_out_dir/out.json ../out/obj/my_module/out.json
-#   $target_out_dir:foo      ../out/obj/my_module/foo.elf  (toolchain-dependent)
-#   $target_out_dir:foo      ../out/obj/my_module/foo.exe  (toolchain-dependent)
-#
-# Arguments beyond normal action() target arguments:
-#
-#   module                  Used in place of the script argument to run the
-#                           provided Python module with `python -m` instead of a
-#                           script. Either script or module must be provided.
-#
-#   capture_output (=true)  If true, script output is hidden unless the script
-#                           fails with an error. Defaults to true.
-#
-#   stamp                   File to touch if the script is successful. If set to
-#                           true, a generic file is used. If false or not set,
-#                           no file is touched.
-#
-#   directory               The directory from which to execute the Python
-#                           script. Paths in args may need to be adjusted to be
-#                           relative to this directory.
-#
-#   environment             Environment variables to set, passed as a list of
-#                           NAME=VALUE strings.
-#
-template("pw_python_script") {
-  assert(defined(invoker.script) != defined(invoker.module),
-         "pw_python_script must have either a script or module to run, " +
-             "but not both")
-
-  _script_args = [
-    # GN root directory relative to the build directory (in which the runner
-    # script is invoked).
-    "--gn-root",
-    rebase_path("//"),
-
-    # Current directory, used to resolve relative paths.
-    "--current-path",
-    rebase_path("."),
-
-    "--default-toolchain=$default_toolchain",
-    "--current-toolchain=$current_toolchain",
-  ]
-
-  if (defined(invoker.directory)) {
-    _script_args += [
-      "--directory",
-      rebase_path(invoker.directory),
-    ]
-  }
-
-  if (defined(invoker.environment)) {
-    foreach(variable, invoker.environment) {
-      _script_args += [ "--env=$variable" ]
-    }
-  }
-
-  if (defined(invoker.inputs)) {
-    _inputs = invoker.inputs
-  } else {
-    _inputs = []
-  }
-
-  # List the script to run as an input so that the action is re-run when it is
-  # modified.
-  if (defined(invoker.script)) {
-    _inputs += [ invoker.script ]
-  }
-
-  if (defined(invoker.outputs)) {
-    _outputs = invoker.outputs
-  } else {
-    _outputs = []
-  }
-
-  # If a stamp file is requested, add it as an output of the runner script.
-  if (defined(invoker.stamp) && invoker.stamp != false) {
-    if (invoker.stamp == true) {
-      _stamp_file = "$target_gen_dir/$target_name.pw_pystamp"
-    } else {
-      _stamp_file = invoker.stamp
-    }
-
-    _outputs += [ _stamp_file ]
-    _script_args += [
-      "--touch",
-      rebase_path(_stamp_file),
-    ]
-  }
-
-  # Capture output or not.
-  # Note: capture defaults to true.
-  if (defined(invoker.capture_output)) {
-    forward_variables_from(invoker, [ "capture_output" ])
-  } else {
-    capture_output = true
-  }
-  if (capture_output) {
-    _script_args += [ "--capture-output" ]
-  }
-
-  if (defined(invoker.module)) {
-    _script_args += [
-      "--module",
-      invoker.module,
-    ]
-  }
-
-  # "--" indicates the end of arguments to the runner script.
-  # Everything beyond this point is interpreted as the command and arguments
-  # of the Python script to run.
-  _script_args += [ "--" ]
-
-  if (defined(invoker.script)) {
-    _script_args += [ rebase_path(invoker.script) ]
-  }
-
-  if (defined(invoker.args)) {
-    _script_args += invoker.args
-  }
-
-  if (defined(invoker._pw_action_foreach) && invoker._pw_action_foreach) {
-    _action_type = "action_foreach"
-  } else {
-    _action_type = "action"
-  }
-
-  target(_action_type, target_name) {
-    _ignore_vars = [
-      "script",
-      "args",
-      "inputs",
-      "outputs",
-    ]
-    forward_variables_from(invoker, "*", _ignore_vars)
-
-    script = "$dir_pw_build/py/pw_build/python_runner.py"
-    args = _script_args
-    inputs = _inputs
-    outputs = _outputs
-  }
-}
-
-# Runs pw_python_script once per file over a set of sources.
-#
-# This template brings pw_python_script's features to action_foreach. Usage is
-# the same as pw_python_script, except that sources must be provided and source
-# expansion (e.g. "{{source}}") may be used in args and outputs.
-#
-# See the pw_python_script and action_foreach documentation for full details.
-template("pw_python_script_foreach") {
-  assert(defined(invoker.sources) && invoker.sources != [],
-         "pw_python_script_foreach requires a list of one or more sources")
-
-  pw_python_script(target_name) {
-    if (defined(invoker.stamp) && invoker.stamp != false) {
-      if (invoker.stamp == true) {
-        # Use source file names in the generated stamp file path so they are
-        # unique for each source.
-        stamp = "$target_gen_dir/{{source_file_part}}.pw_pystamp"
-      } else {
-        stamp = invoker.stamp
-      }
-    } else {
-      stamp = false
-    }
-
-    forward_variables_from(invoker, "*", [ "stamp" ])
-
-    _pw_action_foreach = true
-  }
-}
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/BUILD b/third_party/pigweed/repo/pw_cpu_exception_armv7m/BUILD
deleted file mode 100644 (file)
index 453b448..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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.
-
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"])  # Apache License 2.0
-
-filegroup(
-    name = "pw_cpu_exception_armv7m",
-    srcs = [
-        "entry.cc",
-        "cpu_state.cc",
-        "proto_dump.cc",
-        "public/pw_cpu_exception_armv7m/cpu_state.h",
-        "public/pw_cpu_exception_armv7m/proto_dump.h",
-    ],
-)
-
-filegroup(
-    name = "pw_cpu_exception_armv7m_test",
-    srcs = ["exception_entry_test.cc"],
-)
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/BUILD.gn b/third_party/pigweed/repo/pw_cpu_exception_armv7m/BUILD.gn
deleted file mode 100644 (file)
index 5a97e57..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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.
-
-import("//build_overrides/pigweed.gni")
-
-import("$dir_pw_build/target_types.gni")
-import("$dir_pw_docgen/docs.gni")
-import("$dir_pw_protobuf_compiler/proto.gni")
-import("$dir_pw_unit_test/test.gni")
-
-config("default_config") {
-  include_dirs = [ "public" ]
-}
-
-pw_source_set("support") {
-  public_configs = [ ":default_config" ]
-  public_deps = [
-    "$dir_pw_cpu_exception:support_facade",
-    dir_pw_preprocessor,
-    dir_pw_string,
-  ]
-  deps = [ dir_pw_log ]
-  public = [ "public/pw_cpu_exception_armv7m/cpu_state.h" ]
-  sources = [ "cpu_state.cc" ]
-}
-
-pw_source_set("proto_dump") {
-  public_deps = [
-    ":support",
-    dir_pw_protobuf,
-    dir_pw_status,
-    dir_pw_stream,
-  ]
-  public = [ "public/pw_cpu_exception_armv7m/proto_dump.h" ]
-  deps = [ ":cpu_state_protos_pwpb" ]
-  sources = [ "proto_dump.cc" ]
-}
-
-pw_proto_library("cpu_state_protos") {
-  sources = [ "pw_cpu_exception_armv7m_protos/cpu_state.proto" ]
-}
-
-pw_source_set("pw_cpu_exception_armv7m") {
-  public_configs = [ ":default_config" ]
-  public_deps = [
-    ":proto_dump",
-    ":support",
-    "$dir_pw_cpu_exception:entry_facade",
-    "$dir_pw_cpu_exception:handler",
-    "$dir_pw_preprocessor",
-  ]
-  sources = [ "entry.cc" ]
-}
-
-pw_test_group("tests") {
-  tests = [ ":cpu_exception_entry_test" ]
-}
-
-pw_test("cpu_exception_entry_test") {
-  deps = [ ":pw_cpu_exception_armv7m" ]
-  sources = [ "exception_entry_test.cc" ]
-}
-
-pw_doc_group("docs") {
-  sources = [ "docs.rst" ]
-}
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/CMakeLists.txt b/third_party/pigweed/repo/pw_cpu_exception_armv7m/CMakeLists.txt
deleted file mode 100644 (file)
index 7f1bf23..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-
-pw_auto_add_simple_module(pw_cpu_exception_armv7m
-  IMPLEMENTS_FACADE
-    pw_cpu_exception
-)
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/cpu_state.cc b/third_party/pigweed/repo/pw_cpu_exception_armv7m/cpu_state.cc
deleted file mode 100644 (file)
index bec977e..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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 "pw_cpu_exception_armv7m/cpu_state.h"
-
-#include <cinttypes>
-#include <cstdint>
-#include <span>
-
-#include "pw_cpu_exception/support.h"
-#include "pw_log/log.h"
-#include "pw_string/string_builder.h"
-
-namespace pw::cpu_exception {
-
-std::span<const uint8_t> RawFaultingCpuState(
-    const pw_CpuExceptionState& cpu_state) {
-  return std::span(reinterpret_cast<const uint8_t*>(&cpu_state),
-                   sizeof(cpu_state));
-}
-
-// Using this function adds approximately 100 bytes to binary size.
-void ToString(const pw_CpuExceptionState& cpu_state,
-              const std::span<char>& dest) {
-  StringBuilder builder(dest);
-  const ArmV7mFaultRegisters& base = cpu_state.base;
-  const ArmV7mExtraRegisters& extended = cpu_state.extended;
-
-#define _PW_FORMAT_REGISTER(state_section, name) \
-  builder.Format("%s=0x%08" PRIx32 "\n", #name, state_section.name)
-
-  // Other registers.
-  _PW_FORMAT_REGISTER(base, pc);
-  _PW_FORMAT_REGISTER(base, lr);
-  _PW_FORMAT_REGISTER(base, psr);
-  _PW_FORMAT_REGISTER(extended, msp);
-  _PW_FORMAT_REGISTER(extended, psp);
-  _PW_FORMAT_REGISTER(extended, exc_return);
-  _PW_FORMAT_REGISTER(extended, cfsr);
-  _PW_FORMAT_REGISTER(extended, mmfar);
-  _PW_FORMAT_REGISTER(extended, bfar);
-  _PW_FORMAT_REGISTER(extended, icsr);
-  _PW_FORMAT_REGISTER(extended, hfsr);
-  _PW_FORMAT_REGISTER(extended, shcsr);
-  _PW_FORMAT_REGISTER(extended, control);
-
-  // General purpose registers.
-  _PW_FORMAT_REGISTER(base, r0);
-  _PW_FORMAT_REGISTER(base, r1);
-  _PW_FORMAT_REGISTER(base, r2);
-  _PW_FORMAT_REGISTER(base, r3);
-  _PW_FORMAT_REGISTER(extended, r4);
-  _PW_FORMAT_REGISTER(extended, r5);
-  _PW_FORMAT_REGISTER(extended, r6);
-  _PW_FORMAT_REGISTER(extended, r7);
-  _PW_FORMAT_REGISTER(extended, r8);
-  _PW_FORMAT_REGISTER(extended, r9);
-  _PW_FORMAT_REGISTER(extended, r10);
-  _PW_FORMAT_REGISTER(extended, r11);
-  _PW_FORMAT_REGISTER(base, r12);
-
-#undef _PW_FORMAT_REGISTER
-}
-
-// Using this function adds approximately 100 bytes to binary size.
-void LogCpuState(const pw_CpuExceptionState& cpu_state) {
-  const ArmV7mFaultRegisters& base = cpu_state.base;
-  const ArmV7mExtraRegisters& extended = cpu_state.extended;
-
-  PW_LOG_INFO("Captured CPU state:");
-
-#define _PW_LOG_REGISTER(state_section, name) \
-  PW_LOG_INFO("  %-10s 0x%08" PRIx32, #name, state_section.name)
-
-  // Other registers.
-  _PW_LOG_REGISTER(base, pc);
-  _PW_LOG_REGISTER(base, lr);
-  _PW_LOG_REGISTER(base, psr);
-  _PW_LOG_REGISTER(extended, msp);
-  _PW_LOG_REGISTER(extended, psp);
-  _PW_LOG_REGISTER(extended, exc_return);
-  _PW_LOG_REGISTER(extended, cfsr);
-  _PW_LOG_REGISTER(extended, mmfar);
-  _PW_LOG_REGISTER(extended, bfar);
-  _PW_LOG_REGISTER(extended, icsr);
-  _PW_LOG_REGISTER(extended, hfsr);
-  _PW_LOG_REGISTER(extended, shcsr);
-  _PW_LOG_REGISTER(extended, control);
-
-  // General purpose registers.
-  _PW_LOG_REGISTER(base, r0);
-  _PW_LOG_REGISTER(base, r1);
-  _PW_LOG_REGISTER(base, r2);
-  _PW_LOG_REGISTER(base, r3);
-  _PW_LOG_REGISTER(extended, r4);
-  _PW_LOG_REGISTER(extended, r5);
-  _PW_LOG_REGISTER(extended, r6);
-  _PW_LOG_REGISTER(extended, r7);
-  _PW_LOG_REGISTER(extended, r8);
-  _PW_LOG_REGISTER(extended, r9);
-  _PW_LOG_REGISTER(extended, r10);
-  _PW_LOG_REGISTER(extended, r11);
-  _PW_LOG_REGISTER(base, r12);
-
-#undef _PW_LOG_REGISTER
-}
-
-}  // namespace pw::cpu_exception
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/docs.rst b/third_party/pigweed/repo/pw_cpu_exception_armv7m/docs.rst
deleted file mode 100644 (file)
index 9c79720..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-.. _module-pw_cpu_exception_armv7m:
-
------------------------
-pw_cpu_exception_armv7m
------------------------
-This backend provides an ARMv7-M implementation for the CPU exception module
-frontend. See the CPU exception frontend module description for more
-information.
-
-Setup
-=====
-There are a few ways to set up the ARMv7-M exception handler so the
-application's exception handler is properly called during an exception.
-
-**1. Use existing CMSIS functions**
-  Inside of CMSIS fault handler functions, branch to ``pw_CpuExceptionEntry``.
-
-  .. code-block:: cpp
-
-    __attribute__((naked)) void HardFault_Handler(void) {
-    asm volatile(
-        " ldr r0, =pw_CpuExceptionEntry    \n"
-        " bx r0                            \n");
-    }
-
-**2. Modify a startup file**
-  Assembly startup files for some microcontrollers initialize the interrupt
-  vector table. The functions to call for fault handlers can be changed here.
-  For ARMv7-M, the fault handlers are indexes 3 to 6 of the interrupt vector
-  table. It's also may be helpful to redirect the NMI handler to the entry
-  function (if it's otherwise unused in your project).
-
-  Default:
-
-  .. code-block:: cpp
-
-    __isr_vector_table:
-      .word  __stack_start
-      .word  Reset_Handler
-      .word  NMI_Handler
-      .word  HardFault_Handler
-      .word  MemManage_Handler
-      .word  BusFault_Handler
-      .word  UsageFault_Handler
-
-  Using CPU exception module:
-
-  .. code-block:: cpp
-
-    __isr_vector_table:
-      .word  __stack_start
-      .word  Reset_Handler
-      .word  pw_CpuExceptionEntry
-      .word  pw_CpuExceptionEntry
-      .word  pw_CpuExceptionEntry
-      .word  pw_CpuExceptionEntry
-      .word  pw_CpuExceptionEntry
-
-  Note: ``__isr_vector_table`` and ``__stack_start`` are example names, and may
-  vary by platform. See your platform's assembly startup script.
-
-**3. Modify interrupt vector table at runtime**
-  Some applications may choose to modify their interrupt vector tables at
-  runtime. The ARMv7-M exception handler works with this use case (see the
-  exception_entry_test integration test), but keep in mind that your
-  application's exception handler will not be entered if an exception occurs
-  before the vector table entries are updated to point to
-  ``pw_CpuExceptionEntry``.
-
-Module Usage
-============
-For lightweight exception handlers that don't need to access
-architecture-specific registers, using the generic exception handler functions
-is preferred.
-
-However, some projects may need to explicitly access architecture-specific
-registers to attempt to recover from a CPU exception. ``pw_CpuExceptionState``
-provides access to the captured CPU state at the time of the fault. When the
-application-provided ``pw_CpuExceptionDefaultHandler()`` function returns, the
-CPU state is restored. This allows the exception handler to modify the captured
-state so that execution can safely continue.
-
-Expected Behavior
------------------
-In most cases, the CPU state captured by the exception handler will contain the
-ARMv7-M basic register frame in addition to an extended set of registers (see
-``cpu_state.h``). The exception to this is when the program stack pointer is in
-an MPU-protected or otherwise invalid memory region when the CPU attempts to
-push the exception register frame to it. In this situation, the PC, LR, and PSR
-registers will NOT be captured and will be marked with 0xFFFFFFFF to indicate
-they are invalid. This backend will still be able to capture all the other
-registers though.
-
-In the situation where the main stack pointer is in a memory protected or
-otherwise invalid region and fails to push CPU context, behavior is undefined.
-
-Nested Exceptions
------------------
-To enable nested fault handling:
-  1. Enable separate detection of usage/bus/memory faults via the SHCSR.
-  2. Decrease the priority of the memory, bus, and usage fault handlers. This
-     gives headroom for escalation.
-
-While this allows some faults to nest, it doesn't guarantee all will properly
-nest.
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/entry.cc b/third_party/pigweed/repo/pw_cpu_exception_armv7m/entry.cc
deleted file mode 100644 (file)
index 77d5c43..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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 "pw_cpu_exception/entry.h"
-
-#include <cstdint>
-#include <cstring>
-
-#include "pw_cpu_exception/handler.h"
-#include "pw_cpu_exception_armv7m/cpu_state.h"
-#include "pw_preprocessor/compiler.h"
-
-namespace pw::cpu_exception {
-namespace {
-
-// CMSIS/Cortex-M/ARMv7 related constants.
-// These values are from the ARMv7-M Architecture Reference Manual DDI 0403E.b.
-// https://static.docs.arm.com/ddi0403/e/DDI0403E_B_armv7m_arm.pdf
-
-// Masks for individual bits of CFSR. (ARMv7-M Section B3.2.15)
-constexpr uint32_t kMemFaultStart = 0x1u;
-constexpr uint32_t kMStkErrMask = kMemFaultStart << 4;
-constexpr uint32_t kBusFaultStart = 0x1u << 8;
-constexpr uint32_t kStkErrMask = kBusFaultStart << 4;
-
-// Bit masks for an exception return value. (ARMv7-M Section B1.5.8)
-constexpr uint32_t kExcReturnStackMask = (0x1u << 2);
-constexpr uint32_t kExcReturnBasicFrameMask = (0x1u << 4);
-
-// Memory mapped registers. (ARMv7-M Section B3.2.2, Table B3-4)
-volatile uint32_t& arm_v7m_cfsr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED28u);
-volatile uint32_t& arm_v7m_mmfar =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED34u);
-volatile uint32_t& arm_v7m_bfar =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED38u);
-volatile uint32_t& arm_v7m_icsr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED04u);
-volatile uint32_t& arm_v7m_hfsr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED2Cu);
-volatile uint32_t& arm_v7m_shcsr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED24u);
-
-// If the CPU fails to capture some registers, the captured struct members will
-// be populated with this value. The only registers that this value should be
-// loaded into are pc, lr, and psr when the CPU fails to push an exception
-// context frame.
-//
-// 0xFFFFFFFF is an illegal lr value, which is why it was selected for this
-// purpose. pc and psr values of 0xFFFFFFFF are dubious too, so this constant
-// is clear enough at expressing that the registers weren't properly captured.
-constexpr uint32_t kInvalidRegisterValue = 0xFFFFFFFF;
-
-// Checks exc_return in the captured CPU state to determine which stack pointer
-// was in use prior to entering the exception handler.
-bool PspWasActive(const pw_CpuExceptionState& cpu_state) {
-  return cpu_state.extended.exc_return & kExcReturnStackMask;
-}
-
-// Checks exc_return to determine if FPU state was pushed to the stack in
-// addition to the base CPU context frame.
-bool FpuStateWasPushed(const pw_CpuExceptionState& cpu_state) {
-  return !(cpu_state.extended.exc_return & kExcReturnBasicFrameMask);
-}
-
-// If the CPU successfully pushed context on exception, copy it into cpu_state.
-//
-// For more information see (See ARMv7-M Section B1.5.11, derived exceptions
-// on exception entry).
-void CloneBaseRegistersFromPsp(pw_CpuExceptionState* cpu_state) {
-  // If CPU succeeded in pushing context to PSP, copy it to the MSP.
-  if (!(cpu_state->extended.cfsr & kStkErrMask) &&
-      !(cpu_state->extended.cfsr & kMStkErrMask)) {
-    // TODO(amontanez): {r0-r3,r12} are captured in pw_CpuExceptionEntry(),
-    //                  so this only really needs to copy pc, lr, and psr. Could
-    //                  (possibly) improve speed, but would add marginally more
-    //                  complexity.
-    std::memcpy(&cpu_state->base,
-                reinterpret_cast<void*>(cpu_state->extended.psp),
-                sizeof(ArmV7mFaultRegisters));
-  } else {
-    // If CPU context wasn't pushed to stack on exception entry, we can't
-    // recover psr, lr, and pc from exception-time. Make these values clearly
-    // invalid.
-    cpu_state->base.lr = kInvalidRegisterValue;
-    cpu_state->base.pc = kInvalidRegisterValue;
-    cpu_state->base.psr = kInvalidRegisterValue;
-  }
-}
-
-// If the CPU successfully pushed context on exception, restore it from
-// cpu_state. Otherwise, don't attempt to restore state.
-//
-// For more information see (See ARMv7-M Section B1.5.11, derived exceptions
-// on exception entry).
-void RestoreBaseRegistersToPsp(pw_CpuExceptionState* cpu_state) {
-  // If CPU succeeded in pushing context to PSP on exception entry, restore the
-  // contents of cpu_state to the CPU-pushed register frame so the CPU can
-  // continue. Otherwise, don't attempt as we'll likely end up in an escalated
-  // hard fault.
-  if (!(cpu_state->extended.cfsr & kStkErrMask) &&
-      !(cpu_state->extended.cfsr & kMStkErrMask)) {
-    std::memcpy(reinterpret_cast<void*>(cpu_state->extended.psp),
-                &cpu_state->base,
-                sizeof(ArmV7mFaultRegisters));
-  }
-}
-
-// Determines the size of the CPU-pushed context frame.
-uint32_t CpuContextSize(const pw_CpuExceptionState& cpu_state) {
-  uint32_t cpu_context_size = sizeof(ArmV7mFaultRegisters);
-  if (FpuStateWasPushed(cpu_state)) {
-    cpu_context_size += sizeof(ArmV7mFaultRegistersFpu);
-  }
-  if (cpu_state.base.psr & kPsrExtraStackAlignBit) {
-    // Account for the extra 4-bytes the processor
-    // added to keep the stack pointer 8-byte aligned
-    cpu_context_size += 4;
-  }
-
-  return cpu_context_size;
-}
-
-// On exception entry, the Program Stack Pointer is patched to reflect the state
-// at exception-time. On exception return, it is restored to the appropriate
-// location. This calculates the delta that is used for these patch operations.
-uint32_t CalculatePspDelta(const pw_CpuExceptionState& cpu_state) {
-  // If CPU context was not pushed to program stack (because program stack
-  // wasn't in use, or an error occurred when pushing context), the PSP doesn't
-  // need to be shifted.
-  if (!PspWasActive(cpu_state) || (cpu_state.extended.cfsr & kStkErrMask) ||
-      (cpu_state.extended.cfsr & kMStkErrMask)) {
-    return 0;
-  }
-
-  return CpuContextSize(cpu_state);
-}
-
-// On exception entry, the Main Stack Pointer is patched to reflect the state
-// at exception-time. On exception return, it is restored to the appropriate
-// location. This calculates the delta that is used for these patch operations.
-uint32_t CalculateMspDelta(const pw_CpuExceptionState& cpu_state) {
-  if (PspWasActive(cpu_state)) {
-    // TODO(amontanez): Since FPU state isn't captured at this time, we ignore
-    //                  it when patching MSP. To add FPU capture support,
-    //                  delete this if block as CpuContextSize() will include
-    //                  FPU context size in the calculation.
-    return sizeof(ArmV7mFaultRegisters) + sizeof(ArmV7mExtraRegisters);
-  }
-
-  return CpuContextSize(cpu_state) + sizeof(ArmV7mExtraRegisters);
-}
-
-}  // namespace
-
-extern "C" {
-
-// Collect remaining CPU state (memory mapped registers), populate memory mapped
-// registers, and call application exception handler.
-PW_USED void pw_PackageAndHandleCpuException(pw_CpuExceptionState* cpu_state) {
-  // Capture memory mapped registers.
-  cpu_state->extended.cfsr = arm_v7m_cfsr;
-  cpu_state->extended.mmfar = arm_v7m_mmfar;
-  cpu_state->extended.bfar = arm_v7m_bfar;
-  cpu_state->extended.icsr = arm_v7m_icsr;
-  cpu_state->extended.hfsr = arm_v7m_hfsr;
-  cpu_state->extended.shcsr = arm_v7m_shcsr;
-
-  // CPU may have automatically pushed state to the program stack. If it did,
-  // the values can be copied into in the pw_CpuExceptionState struct that is
-  // passed to HandleCpuException(). The cpu_state passed to the handler is
-  // ALWAYS stored on the main stack (MSP).
-  if (PspWasActive(*cpu_state)) {
-    CloneBaseRegistersFromPsp(cpu_state);
-    // If PSP wasn't active, this delta is 0.
-    cpu_state->extended.psp += CalculatePspDelta(*cpu_state);
-  }
-
-  // Patch captured stack pointers so they reflect the state at exception time.
-  cpu_state->extended.msp += CalculateMspDelta(*cpu_state);
-
-  // Call application-level exception handler.
-  pw_HandleCpuException(cpu_state);
-
-  // Restore program stack pointer so exception return can restore state if
-  // needed.
-  // Note: The default behavior of NOT subtracting a delta from MSP is
-  // intentional. This simplifies the assembly to pop the exception state
-  // off the main stack on exception return (since MSP currently reflects
-  // exception-time state).
-  cpu_state->extended.psp -= CalculatePspDelta(*cpu_state);
-
-  // If PSP was active and the CPU pushed a context frame, we must copy the
-  // potentially modified state from cpu_state back to the PSP so the CPU can
-  // resume execution with the modified values.
-  if (PspWasActive(*cpu_state)) {
-    // In this case, there's no need to touch the MSP as it's at the location
-    // before we entering the exception (effectively popping the state initially
-    // pushed to the main stack).
-    RestoreBaseRegistersToPsp(cpu_state);
-  } else {
-    // Since we're restoring context from MSP, we DO need to adjust MSP to point
-    // to CPU-pushed context frame so it can be properly restored.
-    // No need to adjust PSP since nothing was pushed to program stack.
-    cpu_state->extended.msp -= CpuContextSize(*cpu_state);
-  }
-}
-
-// Captures faulting CPU state on the main stack (MSP), then calls the exception
-// handlers.
-// This function should be called immediately after an exception.
-void pw_CpuExceptionEntry(void) {
-  asm volatile(
-      // If PSP was in use at the time of exception, it's possible the CPU
-      // wasn't able to push CPU state. To be safe, this first captures scratch
-      // registers before moving forward.
-      //
-      // Stack flag is bit index 2 (0x4) of exc_return value stored in lr. When
-      // this bit is set, the Process Stack Pointer (PSP) was in use. Otherwise,
-      // the Main Stack Pointer (MSP) was in use. (See ARMv7-M Section B1.5.8
-      // for more details)
-      // The following block of assembly is equivalent to:
-      //   if (lr & (1 << 2)) {
-      //     msp -= sizeof(ArmV7mFaultRegisters);
-      //     ArmV7mFaultRegisters* state = (ArmV7mFaultRegisters*) msp;
-      //     state->r0 = r0;
-      //     state->r1 = r1;
-      //     state->r2 = r2;
-      //     state->r3 = r3;
-      //     state->r12 = r12;
-      //   }
-      //
-      " tst lr, #(1 << 2)                                     \n"
-      " itt ne                                                \n"
-      " subne sp, sp, %[base_state_size]                      \n"
-      " stmne sp, {r0-r3, r12}                                \n"
-
-      // Reserve stack space for additional registers. Since we're in exception
-      // handler mode, the main stack pointer is currently in use.
-      // r0 will temporarily store the end of captured_cpu_state to simplify
-      // assembly for copying additional registers.
-      " mrs r0, msp                                           \n"
-      " sub sp, sp, %[extra_state_size]                       \n"
-
-      // Store GPRs to stack.
-      " stmdb r0!, {r4-r11}                                   \n"
-
-      // Load special registers.
-      " mov r1, lr                                            \n"
-      " mrs r2, msp                                           \n"
-      " mrs r3, psp                                           \n"
-      " mrs r4, control                                       \n"
-
-      // Store special registers to stack.
-      " stmdb r0!, {r1-r4}                                    \n"
-
-      // Store a pointer to the beginning of special registers in r4 so they can
-      // be restored later.
-      " mov r4, r0                                            \n"
-
-      // Restore captured_cpu_state pointer to r0. This makes adding more
-      // memory mapped registers easier in the future since they're skipped in
-      // this assembly.
-      " mrs r0, msp                                           \n"
-
-      // Call intermediate handler that packages data.
-      " ldr r3, =pw_PackageAndHandleCpuException              \n"
-      " blx r3                                                \n"
-
-      // Restore state and exit exception handler.
-      // Pointer to saved CPU state was stored in r4.
-      " mov r0, r4                                            \n"
-
-      // Restore special registers.
-      " ldm r0!, {r1-r4}                                      \n"
-      " mov lr, r1                                            \n"
-      " msr control, r4                                       \n"
-
-      // Restore GPRs.
-      " ldm r0, {r4-r11}                                      \n"
-
-      // Restore stack pointers.
-      " msr msp, r2                                           \n"
-      " msr psp, r3                                           \n"
-
-      // Exit exception.
-      " bx lr                                                 \n"
-      // clang-format off
-      : /*output=*/
-      : /*input=*/[base_state_size]"i"(sizeof(ArmV7mFaultRegisters)),
-                  [extra_state_size]"i"(sizeof(ArmV7mExtraRegisters))
-      // clang-format on
-  );
-}
-
-}  // extern "C"
-}  // namespace pw::cpu_exception
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/exception_entry_test.cc b/third_party/pigweed/repo/pw_cpu_exception_armv7m/exception_entry_test.cc
deleted file mode 100644 (file)
index 7cf2226..0000000
+++ /dev/null
@@ -1,619 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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 <cstdint>
-#include <span>
-#include <type_traits>
-
-#include "gtest/gtest.h"
-#include "pw_cpu_exception/entry.h"
-#include "pw_cpu_exception/handler.h"
-#include "pw_cpu_exception/support.h"
-#include "pw_cpu_exception_armv7m/cpu_state.h"
-
-namespace pw::cpu_exception {
-namespace {
-
-// CMSIS/Cortex-M/ARMv7 related constants.
-// These values are from the ARMv7-M Architecture Reference Manual DDI 0403E.b.
-// https://static.docs.arm.com/ddi0403/e/DDI0403E_B_armv7m_arm.pdf
-
-// Exception ISR number. (ARMv7-M Section B1.5.2)
-constexpr uint32_t kHardFaultIsrNum = 0x3u;
-constexpr uint32_t kMemFaultIsrNum = 0x4u;
-constexpr uint32_t kBusFaultIsrNum = 0x5u;
-constexpr uint32_t kUsageFaultIsrNum = 0x6u;
-
-// Masks for individual bits of HFSR. (ARMv7-M Section B3.2.16)
-constexpr uint32_t kForcedHardfaultMask = 0x1u << 30;
-
-// Masks for individual bits of CFSR. (ARMv7-M Section B3.2.15)
-constexpr uint32_t kUsageFaultStart = 0x1u << 16;
-constexpr uint32_t kUnalignedFaultMask = kUsageFaultStart << 8;
-constexpr uint32_t kDivByZeroFaultMask = kUsageFaultStart << 9;
-
-// CCR flags. (ARMv7-M Section B3.2.8)
-constexpr uint32_t kUnalignedTrapEnableMask = 0x1u << 3;
-constexpr uint32_t kDivByZeroTrapEnableMask = 0x1u << 4;
-
-// Masks for individual bits of SHCSR. (ARMv7-M Section B3.2.13)
-constexpr uint32_t kMemFaultEnableMask = 0x1 << 16;
-constexpr uint32_t kBusFaultEnableMask = 0x1 << 17;
-constexpr uint32_t kUsageFaultEnableMask = 0x1 << 18;
-
-// Bit masks for an exception return value. (ARMv7-M Section B1.5.8)
-constexpr uint32_t kExcReturnBasicFrameMask = (0x1u << 4);
-
-// CPCAR mask that enables FPU. (ARMv7-M Section B3.2.20)
-constexpr uint32_t kFpuEnableMask = (0xFu << 20);
-
-// Memory mapped registers. (ARMv7-M Section B3.2.2, Table B3-4)
-volatile uint32_t& arm_v7m_vtor =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED08u);
-volatile uint32_t& arm_v7m_ccr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED14u);
-volatile uint32_t& arm_v7m_shcsr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED24u);
-volatile uint32_t& arm_v7m_cfsr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED28u);
-volatile uint32_t& arm_v7m_hfsr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED2Cu);
-volatile uint32_t& arm_v7m_cpacr =
-    *reinterpret_cast<volatile uint32_t*>(0xE000ED88u);
-
-// Begin a critical section that must not be interrupted.
-// This function disables interrupts to prevent any sort of context switch until
-// the critical section ends. This is done by setting PRIMASK to 1 using the cps
-// instruction.
-//
-// Returns the state of PRIMASK before it was disabled.
-inline uint32_t BeginCriticalSection() {
-  uint32_t previous_state;
-  asm volatile(
-      " mrs %[previous_state], primask              \n"
-      " cpsid i                                     \n"
-      // clang-format off
-      : /*output=*/[previous_state]"=r"(previous_state)
-      : /*input=*/
-      : /*clobbers=*/"memory"
-      // clang-format on
-  );
-  return previous_state;
-}
-
-// Ends a critical section.
-// Restore previous previous state produced by BeginCriticalSection().
-// Note: This does not always re-enable interrupts.
-inline void EndCriticalSection(uint32_t previous_state) {
-  asm volatile(
-      // clang-format off
-      "msr primask, %0"
-      : /*output=*/
-      : /*input=*/"r"(previous_state)
-      : /*clobbers=*/"memory"
-      // clang-format on
-  );
-}
-
-void EnableFpu() {
-#if defined(PW_ARMV7M_ENABLE_FPU) && PW_ARMV7M_ENABLE_FPU == 1
-  // TODO(pwbug/17): Replace when Pigweed config system is added.
-  arm_v7m_cpacr |= kFpuEnableMask;
-#endif  // defined(PW_ARMV7M_ENABLE_FPU) && PW_ARMV7M_ENABLE_FPU == 1
-}
-
-void DisableFpu() {
-#if defined(PW_ARMV7M_ENABLE_FPU) && PW_ARMV7M_ENABLE_FPU == 1
-  // TODO(pwbug/17): Replace when Pigweed config system is added.
-  arm_v7m_cpacr &= ~kFpuEnableMask;
-#endif  // defined(PW_ARMV7M_ENABLE_FPU) && PW_ARMV7M_ENABLE_FPU == 1
-}
-
-// Counter that is incremented if the test's exception handler correctly handles
-// a triggered exception.
-size_t exceptions_handled = 0;
-
-// Global variable that triggers a single nested fault on a fault.
-bool trigger_nested_fault = false;
-
-// Allow up to kMaxFaultDepth faults before determining the device is
-// unrecoverable.
-constexpr size_t kMaxFaultDepth = 2;
-
-// Variable to prevent more than kMaxFaultDepth nested crashes.
-size_t current_fault_depth = 0;
-
-// Faulting pw_CpuExceptionState is copied here so values can be validated after
-// exiting exception handler.
-pw_CpuExceptionState captured_states[kMaxFaultDepth] = {};
-pw_CpuExceptionState& captured_state = captured_states[0];
-
-// Flag used to check if the contents of std::span matches the captured state.
-bool span_matches = false;
-
-// Variable to be manipulated by function that uses floating
-// point to test that exceptions push Fpu state correctly.
-// Note: don't use double because a cortex-m4f with fpv4-sp-d16
-// will result in gcc generating code to use the software floating
-// point support for double.
-volatile float float_test_value;
-
-// Magic pattern to help identify if the exception handler's
-// pw_CpuExceptionState pointer was pointing to captured CPU state that was
-// pushed onto the stack when the faulting context uses the VFP. Has to be
-// computed at runtime because it uses values only available at link time.
-const float kFloatTestPattern = 12.345f * 67.89f;
-
-volatile float fpu_lhs_val = 12.345f;
-volatile float fpu_rhs_val = 67.89f;
-
-// This macro provides a calculation that equals kFloatTestPattern.
-#define _PW_TEST_FPU_OPERATION (fpu_lhs_val * fpu_rhs_val)
-
-// Magic pattern to help identify if the exception handler's
-// pw_CpuExceptionState pointer was pointing to captured CPU state that was
-// pushed onto the stack.
-constexpr uint32_t kMagicPattern = 0xDEADBEEF;
-
-// This pattern serves a purpose similar to kMagicPattern, but is used for
-// testing a nested fault to ensure both pw_CpuExceptionState objects are
-// correctly captured.
-constexpr uint32_t kNestedMagicPattern = 0x900DF00D;
-
-// The manually captured PC won't be the exact same as the faulting PC. This is
-// the maximum tolerated distance between the two to allow the test to pass.
-constexpr int32_t kMaxPcDistance = 4;
-
-// In-memory interrupt service routine vector table.
-using InterruptVectorTable = std::aligned_storage_t<512, 512>;
-InterruptVectorTable ram_vector_table;
-
-// Forward declaration of the exception handler.
-void TestingExceptionHandler(pw_CpuExceptionState*);
-
-// Populate the device's registers with testable values, then trigger exception.
-void BeginBaseFaultTest() {
-  // Make sure divide by zero causes a fault.
-  arm_v7m_ccr |= kDivByZeroTrapEnableMask;
-  uint32_t magic = kMagicPattern;
-  asm volatile(
-      " mov r0, %[magic]                                      \n"
-      " mov r1, #0                                            \n"
-      " mov r2, pc                                            \n"
-      " mov r3, lr                                            \n"
-      // This instruction divides by zero.
-      " udiv r1, r1, r1                                       \n"
-      // clang-format off
-      : /*output=*/
-      : /*input=*/[magic]"r"(magic)
-      : /*clobbers=*/"r0", "r1", "r2", "r3"
-      // clang-format on
-  );
-
-  // Check that the stack align bit was not set.
-  EXPECT_EQ(captured_state.base.psr & kPsrExtraStackAlignBit, 0u);
-}
-
-// Populate the device's registers with testable values, then trigger exception.
-void BeginNestedFaultTest() {
-  // Make sure divide by zero causes a fault.
-  arm_v7m_ccr |= kUnalignedTrapEnableMask;
-  volatile uint32_t magic = kNestedMagicPattern;
-  asm volatile(
-      " mov r0, %[magic]                                      \n"
-      " mov r1, #0                                            \n"
-      " mov r2, pc                                            \n"
-      " mov r3, lr                                            \n"
-      // This instruction does an unaligned read.
-      " ldrh r1, [%[magic_addr], 1]                           \n"
-      // clang-format off
-      : /*output=*/
-      : /*input=*/[magic]"r"(magic), [magic_addr]"r"(&magic)
-      : /*clobbers=*/"r0", "r1", "r2", "r3"
-      // clang-format on
-  );
-}
-
-// Populate the device's registers with testable values, then trigger exception.
-// This version causes stack to not be 4-byte aligned initially, testing
-// the fault handlers correction for psp.
-void BeginBaseFaultUnalignedStackTest() {
-  // Make sure divide by zero causes a fault.
-  arm_v7m_ccr |= kDivByZeroTrapEnableMask;
-  uint32_t magic = kMagicPattern;
-  asm volatile(
-      // Push one register to cause $sp to be no longer 8-byte aligned,
-      // assuming it started 8-byte aligned as expected.
-      " push {r0}                                             \n"
-      " mov r0, %[magic]                                      \n"
-      " mov r1, #0                                            \n"
-      " mov r2, pc                                            \n"
-      " mov r3, lr                                            \n"
-      // This instruction divides by zero. Our fault handler should
-      // ultimately advance the pc to the pop instruction.
-      " udiv r1, r1, r1                                       \n"
-      " pop {r0}                                              \n"
-      // clang-format off
-      : /*output=*/
-      : /*input=*/[magic]"r"(magic)
-      : /*clobbers=*/"r0", "r1", "r2", "r3"
-      // clang-format on
-  );
-
-  // Check that the stack align bit was set.
-  EXPECT_EQ(captured_state.base.psr & kPsrExtraStackAlignBit,
-            kPsrExtraStackAlignBit);
-}
-
-// Populate some of the extended set of captured registers, then trigger
-// exception.
-void BeginExtendedFaultTest() {
-  // Make sure divide by zero causes a fault.
-  arm_v7m_ccr |= kDivByZeroTrapEnableMask;
-  uint32_t magic = kMagicPattern;
-  volatile uint32_t local_msp = 0;
-  volatile uint32_t local_psp = 0;
-  asm volatile(
-      " mov r4, %[magic]                                      \n"
-      " mov r5, #0                                            \n"
-      " mov r11, %[magic]                                     \n"
-      " mrs %[local_msp], msp                                 \n"
-      " mrs %[local_psp], psp                                 \n"
-      // This instruction divides by zero.
-      " udiv r5, r5, r5                                       \n"
-      // clang-format off
-      : /*output=*/[local_msp]"=r"(local_msp), [local_psp]"=r"(local_psp)
-      : /*input=*/[magic]"r"(magic)
-      : /*clobbers=*/"r4", "r5", "r11", "memory"
-      // clang-format on
-  );
-
-  // Check that the stack align bit was not set.
-  EXPECT_EQ(captured_state.base.psr & kPsrExtraStackAlignBit, 0u);
-
-  // Check that the captured stack pointers matched the ones in the context of
-  // the fault.
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.extended.msp), local_msp);
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.extended.psp), local_psp);
-}
-
-// Populate some of the extended set of captured registers, then trigger
-// exception.
-// This version causes stack to not be 4-byte aligned initially, testing
-// the fault handlers correction for psp.
-void BeginExtendedFaultUnalignedStackTest() {
-  // Make sure divide by zero causes a fault.
-  arm_v7m_ccr |= kDivByZeroTrapEnableMask;
-  uint32_t magic = kMagicPattern;
-  volatile uint32_t local_msp = 0;
-  volatile uint32_t local_psp = 0;
-  asm volatile(
-      // Push one register to cause $sp to be no longer 8-byte aligned,
-      // assuming it started 8-byte aligned as expected.
-      " push {r0}                                             \n"
-      " mov r4, %[magic]                                      \n"
-      " mov r5, #0                                            \n"
-      " mov r11, %[magic]                                     \n"
-      " mrs %[local_msp], msp                                 \n"
-      " mrs %[local_psp], psp                                 \n"
-      // This instruction divides by zero. Our fault handler should
-      // ultimately advance the pc to the pop instruction.
-      " udiv r5, r5, r5                                       \n"
-      " pop {r0}                                              \n"
-      // clang-format off
-      : /*output=*/[local_msp]"=r"(local_msp), [local_psp]"=r"(local_psp)
-      : /*input=*/[magic]"r"(magic)
-      : /*clobbers=*/"r4", "r5", "r11", "memory"
-      // clang-format on
-  );
-
-  // Check that the stack align bit was set.
-  EXPECT_EQ(captured_state.base.psr & kPsrExtraStackAlignBit,
-            kPsrExtraStackAlignBit);
-
-  // Check that the captured stack pointers matched the ones in the context of
-  // the fault.
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.extended.msp), local_msp);
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.extended.psp), local_psp);
-}
-
-void InstallVectorTableEntries() {
-  uint32_t prev_state = BeginCriticalSection();
-  // If vector table is installed already, this is done.
-  if (arm_v7m_vtor == reinterpret_cast<uint32_t>(&ram_vector_table)) {
-    EndCriticalSection(prev_state);
-    return;
-  }
-  // Copy table to new location since it's not guaranteed that we can write to
-  // the original one.
-  std::memcpy(&ram_vector_table,
-              reinterpret_cast<uint32_t*>(arm_v7m_vtor),
-              sizeof(ram_vector_table));
-
-  // Override exception handling vector table entries.
-  uint32_t* exception_entry_addr =
-      reinterpret_cast<uint32_t*>(pw_CpuExceptionEntry);
-  uint32_t** interrupts = reinterpret_cast<uint32_t**>(&ram_vector_table);
-  interrupts[kHardFaultIsrNum] = exception_entry_addr;
-  interrupts[kMemFaultIsrNum] = exception_entry_addr;
-  interrupts[kBusFaultIsrNum] = exception_entry_addr;
-  interrupts[kUsageFaultIsrNum] = exception_entry_addr;
-
-  uint32_t old_vector_table = arm_v7m_vtor;
-  // Dismiss unused variable warning for non-debug builds.
-  PW_UNUSED(old_vector_table);
-
-  // Update Vector Table Offset Register (VTOR) to point to new vector table.
-  arm_v7m_vtor = reinterpret_cast<uint32_t>(&ram_vector_table);
-  EndCriticalSection(prev_state);
-}
-
-void EnableAllFaultHandlers() {
-  arm_v7m_shcsr |=
-      kMemFaultEnableMask | kBusFaultEnableMask | kUsageFaultEnableMask;
-}
-
-void Setup(bool use_fpu) {
-  if (use_fpu) {
-    EnableFpu();
-  } else {
-    DisableFpu();
-  }
-  pw_CpuExceptionSetHandler(TestingExceptionHandler);
-  EnableAllFaultHandlers();
-  InstallVectorTableEntries();
-  exceptions_handled = 0;
-  current_fault_depth = 0;
-  captured_state = {};
-  float_test_value = 0.0f;
-  trigger_nested_fault = false;
-}
-
-TEST(FaultEntry, BasicFault) {
-  Setup(/*use_fpu=*/false);
-  BeginBaseFaultTest();
-  ASSERT_EQ(exceptions_handled, 1u);
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.base.r0), kMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.base.r1), 0u);
-  // PC is manually saved in r2 before the exception occurs (where PC is also
-  // stored). Ensure these numbers are within a reasonable distance.
-  int32_t captured_pc_distance =
-      captured_state.base.pc - captured_state.base.r2;
-  EXPECT_LT(captured_pc_distance, kMaxPcDistance);
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.base.r3),
-            static_cast<uint32_t>(captured_state.base.lr));
-}
-
-TEST(FaultEntry, BasicUnalignedStackFault) {
-  Setup(/*use_fpu=*/false);
-  BeginBaseFaultUnalignedStackTest();
-  ASSERT_EQ(exceptions_handled, 1u);
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.base.r0), kMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.base.r1), 0u);
-  // PC is manually saved in r2 before the exception occurs (where PC is also
-  // stored). Ensure these numbers are within a reasonable distance.
-  int32_t captured_pc_distance =
-      captured_state.base.pc - captured_state.base.r2;
-  EXPECT_LT(captured_pc_distance, kMaxPcDistance);
-  EXPECT_EQ(static_cast<uint32_t>(captured_state.base.r3),
-            static_cast<uint32_t>(captured_state.base.lr));
-}
-
-TEST(FaultEntry, ExtendedFault) {
-  Setup(/*use_fpu=*/false);
-  BeginExtendedFaultTest();
-  ASSERT_EQ(exceptions_handled, 1u);
-  ASSERT_TRUE(span_matches);
-  const ArmV7mExtraRegisters& extended_registers = captured_state.extended;
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r4), kMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r5), 0u);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r11), kMagicPattern);
-
-  // Check expected values for this crash.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.cfsr),
-            static_cast<uint32_t>(kDivByZeroFaultMask));
-  EXPECT_EQ((extended_registers.icsr & 0x1FFu), kUsageFaultIsrNum);
-}
-
-TEST(FaultEntry, ExtendedUnalignedStackFault) {
-  Setup(/*use_fpu=*/false);
-  BeginExtendedFaultUnalignedStackTest();
-  ASSERT_EQ(exceptions_handled, 1u);
-  ASSERT_TRUE(span_matches);
-  const ArmV7mExtraRegisters& extended_registers = captured_state.extended;
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r4), kMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r5), 0u);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r11), kMagicPattern);
-
-  // Check expected values for this crash.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.cfsr),
-            static_cast<uint32_t>(kDivByZeroFaultMask));
-  EXPECT_EQ((extended_registers.icsr & 0x1FFu), kUsageFaultIsrNum);
-}
-
-TEST(FaultEntry, NestedFault) {
-  // Due to the way nesting is handled, captured_states[0] is the nested fault
-  // since that fault must be handled *FIRST*. After that fault is handled, the
-  // original fault can be correctly handled afterwards (captured into
-  // captured_states[1]).
-
-  Setup(/*use_fpu=*/false);
-  trigger_nested_fault = true;
-  BeginBaseFaultTest();
-  ASSERT_EQ(exceptions_handled, 2u);
-
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(captured_states[1].base.r0), kMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(captured_states[1].base.r1), 0u);
-  // PC is manually saved in r2 before the exception occurs (where PC is also
-  // stored). Ensure these numbers are within a reasonable distance.
-  int32_t captured_pc_distance =
-      captured_states[1].base.pc - captured_states[1].base.r2;
-  EXPECT_LT(captured_pc_distance, kMaxPcDistance);
-  EXPECT_EQ(static_cast<uint32_t>(captured_states[1].base.r3),
-            static_cast<uint32_t>(captured_states[1].base.lr));
-
-  // NESTED STATE
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(captured_states[0].base.r0),
-            kNestedMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(captured_states[0].base.r1), 0u);
-  // PC is manually saved in r2 before the exception occurs (where PC is also
-  // stored). Ensure these numbers are within a reasonable distance.
-  captured_pc_distance =
-      captured_states[0].base.pc - captured_states[0].base.r2;
-  EXPECT_LT(captured_pc_distance, kMaxPcDistance);
-  EXPECT_EQ(static_cast<uint32_t>(captured_states[0].base.r3),
-            static_cast<uint32_t>(captured_states[0].base.lr));
-}
-
-// TODO(pwbug/17): Replace when Pigweed config system is added.
-// Disable tests that rely on hardware FPU if this module wasn't built with
-// hardware FPU support.
-#if defined(PW_ARMV7M_ENABLE_FPU) && PW_ARMV7M_ENABLE_FPU == 1
-
-// Populate some of the extended set of captured registers, then trigger
-// exception. This function uses floating point to validate float context
-// is pushed correctly.
-void BeginExtendedFaultFloatTest() {
-  float_test_value = _PW_TEST_FPU_OPERATION;
-  BeginExtendedFaultTest();
-}
-
-// Populate some of the extended set of captured registers, then trigger
-// exception.
-// This version causes stack to not be 4-byte aligned initially, testing
-// the fault handlers correction for psp.
-// This function uses floating point to validate float context
-// is pushed correctly.
-void BeginExtendedFaultUnalignedStackFloatTest() {
-  float_test_value = _PW_TEST_FPU_OPERATION;
-  BeginExtendedFaultUnalignedStackTest();
-}
-
-TEST(FaultEntry, FloatFault) {
-  Setup(/*use_fpu=*/true);
-  BeginExtendedFaultFloatTest();
-  ASSERT_EQ(exceptions_handled, 1u);
-  const ArmV7mExtraRegisters& extended_registers = captured_state.extended;
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r4), kMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r5), 0u);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r11), kMagicPattern);
-
-  // Check expected values for this crash.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.cfsr),
-            static_cast<uint32_t>(kDivByZeroFaultMask));
-  EXPECT_EQ((extended_registers.icsr & 0x1FFu), kUsageFaultIsrNum);
-
-  // Check fpu state was pushed during exception
-  EXPECT_FALSE(extended_registers.exc_return & kExcReturnBasicFrameMask);
-
-  // Check float_test_value is correct
-  EXPECT_EQ(float_test_value, kFloatTestPattern);
-}
-
-TEST(FaultEntry, FloatUnalignedStackFault) {
-  Setup(/*use_fpu=*/true);
-  BeginExtendedFaultUnalignedStackFloatTest();
-  ASSERT_EQ(exceptions_handled, 1u);
-  ASSERT_TRUE(span_matches);
-  const ArmV7mExtraRegisters& extended_registers = captured_state.extended;
-  // captured_state values must be cast since they're in a packed struct.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r4), kMagicPattern);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r5), 0u);
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.r11), kMagicPattern);
-
-  // Check expected values for this crash.
-  EXPECT_EQ(static_cast<uint32_t>(extended_registers.cfsr),
-            static_cast<uint32_t>(kDivByZeroFaultMask));
-  EXPECT_EQ((extended_registers.icsr & 0x1FFu), kUsageFaultIsrNum);
-
-  // Check fpu state was pushed during exception.
-  EXPECT_FALSE(extended_registers.exc_return & kExcReturnBasicFrameMask);
-
-  // Check float_test_value is correct
-  EXPECT_EQ(float_test_value, kFloatTestPattern);
-}
-
-#endif  // defined(PW_ARMV7M_ENABLE_FPU) && PW_ARMV7M_ENABLE_FPU == 1
-
-void TestingExceptionHandler(pw_CpuExceptionState* state) {
-  if (++current_fault_depth > kMaxFaultDepth) {
-    volatile bool loop = true;
-    while (loop) {
-      // Hit unexpected nested crash, prevent further nesting.
-    }
-  }
-
-  if (trigger_nested_fault) {
-    // Disable nesting before triggering the nested fault to prevent infinite
-    // recursive crashes.
-    trigger_nested_fault = false;
-    BeginNestedFaultTest();
-  }
-
-  // Clear HFSR forced (nested) hard fault mask if set. This will only be
-  // set by the nested fault test.
-  EXPECT_EQ(state->extended.hfsr, arm_v7m_hfsr);
-  if (arm_v7m_hfsr & kForcedHardfaultMask) {
-    arm_v7m_hfsr = kForcedHardfaultMask;
-  }
-
-  if (arm_v7m_cfsr & kUnalignedFaultMask) {
-    // Copy captured state to check later.
-    std::memcpy(&captured_states[exceptions_handled],
-                state,
-                sizeof(pw_CpuExceptionState));
-
-    // Disable unaligned read/write trapping to "handle" exception.
-    arm_v7m_ccr &= ~kUnalignedTrapEnableMask;
-    arm_v7m_cfsr = kUnalignedFaultMask;
-    exceptions_handled++;
-    return;
-  } else if (arm_v7m_cfsr & kDivByZeroFaultMask) {
-    // Copy captured state to check later.
-    std::memcpy(&captured_states[exceptions_handled],
-                state,
-                sizeof(pw_CpuExceptionState));
-
-    // Ensure std::span compares to be the same.
-    std::span<const uint8_t> state_span = RawFaultingCpuState(*state);
-    EXPECT_EQ(state_span.size(), sizeof(pw_CpuExceptionState));
-    if (std::memcmp(state, state_span.data(), state_span.size()) == 0) {
-      span_matches = true;
-    } else {
-      span_matches = false;
-    }
-
-    // Disable divide-by-zero trapping to "handle" exception.
-    arm_v7m_ccr &= ~kDivByZeroTrapEnableMask;
-    arm_v7m_cfsr = kDivByZeroFaultMask;
-    exceptions_handled++;
-    return;
-  }
-
-  EXPECT_EQ(state->extended.shcsr, arm_v7m_shcsr);
-
-  // If an unexpected exception occurred, just enter an infinite loop.
-  while (true) {
-  }
-}
-
-}  // namespace
-}  // namespace pw::cpu_exception
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/proto_dump.cc b/third_party/pigweed/repo/pw_cpu_exception_armv7m/proto_dump.cc
deleted file mode 100644 (file)
index 086652d..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_cpu_exception_armv7m/cpu_state.h"
-#include "pw_cpu_exception_armv7m_protos/cpu_state.pwpb.h"
-#include "pw_preprocessor/compiler.h"
-#include "pw_protobuf/encoder.h"
-
-namespace pw::cpu_exception {
-
-Status DumpCpuStateProto(protobuf::Encoder& dest,
-                         const pw_CpuExceptionState& cpu_state) {
-  armv7m::ArmV7mCpuState::Encoder state_encoder(&dest);
-
-  // Special and mem-mapped registers.
-  state_encoder.WritePc(cpu_state.base.pc);
-  state_encoder.WriteLr(cpu_state.base.lr);
-  state_encoder.WritePsr(cpu_state.base.psr);
-  state_encoder.WriteMsp(cpu_state.extended.msp);
-  state_encoder.WritePsp(cpu_state.extended.psp);
-  state_encoder.WriteExcReturn(cpu_state.extended.exc_return);
-  state_encoder.WriteCfsr(cpu_state.extended.cfsr);
-  state_encoder.WriteMmfar(cpu_state.extended.mmfar);
-  state_encoder.WriteBfar(cpu_state.extended.bfar);
-  state_encoder.WriteIcsr(cpu_state.extended.icsr);
-  state_encoder.WriteHfsr(cpu_state.extended.hfsr);
-  state_encoder.WriteShcsr(cpu_state.extended.shcsr);
-  state_encoder.WriteControl(cpu_state.extended.control);
-
-  // General purpose registers.
-  state_encoder.WriteR0(cpu_state.base.r0);
-  state_encoder.WriteR1(cpu_state.base.r1);
-  state_encoder.WriteR2(cpu_state.base.r2);
-  state_encoder.WriteR3(cpu_state.base.r3);
-  state_encoder.WriteR4(cpu_state.extended.r4);
-  state_encoder.WriteR5(cpu_state.extended.r5);
-  state_encoder.WriteR6(cpu_state.extended.r6);
-  state_encoder.WriteR7(cpu_state.extended.r7);
-  state_encoder.WriteR8(cpu_state.extended.r8);
-  state_encoder.WriteR9(cpu_state.extended.r9);
-  state_encoder.WriteR10(cpu_state.extended.r10);
-  state_encoder.WriteR11(cpu_state.extended.r11);
-
-  // If the encode buffer was exhausted in an earlier write, it will be
-  // reflected here.
-  Status status = state_encoder.WriteR12(cpu_state.base.r12);
-  if (!status.ok()) {
-    return status == Status::ResourceExhausted() ? Status::ResourceExhausted()
-                                                 : Status::Unknown();
-  }
-  return Status::Ok();
-}
-
-}  // namespace pw::cpu_exception
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/public/pw_cpu_exception_armv7m/cpu_state.h b/third_party/pigweed/repo/pw_cpu_exception_armv7m/public/pw_cpu_exception_armv7m/cpu_state.h
deleted file mode 100644 (file)
index 23158c8..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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 <cstdint>
-
-#include "pw_preprocessor/compiler.h"
-
-namespace pw::cpu_exception {
-
-// This is dictated by ARMv7-M architecture. Do not change.
-PW_PACKED(struct) ArmV7mFaultRegisters {
-  uint32_t r0;
-  uint32_t r1;
-  uint32_t r2;
-  uint32_t r3;
-  uint32_t r12;
-  uint32_t lr;   // Link register.
-  uint32_t pc;   // Program counter.
-  uint32_t psr;  // Program status register.
-};
-
-// This is dictated by ARMv7-M architecture. Do not change.
-PW_PACKED(struct) ArmV7mFaultRegistersFpu {
-  uint32_t s0;
-  uint32_t s1;
-  uint32_t s2;
-  uint32_t s3;
-  uint32_t s4;
-  uint32_t s5;
-  uint32_t s6;
-  uint32_t s7;
-  uint32_t s8;
-  uint32_t s9;
-  uint32_t s10;
-  uint32_t s11;
-  uint32_t s12;
-  uint32_t s13;
-  uint32_t s14;
-  uint32_t s15;
-  uint32_t fpscr;
-  uint32_t reserved;
-};
-
-// Bit in the PSR that indicates CPU added an extra word on the stack to
-// align it during context save for an exception.
-inline constexpr uint32_t kPsrExtraStackAlignBit = (1 << 9);
-
-// This is dictated by this module, and shouldn't change often.
-// Note that the order of entries in this struct is very important (as the
-// values are populated in assembly).
-//
-// NOTE: Memory mapped registers are NOT restored upon fault return!
-PW_PACKED(struct) ArmV7mExtraRegisters {
-  // Memory mapped registers.
-  uint32_t cfsr;
-  uint32_t mmfar;
-  uint32_t bfar;
-  uint32_t icsr;
-  uint32_t hfsr;
-  uint32_t shcsr;
-  // Special registers.
-  uint32_t exc_return;
-  uint32_t msp;
-  uint32_t psp;
-  uint32_t control;
-  // General purpose registers.
-  uint32_t r4;
-  uint32_t r5;
-  uint32_t r6;
-  uint32_t r7;
-  uint32_t r8;
-  uint32_t r9;
-  uint32_t r10;
-  uint32_t r11;
-};
-
-}  // namespace pw::cpu_exception
-
-PW_PACKED(struct) pw_CpuExceptionState {
-  pw::cpu_exception::ArmV7mExtraRegisters extended;
-  pw::cpu_exception::ArmV7mFaultRegisters base;
-  // TODO(amontanez): FPU registers may or may not be here as well. Make the
-  // availability of the FPU registers a compile-time configuration when FPU
-  // register support is added.
-};
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/public/pw_cpu_exception_armv7m/proto_dump.h b/third_party/pigweed/repo/pw_cpu_exception_armv7m/public/pw_cpu_exception_armv7m/proto_dump.h
deleted file mode 100644 (file)
index b4d99a2..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_cpu_exception_armv7m/cpu_state.h"
-#include "pw_protobuf/encoder.h"
-#include "pw_status/status.h"
-
-namespace pw::cpu_exception {
-
-// Dumps the cpu state struct as a proto (defined in
-// pw_cpu_exception_armv7m_protos/cpu_state.proto). The final proto is up to 144
-// bytes in size, so ensure your encoder is properly sized.
-//
-// Returns:
-//   OK - Entire proto was written to the encoder.
-//   RESOURCE_EXHAUSTED - Insufficient space to encode proto.
-//   UNKNOWN - Some other proto encoding error occurred.
-Status DumpCpuStateProto(protobuf::Encoder& dest,
-                         const pw_CpuExceptionState& cpu_state);
-
-}  // namespace pw::cpu_exception
diff --git a/third_party/pigweed/repo/pw_cpu_exception_armv7m/pw_cpu_exception_armv7m_protos/cpu_state.proto b/third_party/pigweed/repo/pw_cpu_exception_armv7m/pw_cpu_exception_armv7m_protos/cpu_state.proto
deleted file mode 100644 (file)
index a557d0e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-syntax = "proto2";
-
-package pw.cpu_exception.armv7m;
-
-message ArmV7mCpuState {
-  optional uint32 pc = 1;
-  optional uint32 lr = 2;
-  optional uint32 psr = 3;
-  optional uint32 msp = 4;
-  optional uint32 psp = 5;
-  optional uint32 exc_return = 6;
-  optional uint32 cfsr = 7;
-  optional uint32 mmfar = 8;
-  optional uint32 bfar = 9;
-  optional uint32 icsr = 10;
-  optional uint32 hfsr = 25;
-  optional uint32 shcsr = 26;
-  optional uint32 control = 11;
-
-  // General purpose registers.
-  optional uint32 r0 = 12;
-  optional uint32 r1 = 13;
-  optional uint32 r2 = 14;
-  optional uint32 r3 = 15;
-  optional uint32 r4 = 16;
-  optional uint32 r5 = 17;
-  optional uint32 r6 = 18;
-  optional uint32 r7 = 19;
-  optional uint32 r8 = 20;
-  optional uint32 r9 = 21;
-  optional uint32 r10 = 22;
-  optional uint32 r11 = 23;
-  optional uint32 r12 = 24;
-
-  // Next tag: 27
-}
diff --git a/third_party/pigweed/repo/pw_docgen/py/docgen.py b/third_party/pigweed/repo/pw_docgen/py/docgen.py
deleted file mode 100644 (file)
index 8be124c..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-# Copyright 2019 The Pigweed 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
-#
-#     https://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.
-"""Renders HTML documentation using Sphinx."""
-
-# TODO(frolv): Figure out a solution for installing all library dependencies
-# to run Sphinx and build RTD docs.
-
-import argparse
-import collections
-import json
-import os
-import shutil
-import subprocess
-import sys
-
-from typing import Dict, List, Tuple
-
-SCRIPT_HEADER: str = '''
-██████╗ ██╗ ██████╗ ██╗    ██╗███████╗███████╗██████╗     ██████╗  ██████╗  ██████╗███████╗
-██╔══██╗██║██╔════╝ ██║    ██║██╔════╝██╔════╝██╔══██╗    ██╔══██╗██╔═══██╗██╔════╝██╔════╝
-██████╔╝██║██║  ███╗██║ █╗ ██║█████╗  █████╗  ██║  ██║    ██║  ██║██║   ██║██║     ███████╗
-██╔═══╝ ██║██║   ██║██║███╗██║██╔══╝  ██╔══╝  ██║  ██║    ██║  ██║██║   ██║██║     ╚════██║
-██║     ██║╚██████╔╝╚███╔███╔╝███████╗███████╗██████╔╝    ██████╔╝╚██████╔╝╚██████╗███████║
-╚═╝     ╚═╝ ╚═════╝  ╚══╝╚══╝ ╚══════╝╚══════╝╚═════╝     ╚═════╝  ╚═════╝  ╚═════╝╚══════╝
-'''
-
-
-def parse_args() -> argparse.Namespace:
-    """Parses command-line arguments."""
-
-    parser = argparse.ArgumentParser(description=__doc__)
-    parser.add_argument('--sphinx-build-dir',
-                        required=True,
-                        help='Directory in which to build docs')
-    parser.add_argument('--conf',
-                        required=True,
-                        help='Path to conf.py file for Sphinx')
-    parser.add_argument('--gn-root',
-                        required=True,
-                        help='Root of the GN build tree')
-    parser.add_argument('--gn-gen-root',
-                        required=True,
-                        help='Root of the GN gen tree')
-    parser.add_argument('sources',
-                        nargs='+',
-                        help='Paths to the root level rst source files')
-    parser.add_argument('--out-dir',
-                        required=True,
-                        help='Output directory for rendered HTML docs')
-    parser.add_argument('--metadata',
-                        required=True,
-                        type=argparse.FileType('r'),
-                        help='Metadata JSON file')
-    return parser.parse_args()
-
-
-def build_docs(src_dir: str, dst_dir: str) -> int:
-    """Runs Sphinx to render HTML documentation from a doc tree."""
-
-    # TODO(frolv): Specify the Sphinx script from a prebuilts path instead of
-    # requiring it in the tree.
-    command = [
-        'sphinx-build', '-W', '-b', 'html', '-d', f'{dst_dir}/help', src_dir,
-        f'{dst_dir}/html'
-    ]
-    return subprocess.call(command)
-
-
-def mkdir(dirname: str, exist_ok: bool = False) -> None:
-    """Wrapper around os.makedirs that prints the operation."""
-    print(f'MKDIR {dirname}')
-    os.makedirs(dirname, exist_ok=exist_ok)
-
-
-def copy(src: str, dst: str) -> None:
-    """Wrapper around shutil.copy that prints the operation."""
-    print(f'COPY  {src} -> {dst}')
-    shutil.copy(src, dst)
-
-
-def copy_doc_tree(args: argparse.Namespace) -> None:
-    """Copies doc source and input files into a build tree."""
-    def build_path(path):
-        """Converts a source path to a filename in the build directory."""
-        if path.startswith(args.gn_root):
-            path = os.path.relpath(path, args.gn_root)
-        elif path.startswith(args.gn_gen_root):
-            path = os.path.relpath(path, args.gn_gen_root)
-
-        return os.path.join(args.sphinx_build_dir, path)
-
-    source_files = json.load(args.metadata)
-    copy_paths = [build_path(f) for f in source_files]
-
-    mkdir(args.sphinx_build_dir)
-    for source_path in args.sources:
-        copy(source_path, f'{args.sphinx_build_dir}/')
-    copy(args.conf, f'{args.sphinx_build_dir}/conf.py')
-
-    # Map of directory path to list of source and destination file paths.
-    dirs: Dict[str, List[Tuple[str, str]]] = collections.defaultdict(list)
-
-    for source_file, copy_path in zip(source_files, copy_paths):
-        dirname = os.path.dirname(copy_path)
-        dirs[dirname].append((source_file, copy_path))
-
-    for directory, file_pairs in dirs.items():
-        mkdir(directory, exist_ok=True)
-        for src, dst in file_pairs:
-            copy(src, dst)
-
-
-def main() -> int:
-    """Script entry point."""
-
-    args = parse_args()
-
-    # Clear out any existing docs for the target.
-    if os.path.exists(args.sphinx_build_dir):
-        shutil.rmtree(args.sphinx_build_dir)
-
-    # TODO(pwbug/164): Printing the header causes unicode problems on Windows.
-    # Disabled for now; re-enable once the root issue is fixed.
-    # print(SCRIPT_HEADER)
-    copy_doc_tree(args)
-
-    # Flush all script output before running Sphinx.
-    print('-' * 80, flush=True)
-
-    return build_docs(args.sphinx_build_dir, args.out_dir)
-
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/requirements.in b/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/requirements.in
deleted file mode 100644 (file)
index 9cced8d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-
-# This is the list of packages we want installed. When we want to update them
-# or install additional packages update this file and run
-# `pip-compile requirements.in` and it will update requirements.txt.
-
-# To help manage these files.
-pip-tools
-
-# The below modules are all for documentation generation.
-# TODO(pwbug/198): Create a setup.py for pw_docgen and remove these.
-sphinx
-sphinx-rtd-theme
-
-# Markdown to REST for documentation.
-m2r
-
-# Diagram generation modules.
-sphinxcontrib-actdiag
-sphinxcontrib-blockdiag
-sphinxcontrib-nwdiag
-sphinxcontrib-seqdiag
diff --git a/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/requirements.txt b/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/requirements.txt
deleted file mode 100644 (file)
index 7e18bfe..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-#    pip-compile requirements.in
-#
-actdiag==2.0.0            # via sphinxcontrib-actdiag
-alabaster==0.7.12         # via sphinx
-babel==2.7.0              # via sphinx
-blockdiag==2.0.1          # via actdiag, nwdiag, seqdiag, sphinxcontrib-actdiag, sphinxcontrib-blockdiag, sphinxcontrib-nwdiag, sphinxcontrib-seqdiag
-certifi==2019.9.11        # via requests
-chardet==3.0.4            # via requests
-click==7.0                # via pip-tools
-docutils==0.15.2          # via m2r, sphinx
-funcparserlib==0.3.6      # via blockdiag
-idna==2.8                 # via requests
-imagesize==1.1.0          # via sphinx
-jinja2==2.10.3            # via sphinx
-m2r==0.2.1                # via -r requirements.in
-markupsafe==1.1.1         # via jinja2
-mistune==0.8.4            # via m2r
-nwdiag==2.0.0             # via sphinxcontrib-nwdiag
-packaging==19.2           # via sphinx
-pillow==7.1.2             # via blockdiag
-pip-tools==5.1.2          # via -r requirements.in
-pygments==2.4.2           # via sphinx
-pyparsing==2.4.5          # via packaging
-pytz==2019.3              # via babel
-requests==2.22.0          # via sphinx
-seqdiag==2.0.0            # via sphinxcontrib-seqdiag
-six==1.13.0               # via packaging, pip-tools
-snowballstemmer==2.0.0    # via sphinx
-sphinx-rtd-theme==0.4.3   # via -r requirements.in
-sphinx==2.2.1             # via -r requirements.in, sphinx-rtd-theme, sphinxcontrib-actdiag, sphinxcontrib-blockdiag, sphinxcontrib-nwdiag, sphinxcontrib-seqdiag
-sphinxcontrib-actdiag==2.0.0  # via -r requirements.in
-sphinxcontrib-applehelp==1.0.1  # via sphinx
-sphinxcontrib-blockdiag==2.0.0  # via -r requirements.in
-sphinxcontrib-devhelp==1.0.1  # via sphinx
-sphinxcontrib-htmlhelp==1.0.2  # via sphinx
-sphinxcontrib-jsmath==1.0.1  # via sphinx
-sphinxcontrib-nwdiag==2.0.0  # via -r requirements.in
-sphinxcontrib-qthelp==1.0.2  # via sphinx
-sphinxcontrib-seqdiag==2.0.0  # via -r requirements.in
-sphinxcontrib-serializinghtml==1.1.3  # via sphinx
-urllib3==1.25.7           # via requests
-webcolors==1.11.1         # via blockdiag
-
-# The following packages are considered to be unsafe in a requirements file:
-# setuptools
diff --git a/third_party/pigweed/repo/pw_fuzzer/examples/build_and_run_toy_fuzzer.sh b/third_party/pigweed/repo/pw_fuzzer/examples/build_and_run_toy_fuzzer.sh
deleted file mode 100755 (executable)
index 57c8c59..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /bin/bash
-
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-
-# TODO(pwbug/177): Pythonize this, or otherwise replace it.
-
-set -e
-
-OUT_DIR="out/host"
-
-confirm() {
-  echo
-  while [ -n "$1" ] ; do
-    echo "$1"
-    shift
-  done
-  echo
-  read -p "Do you wish to continue? [yN]" confirm
-  case $confirm in
-      [Yy]* ) ;;
-      * ) exit;;
-  esac
-  echo
-}
-
-confirm "This script builds and runs a example fuzzer." \
-        "This script is about to delete $OUT_DIR."
-set -x
-rm -rf $OUT_DIR
-
-mkdir -p $OUT_DIR
-echo 'pw_target_toolchain="//pw_toolchain:host_clang_og"' > $OUT_DIR/args.gn
-echo 'pw_sanitizer="address"' >> $OUT_DIR/args.gn
-gn gen $OUT_DIR
-ninja -C $OUT_DIR pw_module_fuzzers
-
-set +x
-confirm "The toy_fuzzer was built successfully!" \
-        "This script is about to start fuzzing."
-set -x
-$OUT_DIR/obj/pw_fuzzer/toy_fuzzer
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/BUILD b/third_party/pigweed/repo/pw_hdlc_lite/BUILD
deleted file mode 100644 (file)
index 125064a..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-
-load(
-    "//pw_build:pigweed.bzl",
-    "pw_cc_library",
-)
-
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"])  # Apache License 2.0
-
-pw_cc_library(
-    name = "pw_hdlc_lite",
-    srcs = [
-        "decoder.cc",
-        "encoder.cc",
-        "pw_hdlc_lite_private/protocol.h",
-        "rpc_packets.cc",
-    ],
-    hdrs = [
-        "public/pw_hdlc_lite/decoder.h",
-        "public/pw_hdlc_lite/encoder.h",
-        "public/pw_hdlc_lite/sys_io_stream.h",
-    ],
-    includes = ["public"],
-    deps = [
-        "//pw_bytes",
-        "//pw_checksum",
-        "//pw_log",
-        "//pw_result",
-        "//pw_span",
-        "//pw_status",
-        "//pw_stream",
-    ],
-)
-
-pw_cc_library(
-    name = "pw_rpc",
-    srcs = ["rpc_packets.cc"],
-    hdrs = [
-        "public/pw_hdlc_lite/rpc_channel.h",
-        "public/pw_hdlc_lite/rpc_packets.h",
-    ],
-    includes = ["public"],
-    deps = [
-        ":pw_hdlc_lite",
-        "//pw_rpc:server",
-    ],
-)
-
-cc_test(
-    name = "encoder_test",
-    srcs = ["encoder_test.cc"],
-    deps = [
-        ":pw_hdlc_lite",
-        "//pw_stream",
-        "//pw_unit_test",
-    ],
-)
-
-cc_test(
-    name = "decoder_test",
-    srcs = ["decoder_test.cc"],
-    deps = [
-        ":pw_hdlc_lite",
-        "//pw_result",
-        "//pw_stream",
-        "//pw_unit_test",
-    ],
-)
-
-cc_test(
-    name = "rpc_channel_test",
-    srcs = ["rpc_channel_test.cc"],
-    deps = [
-        ":pw_hdlc_lite",
-        "//pw_stream",
-        "//pw_unit_test",
-    ],
-)
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/BUILD.gn b/third_party/pigweed/repo/pw_hdlc_lite/BUILD.gn
deleted file mode 100644 (file)
index 75eb537..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-
-import("//build_overrides/pigweed.gni")
-
-import("$dir_pw_build/target_types.gni")
-import("$dir_pw_docgen/docs.gni")
-import("$dir_pw_unit_test/test.gni")
-
-config("default_config") {
-  include_dirs = [ "public" ]
-}
-
-group("pw_hdlc_lite") {
-  public_deps = [
-    ":decoder",
-    ":encoder",
-  ]
-}
-
-pw_source_set("decoder") {
-  public_configs = [ ":default_config" ]
-  public = [ "public/pw_hdlc_lite/decoder.h" ]
-  sources = [
-    "decoder.cc",
-    "pw_hdlc_lite_private/protocol.h",
-  ]
-  public_deps = [
-    dir_pw_bytes,
-    dir_pw_result,
-    dir_pw_status,
-  ]
-  deps = [
-    dir_pw_checksum,
-    dir_pw_log,
-  ]
-  friend = [ ":*" ]
-}
-
-pw_source_set("encoder") {
-  public_configs = [ ":default_config" ]
-  public = [
-    "public/pw_hdlc_lite/encoder.h",
-    "public/pw_hdlc_lite/sys_io_stream.h",
-  ]
-  sources = [
-    "encoder.cc",
-    "pw_hdlc_lite_private/protocol.h",
-  ]
-  public_deps = [
-    dir_pw_bytes,
-    dir_pw_status,
-    dir_pw_stream,
-    dir_pw_sys_io,
-  ]
-  deps = [ dir_pw_checksum ]
-  friend = [ ":*" ]
-}
-
-pw_source_set("pw_rpc") {
-  public_configs = [ ":default_config" ]
-  public = [
-    "public/pw_hdlc_lite/rpc_channel.h",
-    "public/pw_hdlc_lite/rpc_packets.h",
-  ]
-  sources = [ "rpc_packets.cc" ]
-  public_deps = [
-    ":pw_hdlc_lite",
-    "$dir_pw_rpc:server",
-  ]
-}
-
-pw_test_group("tests") {
-  tests = [
-    ":encoder_test",
-    ":decoder_test",
-    ":rpc_channel_test",
-  ]
-  group_deps = [
-    "$dir_pw_preprocessor:tests",
-    "$dir_pw_span:tests",
-    "$dir_pw_status:tests",
-    "$dir_pw_stream:tests",
-  ]
-}
-
-pw_test("encoder_test") {
-  deps = [ ":pw_hdlc_lite" ]
-  sources = [ "encoder_test.cc" ]
-}
-
-action("generate_decoder_test") {
-  outputs = [ "$target_gen_dir/generated_decoder_test.cc" ]
-  script = "py/decode_test.py"
-  args = [ "--generate-cc-test" ] + rebase_path(outputs)
-  deps = [ "$dir_pw_build/py" ]
-}
-
-pw_test("decoder_test") {
-  deps = [
-    ":generate_decoder_test",
-    ":pw_hdlc_lite",
-  ]
-  sources = [ "decoder_test.cc" ] + get_target_outputs(":generate_decoder_test")
-}
-
-pw_test("rpc_channel_test") {
-  deps = [
-    ":pw_hdlc_lite",
-    ":pw_rpc",
-  ]
-  sources = [ "rpc_channel_test.cc" ]
-}
-
-pw_doc_group("docs") {
-  sources = [
-    "docs.rst",
-    "rpc_example/docs.rst",
-  ]
-  inputs = [
-    "py/pw_hdlc_lite/decode.py",
-    "py/pw_hdlc_lite/encode.py",
-  ]
-}
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/decoder.cc b/third_party/pigweed/repo/pw_hdlc_lite/decoder.cc
deleted file mode 100644 (file)
index fc96824..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_hdlc_lite/decoder.h"
-
-#include "pw_assert/assert.h"
-#include "pw_bytes/endian.h"
-#include "pw_checksum/crc32.h"
-#include "pw_hdlc_lite_private/protocol.h"
-#include "pw_log/log.h"
-
-using std::byte;
-
-namespace pw::hdlc_lite {
-namespace {
-
-constexpr byte kUnescapeConstant = byte{0x20};
-
-}  // namespace
-
-Result<Frame> Decoder::Process(const byte new_byte) {
-  switch (state_) {
-    case State::kInterFrame: {
-      if (new_byte == kFlag) {
-        state_ = State::kFrame;
-
-        // Report an error if non-flag bytes were read between frames.
-        if (current_frame_size_ != 0u) {
-          current_frame_size_ = 0;
-          return Status::DataLoss();
-        }
-      } else {
-        // Count bytes to track how many are discarded.
-        current_frame_size_ += 1;
-      }
-      return Status::Unavailable();  // Report error when starting a new frame.
-    }
-    case State::kFrame: {
-      if (new_byte == kFlag) {
-        const Status status = CheckFrame();
-
-        state_ = State::kFrame;
-        const size_t completed_frame_size = current_frame_size_;
-        current_frame_size_ = 0;
-
-        if (status.ok()) {
-          return Frame(buffer_.first(completed_frame_size));
-        }
-        return status;
-      }
-
-      if (new_byte == kEscape) {
-        state_ = State::kFrameEscape;
-      } else {
-        AppendByte(new_byte);
-      }
-      return Status::Unavailable();
-    }
-    case State::kFrameEscape: {
-      // The flag character cannot be escaped; return an error.
-      if (new_byte == kFlag) {
-        state_ = State::kFrame;
-        current_frame_size_ = 0;
-        return Status::DataLoss();
-      }
-
-      if (new_byte == kEscape) {
-        // Two escape characters in a row is illegal -- invalidate this frame.
-        // The frame is reported abandoned when the next flag byte appears.
-        state_ = State::kInterFrame;
-
-        // Count the escape byte so that the inter-frame state detects an error.
-        current_frame_size_ += 1;
-      } else {
-        state_ = State::kFrame;
-        AppendByte(new_byte ^ kUnescapeConstant);
-      }
-      return Status::Unavailable();
-    }
-  }
-  PW_CRASH("Bad decoder state");
-}
-
-void Decoder::AppendByte(byte new_byte) {
-  if (current_frame_size_ < max_size()) {
-    buffer_[current_frame_size_] = new_byte;
-  }
-
-  // Always increase size: if it is larger than the buffer, overflow occurred.
-  current_frame_size_ += 1;
-}
-
-Status Decoder::CheckFrame() const {
-  // Empty frames are not an error; repeated flag characters are okay.
-  if (current_frame_size_ == 0u) {
-    return Status::Unavailable();
-  }
-
-  if (current_frame_size_ < Frame::kMinSizeBytes) {
-    PW_LOG_ERROR("Received %lu-byte frame; frame must be at least 6 bytes",
-                 static_cast<unsigned long>(current_frame_size_));
-    return Status::DataLoss();
-  }
-
-  if (current_frame_size_ > max_size()) {
-    PW_LOG_ERROR("Frame size [%lu] exceeds the maximum buffer size [%lu]",
-                 static_cast<unsigned long>(current_frame_size_),
-                 static_cast<unsigned long>(max_size()));
-    return Status::ResourceExhausted();
-  }
-
-  if (!VerifyFrameCheckSequence()) {
-    PW_LOG_ERROR("Frame check sequence verification failed");
-    return Status::DataLoss();
-  }
-
-  return Status::Ok();
-}
-
-bool Decoder::VerifyFrameCheckSequence() const {
-  uint32_t fcs = bytes::ReadInOrder<uint32_t>(
-      std::endian::little, buffer_.data() + current_frame_size_ - sizeof(fcs));
-  return fcs == checksum::Crc32::Calculate(
-                    buffer_.first(current_frame_size_ - sizeof(fcs)));
-}
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/decoder_test.cc b/third_party/pigweed/repo/pw_hdlc_lite/decoder_test.cc
deleted file mode 100644 (file)
index b8400e2..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_hdlc_lite/decoder.h"
-
-#include <array>
-#include <cstddef>
-
-#include "gtest/gtest.h"
-#include "pw_bytes/array.h"
-#include "pw_hdlc_lite_private/protocol.h"
-
-namespace pw::hdlc_lite {
-namespace {
-
-using std::byte;
-
-TEST(Frame, Fields) {
-  static constexpr auto kFrameData = bytes::String("1234\xa3\xe0\xe3\x9b");
-  constexpr Frame frame(kFrameData);
-
-  static_assert(frame.address() == unsigned{'1'});
-  static_assert(frame.control() == byte{'2'});
-
-  static_assert(frame.data().size() == 2u);
-  static_assert(frame.data()[0] == byte{'3'});
-  static_assert(frame.data()[1] == byte{'4'});
-}
-
-TEST(Decoder, Clear) {
-  DecoderBuffer<8> decoder;
-
-  // Process a partial packet
-  decoder.Process(bytes::String("~1234abcd"),
-                  [](const Result<Frame>&) { FAIL(); });
-
-  decoder.clear();
-  Status status = Status::Unknown();
-
-  decoder.Process(
-      bytes::String("~1234\xa3\xe0\xe3\x9b~"),
-      [&status](const Result<Frame>& result) { status = result.status(); });
-
-  EXPECT_EQ(Status::Ok(), status);
-}
-
-TEST(Decoder, ExactFit) {
-  DecoderBuffer<8> decoder;
-
-  for (byte b : bytes::String("~1234\xa3\xe0\xe3\x9b")) {
-    EXPECT_EQ(Status::Unavailable(), decoder.Process(b).status());
-  }
-  auto result = decoder.Process(kFlag);
-  ASSERT_EQ(Status::Ok(), result.status());
-  ASSERT_EQ(result.value().data().size(), 2u);
-  ASSERT_EQ(result.value().data()[0], byte{'3'});
-  ASSERT_EQ(result.value().data()[1], byte{'4'});
-}
-
-TEST(Decoder, MinimumSizedBuffer) {
-  DecoderBuffer<6> decoder;
-
-  for (byte b : bytes::String("~12\xcd\x44\x53\x4f")) {
-    EXPECT_EQ(Status::Unavailable(), decoder.Process(b).status());
-  }
-
-  auto result = decoder.Process(kFlag);
-  ASSERT_EQ(Status::Ok(), result.status());
-  EXPECT_EQ(result.value().data().size(), 0u);
-}
-
-TEST(Decoder, TooLargeForBuffer_ReportsResourceExhausted) {
-  DecoderBuffer<8> decoder;
-
-  for (byte b : bytes::String("~123456789")) {
-    EXPECT_EQ(Status::Unavailable(), decoder.Process(b).status());
-  }
-  EXPECT_EQ(Status::ResourceExhausted(), decoder.Process(kFlag).status());
-
-  for (byte b : bytes::String("~123456789012345678901234567890")) {
-    EXPECT_EQ(Status::Unavailable(), decoder.Process(b).status());
-  }
-  EXPECT_EQ(Status::ResourceExhausted(), decoder.Process(kFlag).status());
-}
-
-TEST(Decoder, TooLargeForBuffer_StaysWithinBufferBoundaries) {
-  std::array<byte, 16> buffer = bytes::Initialized<16>('?');
-
-  Decoder decoder(std::span(buffer.data(), 8));
-
-  for (byte b : bytes::String("~1234567890123456789012345678901234567890")) {
-    EXPECT_EQ(Status::Unavailable(), decoder.Process(b).status());
-  }
-
-  for (size_t i = 8; i < buffer.size(); ++i) {
-    ASSERT_EQ(byte{'?'}, buffer[i]);
-  }
-
-  EXPECT_EQ(Status::ResourceExhausted(), decoder.Process(kFlag).status());
-}
-
-TEST(Decoder, TooLargeForBuffer_DecodesNextFrame) {
-  DecoderBuffer<8> decoder;
-
-  for (byte b : bytes::String("~123456789012345678901234567890")) {
-    EXPECT_EQ(Status::Unavailable(), decoder.Process(b).status());
-  }
-  EXPECT_EQ(Status::ResourceExhausted(), decoder.Process(kFlag).status());
-
-  for (byte b : bytes::String("1234\xa3\xe0\xe3\x9b")) {
-    EXPECT_EQ(Status::Unavailable(), decoder.Process(b).status());
-  }
-  EXPECT_EQ(Status::Ok(), decoder.Process(kFlag).status());
-}
-
-}  // namespace
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/docs.rst b/third_party/pigweed/repo/pw_hdlc_lite/docs.rst
deleted file mode 100644 (file)
index e42d917..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-.. _module-pw_hdlc_lite:
-
-------------
-pw_hdlc_lite
-------------
-`High-Level Data Link Control (HDLC)
-<https://en.wikipedia.org/wiki/High-Level_Data_Link_Control>`_ is a data link
-layer protocol intended for serial communication between devices. HDLC is
-standardized as `ISO/IEC 13239:2002 <https://www.iso.org/standard/37010.html>`_.
-
-The ``pw_hdlc_lite`` module provides a simple, robust frame-oriented
-transport that uses a subset of the HDLC protocol. ``pw_hdlc_lite`` supports
-sending between embedded devices or the host. It can be used with
-:ref:`module-pw_rpc` to enable remote procedure calls (RPCs) on embedded on
-devices.
-
-**Why use the pw_hdlc_lite module?**
-
-  * Enables the transmission of RPCs and other data between devices over serial.
-  * Detects corruption and data loss.
-  * Light-weight, simple, and easy to use.
-  * Supports streaming to transport without buffering, since the length is not
-    encoded.
-
-.. admonition:: Try it out!
-
-  For an example of how to use HDLC with :ref:`module-pw_rpc`, see the
-  :ref:`module-pw_hdlc_lite-rpc-example`.
-
-.. toctree::
-  :maxdepth: 1
-  :hidden:
-
-  rpc_example/docs
-
-Protocol Description
-====================
-
-Frames
-------
-The HDLC implementation in ``pw_hdlc_lite`` supports only HDLC information
-frames. These frames are encoded as follows:
-
-.. code-block:: text
-
-    _________________________________________
-    | | | |                          |    | |...
-    | | | |                          |    | |... [More frames]
-    |_|_|_|__________________________|____|_|...
-     F A C       Payload              FCS  F
-
-     F = flag byte (0x7e, the ~ character)
-     A = address field
-     C = control field
-     FCS = frame check sequence (CRC-32)
-
-
-Encoding and sending data
--------------------------
-This module first writes an initial frame delimiter byte (0x7E) to indicate the
-beginning of the frame. Before sending any of the payload data through serial,
-the special bytes are escaped:
-
-            +-------------------------+-----------------------+
-            | Unescaped Special Bytes | Escaped Special Bytes |
-            +=========================+=======================+
-            |           7E            |        7D 5E          |
-            +-------------------------+-----------------------+
-            |           7D            |        7D 5D          |
-            +-------------------------+-----------------------+
-
-The bytes of the payload are escaped and written in a single pass. The
-frame check sequence is calculated, escaped, and written after. After this, a
-final frame delimiter byte (0x7E) is written to mark the end of the frame.
-
-Decoding received bytes
------------------------
-Frames may be received in multiple parts, so we need to store the received data
-in a buffer until the ending frame delimiter (0x7E) is read. When the
-``pw_hdlc_lite`` decoder receives data, it unescapes it and adds it to a buffer.
-When the frame is complete, it calculates and verifies the frame check sequence
-and does the following:
-
-* If correctly verified, the decoder returns the decoded frame.
-* If the checksum verification fails, the frame is discarded and an error is
-  reported.
-
-API Usage
-=========
-There are two primary functions of the ``pw_hdlc_lite`` module:
-
-  * **Encoding** data by constructing a frame with the escaped payload bytes and
-    frame check sequence.
-  * **Decoding** data by unescaping the received bytes, verifying the frame
-    check sequence, and returning successfully decoded frames.
-
-Encoder
--------
-The Encoder API provides a single function that encodes data as an HDLC
-information frame.
-
-C++
-^^^
-.. cpp:namespace:: pw
-
-.. cpp:function:: Status hdlc_lite::WriteInformationFrame(uint8_t address, ConstByteSpan data, stream::Writer& writer)
-
-  Writes a span of data to a :ref:`pw::stream::Writer <module-pw_stream>` and
-  returns the status. This implementation uses the :ref:`module-pw_checksum`
-  module to compute the CRC-32 frame check sequence.
-
-.. code-block:: cpp
-
-  #include "pw_hdlc_lite/encoder.h"
-  #include "pw_hdlc_lite/sys_io_stream.h"
-
-  int main() {
-    pw::stream::SysIoWriter serial_writer;
-    Status status = WriteInformationFrame(123 /* address */,
-                                          data,
-                                          serial_writer);
-    if (!status.ok()) {
-      PW_LOG_INFO("Writing frame failed! %s", status.str());
-    }
-  }
-
-Python
-^^^^^^
-.. automodule:: pw_hdlc_lite.encode
-  :members:
-
-.. code-block:: python
-
-  import serial
-  from pw_hdlc_lite import encode
-
-  ser = serial.Serial()
-  ser.write(encode.information_frame(b'your data here!'))
-
-Decoder
--------
-The decoder class unescapes received bytes and adds them to a buffer. Complete,
-valid HDLC frames are yielded as they are received.
-
-C++
-^^^
-.. cpp:class:: pw::hdlc_lite::Decoder
-
-  .. cpp:function:: pw::Result<Frame> Process(std::byte b)
-
-    Parses a single byte of an HDLC stream. Returns a Result with the complete
-    frame if the byte completes a frame. The status is the following:
-
-      - OK - A frame was successfully decoded. The Result contains the Frame,
-        which is invalidated by the next Process call.
-      - UNAVAILABLE - No frame is available.
-      - RESOURCE_EXHAUSTED - A frame completed, but it was too large to fit in
-        the decoder's buffer.
-      - DATA_LOSS - A frame completed, but it was invalid. The frame was
-        incomplete or the frame check sequence verification failed.
-
-  .. cpp:function:: void Process(pw::ConstByteSpan data, F&& callback, Args&&... args)
-
-    Processes a span of data and calls the provided callback with each frame or
-    error.
-
-This example demonstrates reading individual bytes from ``pw::sys_io`` and
-decoding HDLC frames:
-
-.. code-block:: cpp
-
-  #include "pw_hdlc_lite/decoder.h"
-  #include "pw_sys_io/sys_io.h"
-
-  int main() {
-    std::byte data;
-    while (true) {
-      if (!pw::sys_io::ReadByte(&data).ok()) {
-        // Log serial reading error
-      }
-      Result<Frame> decoded_frame = decoder.Process(data);
-
-      if (decoded_frame.ok()) {
-        // Handle the decoded frame
-      }
-    }
-  }
-
-Python
-^^^^^^
-.. autoclass:: pw_hdlc_lite.decode.FrameDecoder
-  :members:
-
-Below is an example using the decoder class to decode data read from serial:
-
-.. code-block:: python
-
-  import serial
-  from pw_hdlc_lite import decode
-
-  ser = serial.Serial()
-  decoder = decode.FrameDecoder()
-
-  while True:
-      for frame in decoder.process_valid_frames(ser.read()):
-          # Handle the decoded frame
-
-Additional features
-===================
-
-pw::stream::SysIoWriter
-------------------------
-The ``SysIoWriter`` C++ class implements the ``Writer`` interface with
-``pw::sys_io``. This Writer may be used by the C++ encoder to send HDLC frames
-over serial.
-
-HdlcRpcClient
--------------
-.. autoclass:: pw_hdlc_lite.rpc.HdlcRpcClient
-  :members:
-
-Roadmap
-=======
-- **Expanded protocol support** - ``pw_hdlc_lite`` currently only supports
-  information frames with a single address byte and control byte. Support for
-  different frame types and extended address or control fields may be added in
-  the future.
-
-- **Higher performance** - We plan to improve the overall performance of the
-  decoder and encoder implementations by using SIMD/NEON.
-
-Compatibility
-=============
-C++17
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/encoder.cc b/third_party/pigweed/repo/pw_hdlc_lite/encoder.cc
deleted file mode 100644 (file)
index 4a785ee..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_hdlc_lite/encoder.h"
-
-#include <algorithm>
-#include <array>
-#include <cstddef>
-#include <cstring>
-#include <span>
-
-#include "pw_bytes/endian.h"
-#include "pw_checksum/crc32.h"
-#include "pw_hdlc_lite_private/protocol.h"
-
-using std::byte;
-
-namespace pw::hdlc_lite {
-namespace {
-
-// Indicates this an information packet with sequence numbers set to 0.
-constexpr byte kUnusedControl = byte{0};
-
-Status EscapeAndWrite(const byte b, stream::Writer& writer) {
-  if (b == kFlag) {
-    return writer.Write(kEscapedFlag);
-  }
-  if (b == kEscape) {
-    return writer.Write(kEscapedEscape);
-  }
-  return writer.Write(b);
-}
-
-// Encodes and writes HDLC frames.
-class Encoder {
- public:
-  constexpr Encoder(stream::Writer& output) : writer_(output) {}
-
-  // Writes the header for an I-frame. After successfully calling
-  // StartInformationFrame, WriteData may be called any number of times.
-  Status StartInformationFrame(uint8_t address);
-
-  // Writes data for an ongoing frame. Must only be called after a successful
-  // StartInformationFrame call, and prior to a FinishFrame() call.
-  Status WriteData(ConstByteSpan data);
-
-  // Finishes a frame. Writes the frame check sequence and a terminating flag.
-  Status FinishFrame();
-
- private:
-  stream::Writer& writer_;
-  checksum::Crc32 fcs_;
-};
-
-Status Encoder::StartInformationFrame(uint8_t address) {
-  fcs_.clear();
-  if (Status status = writer_.Write(kFlag); !status.ok()) {
-    return status;
-  }
-
-  const byte address_and_control[] = {std::byte{address}, kUnusedControl};
-  return WriteData(address_and_control);
-}
-
-Status Encoder::WriteData(ConstByteSpan data) {
-  auto begin = data.begin();
-  while (true) {
-    auto end = std::find_if(begin, data.end(), NeedsEscaping);
-
-    if (Status status = writer_.Write(std::span(begin, end)); !status.ok()) {
-      return status;
-    }
-    if (end == data.end()) {
-      fcs_.Update(data);
-      return Status::Ok();
-    }
-    if (Status status = EscapeAndWrite(*end, writer_); !status.ok()) {
-      return status;
-    }
-    begin = end + 1;
-  }
-}
-
-Status Encoder::FinishFrame() {
-  if (Status status =
-          WriteData(bytes::CopyInOrder(std::endian::little, fcs_.value()));
-      !status.ok()) {
-    return status;
-  }
-  return writer_.Write(kFlag);
-}
-
-}  // namespace
-
-Status WriteInformationFrame(uint8_t address,
-                             ConstByteSpan payload,
-                             stream::Writer& writer) {
-  Encoder encoder(writer);
-
-  if (Status status = encoder.StartInformationFrame(address); !status.ok()) {
-    return status;
-  }
-  if (Status status = encoder.WriteData(payload); !status.ok()) {
-    return status;
-  }
-  return encoder.FinishFrame();
-}
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/encoder_test.cc b/third_party/pigweed/repo/pw_hdlc_lite/encoder_test.cc
deleted file mode 100644 (file)
index 72a66ce..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_hdlc_lite/encoder.h"
-
-#include <algorithm>
-#include <array>
-#include <cstddef>
-
-#include "gtest/gtest.h"
-#include "pw_bytes/array.h"
-#include "pw_hdlc_lite_private/protocol.h"
-#include "pw_stream/memory_stream.h"
-
-using std::byte;
-
-namespace pw::hdlc_lite {
-namespace {
-
-constexpr uint8_t kAddress = 0x7B;  // 123
-constexpr byte kControl = byte{0};
-
-class WriteInfoFrame : public ::testing::Test {
- protected:
-  WriteInfoFrame() : writer_(buffer_) {}
-
-  stream::MemoryWriter writer_;
-  std::array<byte, 32> buffer_;
-};
-
-#define EXPECT_ENCODER_WROTE(...)                                           \
-  do {                                                                      \
-    constexpr auto expected_data = (__VA_ARGS__);                           \
-    EXPECT_EQ(writer_.bytes_written(), expected_data.size());               \
-    EXPECT_EQ(                                                              \
-        std::memcmp(                                                        \
-            writer_.data(), expected_data.data(), writer_.bytes_written()), \
-        0);                                                                 \
-  } while (0)
-
-TEST_F(WriteInfoFrame, EmptyPayload) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(kAddress, std::span<byte>(), writer_));
-  EXPECT_ENCODER_WROTE(
-      bytes::Concat(kFlag, kAddress, kControl, uint32_t{0x8D12B2C2}, kFlag));
-}
-
-TEST_F(WriteInfoFrame, OneBytePayload) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(kAddress, bytes::String("A"), writer_));
-  EXPECT_ENCODER_WROTE(bytes::Concat(
-      kFlag, kAddress, kControl, 'A', uint32_t{0xA63E2FA5}, kFlag));
-}
-
-TEST_F(WriteInfoFrame, OneBytePayload_Escape0x7d) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(kAddress, bytes::Array<0x7d>(), writer_));
-  EXPECT_ENCODER_WROTE(bytes::Concat(kFlag,
-                                     kAddress,
-                                     kControl,
-                                     kEscape,
-                                     byte{0x7d} ^ byte{0x20},
-                                     uint32_t{0x89515322},
-                                     kFlag));
-}
-
-TEST_F(WriteInfoFrame, OneBytePayload_Escape0x7E) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(kAddress, bytes::Array<0x7e>(), writer_));
-  EXPECT_ENCODER_WROTE(bytes::Concat(kFlag,
-                                     kAddress,
-                                     kControl,
-                                     kEscape,
-                                     byte{0x7e} ^ byte{0x20},
-                                     uint32_t{0x10580298},
-                                     kFlag));
-}
-
-TEST_F(WriteInfoFrame, AddressNeedsEscaping) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(0x7d, bytes::String("A"), writer_));
-  EXPECT_ENCODER_WROTE(bytes::Concat(
-      kFlag, kEscape, byte{0x5d}, kControl, 'A', uint32_t{0xA2B35317}, kFlag));
-}
-
-TEST_F(WriteInfoFrame, Crc32NeedsEscaping) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(kAddress, bytes::String("abcdefg"), writer_));
-
-  // The CRC-32 is 0x38B9FC7E, so the 0x7E must be escaped.
-  constexpr auto expected_crc32 = bytes::Array<0x7d, 0x5e, 0xfc, 0xb9, 0x38>();
-  EXPECT_ENCODER_WROTE(bytes::Concat(kFlag,
-                                     kAddress,
-                                     kControl,
-                                     bytes::String("abcdefg"),
-                                     expected_crc32,
-                                     kFlag));
-}
-
-TEST_F(WriteInfoFrame, MultiplePayloads) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(kAddress, bytes::String("ABC"), writer_));
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(kAddress, bytes::String("DEF"), writer_));
-  EXPECT_ENCODER_WROTE(bytes::Concat(kFlag,
-                                     kAddress,
-                                     kControl,
-                                     bytes::String("ABC"),
-                                     uint32_t{0x14E2FC99},
-                                     kFlag,
-                                     kFlag,
-                                     kAddress,
-                                     kControl,
-                                     bytes::String("DEF"),
-                                     uint32_t{0x2D025C3A},
-                                     kFlag));
-}
-
-TEST_F(WriteInfoFrame, PayloadWithNoEscapes) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(
-                kAddress, bytes::String("123456789012345678901234"), writer_));
-
-  // Fill the memory writer's buffer.
-  ASSERT_EQ(writer_.bytes_written(), buffer_.size());
-
-  EXPECT_ENCODER_WROTE(bytes::Concat(kFlag,
-                                     kAddress,
-                                     kControl,
-                                     bytes::String("123456789012345678901234"),
-                                     uint32_t{0x50AA35EC},
-                                     kFlag));
-}
-
-TEST_F(WriteInfoFrame, PayloadWithMultipleEscapes) {
-  ASSERT_EQ(Status::Ok(),
-            WriteInformationFrame(
-                kAddress,
-                bytes::Array<0x7E, 0x7B, 0x61, 0x62, 0x63, 0x7D, 0x7E>(),
-                writer_));
-  EXPECT_ENCODER_WROTE(bytes::Concat(
-      kFlag,
-      kAddress,
-      kControl,
-      bytes::
-          Array<0x7D, 0x5E, 0x7B, 0x61, 0x62, 0x63, 0x7D, 0x5D, 0x7D, 0x5E>(),
-      uint32_t{0x1B8D505E},
-      kFlag));
-}
-
-TEST_F(WriteInfoFrame, WriterError) {
-  constexpr auto data = bytes::Initialized<sizeof(buffer_)>(0x7e);
-
-  EXPECT_EQ(Status::ResourceExhausted(),
-            WriteInformationFrame(kAddress, data, writer_));
-}
-
-}  // namespace
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/decoder.h b/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/decoder.h
deleted file mode 100644 (file)
index d15cbe7..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <algorithm>
-#include <array>
-#include <cstddef>
-#include <cstring>
-#include <functional>  // std::invoke
-
-#include "pw_bytes/span.h"
-#include "pw_result/result.h"
-#include "pw_status/status.h"
-
-namespace pw::hdlc_lite {
-
-// Represents the contents of an HDLC frame -- the unescaped data between two
-// flag bytes. Instances of Frame are only created when a full, valid frame has
-// been read.
-//
-// For now, the Frame class assumes single-byte address and control fields and a
-// 32-bit frame check sequence (FCS).
-class Frame {
- private:
-  static constexpr size_t kAddressSize = 1;
-  static constexpr size_t kControlSize = 1;
-  static constexpr size_t kFcsSize = sizeof(uint32_t);
-
- public:
-  // The minimum size of a frame, excluding control bytes (flag or escape).
-  static constexpr size_t kMinSizeBytes =
-      kAddressSize + kControlSize + kFcsSize;
-
-  // Creates a Frame with the specified data. The data MUST be valid frame data
-  // with a verified frame check sequence.
-  explicit constexpr Frame(ConstByteSpan data) : frame_(data) {
-    // TODO(pwbug/246): Use PW_DASSERT when available.
-    // PW_DASSERT(data.size() >= kMinSizeBytes);
-  }
-
-  constexpr unsigned address() const {
-    return std::to_integer<unsigned>(frame_[0]);
-  }
-
-  constexpr std::byte control() const { return frame_[kAddressSize]; }
-
-  constexpr ConstByteSpan data() const {
-    return frame_.subspan(kAddressSize + kControlSize,
-                          frame_.size() - kMinSizeBytes);
-  }
-
- private:
-  ConstByteSpan frame_;
-};
-
-// The Decoder class facilitates decoding of data frames using the HDLC-Lite
-// protocol, by returning packets as they are decoded and storing incomplete
-// data frames in a buffer.
-//
-// The Decoder class does not own the buffer it writes to. It can be used to
-// write bytes to any buffer. The DecoderBuffer template class, defined below,
-// allocates a buffer.
-class Decoder {
- public:
-  constexpr Decoder(ByteSpan buffer)
-      : buffer_(buffer), current_frame_size_(0), state_(State::kInterFrame) {}
-
-  Decoder(const Decoder&) = delete;
-  Decoder& operator=(const Decoder&) = delete;
-
-  // Parses a single byte of an HDLC stream. Returns a Result with the complete
-  // frame if the byte completes a frame. The status is the following:
-  //
-  //     OK - A frame was successfully decoded. The Result contains the Frame,
-  //         which is invalidated by the next Process call.
-  //     UNAVAILABLE - No frame is available.
-  //     RESOURCE_EXHAUSTED - A frame completed, but it was too large to fit in
-  //         the decoder's buffer.
-  //     DATA_LOSS - A frame completed, but it was invalid. The frame was
-  //         incomplete or the frame check sequence verification failed.
-  //
-  Result<Frame> Process(std::byte b);
-
-  // Processes a span of data and calls the provided callback with each frame or
-  // error.
-  template <typename F, typename... Args>
-  void Process(ConstByteSpan data, F&& callback, Args&&... args) {
-    for (std::byte b : data) {
-      auto result = Process(b);
-      if (result.status() != Status::Unavailable()) {
-        std::invoke(
-            std::forward<F>(callback), std::forward<Args>(args)..., result);
-      }
-    }
-  }
-
-  // Returns the maximum size of the Decoder's frame buffer.
-  size_t max_size() const { return buffer_.size(); }
-
-  // Clears and resets the decoder.
-  void clear() {
-    current_frame_size_ = 0;
-    state_ = State::kInterFrame;
-  };
-
- private:
-  // State enum class is used to make the Decoder a finite state machine.
-  enum class State {
-    kInterFrame,
-    kFrame,
-    kFrameEscape,
-  };
-
-  void AppendByte(std::byte new_byte);
-
-  Status CheckFrame() const;
-
-  bool VerifyFrameCheckSequence() const;
-
-  const ByteSpan buffer_;
-
-  size_t current_frame_size_;
-
-  State state_;
-};
-
-// DecoderBuffers declare a buffer along with a Decoder.
-template <size_t size_bytes>
-class DecoderBuffer : public Decoder {
- public:
-  DecoderBuffer() : Decoder(frame_buffer_) {}
-
-  // Returns the maximum length of the bytes that can be inserted in the bytes
-  // buffer.
-  static constexpr size_t max_size() { return size_bytes; }
-
- private:
-  static_assert(size_bytes >= Frame::kMinSizeBytes);
-
-  std::array<std::byte, size_bytes> frame_buffer_;
-};
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/encoder.h b/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/encoder.h
deleted file mode 100644 (file)
index ba2388c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_bytes/span.h"
-#include "pw_status/status.h"
-#include "pw_stream/stream.h"
-
-namespace pw::hdlc_lite {
-
-// Writes an HDLC information frame (I-frame) to the provided writer. The frame
-// contains the following:
-//
-//   - HDLC flag byte (0x7e)
-//   - Address
-//   - Control byte (fixed at 0; sequence numbers are not used currently).
-//   - Data (0 or more bytes)
-//   - Frame check sequence (CRC-32)
-//   - HDLC flag byte (0x7e)
-//
-Status WriteInformationFrame(uint8_t address,
-                             ConstByteSpan data,
-                             stream::Writer& writer);
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/rpc_channel.h b/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/rpc_channel.h
deleted file mode 100644 (file)
index 4f0e401..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <array>
-#include <span>
-
-#include "pw_hdlc_lite/encoder.h"
-#include "pw_rpc/channel.h"
-#include "pw_stream/stream.h"
-
-namespace pw::hdlc_lite {
-
-// Custom HDLC ChannelOutput class to write and read data through serial using
-// the HDLC-Lite protocol.
-class RpcChannelOutput : public rpc::ChannelOutput {
- public:
-  // The RpcChannelOutput class does not own the buffer it uses to store the
-  // protobuf bytes. This buffer is specified at the time of creation along with
-  // a writer object to which will be used to write and send the bytes.
-  constexpr RpcChannelOutput(stream::Writer& writer,
-                             std::span<std::byte> buffer,
-                             uint8_t address,
-                             const char* channel_name)
-      : ChannelOutput(channel_name),
-        writer_(writer),
-        buffer_(buffer),
-        address_(address) {}
-
-  std::span<std::byte> AcquireBuffer() override { return buffer_; }
-
-  Status SendAndReleaseBuffer(size_t size) override {
-    return hdlc_lite::WriteInformationFrame(
-        address_, buffer_.first(size), writer_);
-  }
-
- private:
-  stream::Writer& writer_;
-  const std::span<std::byte> buffer_;
-  const uint8_t address_;
-};
-
-// RpcChannelOutput with its own buffer.
-template <size_t buffer_size>
-class RpcChannelOutputBuffer : public rpc::ChannelOutput {
- public:
-  constexpr RpcChannelOutputBuffer(stream::Writer& writer,
-                                   uint8_t address,
-                                   const char* channel_name)
-      : ChannelOutput(channel_name), writer_(writer), address_(address) {}
-
-  std::span<std::byte> AcquireBuffer() override { return buffer_; }
-
-  Status SendAndReleaseBuffer(size_t size) override {
-    return hdlc_lite::WriteInformationFrame(
-        address_, std::span(buffer_.data(), size), writer_);
-  }
-
- private:
-  stream::Writer& writer_;
-  std::array<std::byte, buffer_size> buffer_;
-  const uint8_t address_;
-};
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/rpc_packets.h b/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/rpc_packets.h
deleted file mode 100644 (file)
index de2a191..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <cstdint>
-
-#include "pw_hdlc_lite/decoder.h"
-#include "pw_rpc/channel.h"
-#include "pw_rpc/server.h"
-#include "pw_status/status.h"
-
-namespace pw::hdlc_lite {
-
-inline constexpr uint8_t kDefaultRpcAddress = 'R';
-
-// Reads HDLC frames with sys_io::ReadByte, using decode_buffer to store frames.
-// HDLC frames sent to rpc_address are passed to the RPC server.
-Status ReadAndProcessPackets(rpc::Server& server,
-                             rpc::ChannelOutput& output,
-                             std::span<std::byte> decode_buffer,
-                             unsigned rpc_address = kDefaultRpcAddress);
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/sys_io_stream.h b/third_party/pigweed/repo/pw_hdlc_lite/public/pw_hdlc_lite/sys_io_stream.h
deleted file mode 100644 (file)
index 219d8eb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <array>
-#include <cstddef>
-#include <limits>
-#include <span>
-
-#include "pw_stream/stream.h"
-#include "pw_sys_io/sys_io.h"
-
-namespace pw::stream {
-
-class SysIoWriter : public Writer {
- public:
-  size_t ConservativeWriteLimit() const override {
-    return std::numeric_limits<size_t>::max();
-  }
-
- private:
-  Status DoWrite(std::span<const std::byte> data) override {
-    return pw::sys_io::WriteBytes(data).status();
-  }
-};
-
-}  // namespace pw::stream
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/pw_hdlc_lite_private/protocol.h b/third_party/pigweed/repo/pw_hdlc_lite/pw_hdlc_lite_private/protocol.h
deleted file mode 100644 (file)
index 25159db..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <cstddef>
-
-namespace pw::hdlc_lite {
-
-inline constexpr std::byte kFlag = std::byte{0x7E};
-inline constexpr std::byte kEscape = std::byte{0x7D};
-
-inline constexpr std::array<std::byte, 2> kEscapedFlag = {kEscape,
-                                                          std::byte{0x5E}};
-inline constexpr std::array<std::byte, 2> kEscapedEscape = {kEscape,
-                                                            std::byte{0x5D}};
-
-constexpr bool NeedsEscaping(std::byte b) {
-  return (b == kFlag || b == kEscape);
-}
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/decode_test.py b/third_party/pigweed/repo/pw_hdlc_lite/py/decode_test.py
deleted file mode 100755 (executable)
index 55c3f35..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Contains the Python decoder tests and generates C++ decoder tests."""
-
-from typing import Iterator, List, NamedTuple, Tuple
-import unittest
-
-from pw_build.generated_tests import Context, PyTest, TestGenerator, GroupOrTest
-from pw_build.generated_tests import parse_test_generation_args
-from pw_hdlc_lite.decode import Frame, FrameDecoder, FrameStatus, NO_ADDRESS
-from pw_hdlc_lite.protocol import frame_check_sequence as fcs
-
-
-def _encode(address: int, control: int, data: bytes) -> bytes:
-    frame = bytearray([address, control]) + data
-    frame += fcs(frame)
-    frame = frame.replace(b'\x7d', b'\x7d\x5d')
-    frame = frame.replace(b'\x7e', b'\x7d\x5e')
-    return b''.join([b'\x7e', frame, b'\x7e'])
-
-
-class Expected(NamedTuple):
-    address: int
-    control: bytes
-    data: bytes
-    status: FrameStatus = FrameStatus.OK
-
-    def __eq__(self, other) -> bool:
-        """Define == so an Expected and a Frame can be compared."""
-        return (self.address == other.address and self.control == other.control
-                and self.data == other.data and self.status is other.status)
-
-
-_PARTIAL = fcs(b'\x0ACmsg\x5e')
-_ESCAPED_FLAG_TEST_CASE = (
-    b'\x7e\x0ACmsg\x7d\x7e' + _PARTIAL + b'\x7e',
-    [
-        Expected(0xA, b'C', b'', FrameStatus.INCOMPLETE),
-        Expected(_PARTIAL[0], _PARTIAL[1:2], b'', FrameStatus.INCOMPLETE),
-    ],
-)
-
-TEST_CASES: Tuple[GroupOrTest[Tuple[bytes, List[Expected]]], ...] = (
-    'Empty payload',
-    (_encode(0, 0, b''), [Expected(0, b'\0', b'')]),
-    (_encode(55, 0x99, b''), [Expected(55, b'\x99', b'')]),
-    (_encode(55, 0x99, b'') * 3, [Expected(55, b'\x99', b'')] * 3),
-    'Simple one-byte payload',
-    (_encode(0, 0, b'\0'), [Expected(0, b'\0', b'\0')]),
-    (_encode(123, 0, b'A'), [Expected(123, b'\0', b'A')]),
-    'Simple multi-byte payload',
-    (_encode(0, 0, b'Hello, world!'), [Expected(0, b'\0', b'Hello, world!')]),
-    (_encode(123, 0, b'\0\0\1\0\0'), [Expected(123, b'\0', b'\0\0\1\0\0')]),
-    'Escaped one-byte payload',
-    (_encode(1, 2, b'\x7e'), [Expected(1, b'\2', b'\x7e')]),
-    (_encode(1, 2, b'\x7d'), [Expected(1, b'\2', b'\x7d')]),
-    (_encode(1, 2, b'\x7e') + _encode(1, 2, b'\x7d'),
-     [Expected(1, b'\2', b'\x7e'),
-      Expected(1, b'\2', b'\x7d')]),
-    'Escaped address',
-    (_encode(0x7e, 0, b'A'), [Expected(0x7e, b'\0', b'A')]),
-    (_encode(0x7d, 0, b'B'), [Expected(0x7d, b'\0', b'B')]),
-    'Escaped control',
-    (_encode(0, 0x7e, b'C'), [Expected(0, b'\x7e', b'C')]),
-    (_encode(0, 0x7d, b'D'), [Expected(0, b'\x7d', b'D')]),
-    'Escaped address and control',
-    (_encode(0x7e, 0x7d, b'E'), [Expected(0x7e, b'\x7d', b'E')]),
-    (_encode(0x7d, 0x7e, b'F'), [Expected(0x7d, b'\x7e', b'F')]),
-    (_encode(0x7e, 0x7e, b'\x7e'), [Expected(0x7e, b'\x7e', b'\x7e')]),
-    'Multiple frames separated by single flag',
-    (_encode(0, 0, b'A')[:-1] + _encode(1, 2, b'123'),
-     [Expected(0, b'\0', b'A'),
-      Expected(1, b'\2', b'123')]),
-    (_encode(0xff, 0, b'Yo')[:-1] * 3 + b'\x7e',
-     [Expected(0xff, b'\0', b'Yo')] * 3),
-    'Ignore empty frames',
-    (b'\x7e\x7e', []),
-    (b'\x7e' * 10, []),
-    (b'\x7e\x7e' + _encode(1, 2, b'3') + b'\x7e' * 5,
-     [Expected(1, b'\2', b'3')]),
-    (b'\x7e' * 10 + _encode(1, 2, b':O') + b'\x7e' * 3 + _encode(3, 4, b':P'),
-     [Expected(1, b'\2', b':O'),
-      Expected(3, b'\4', b':P')]),
-    'Cannot escape flag',
-    (b'\x7e\xAA\x7d\x7e\xab\x00Hello' + fcs(b'\xab\0Hello') + b'\x7e', [
-        Expected(0xAA, b'', b'', FrameStatus.INCOMPLETE),
-        Expected(0xab, b'\0', b'Hello'),
-    ]),
-    _ESCAPED_FLAG_TEST_CASE,
-    'Frame too short',
-    (b'\x7e1\x7e', [Expected(ord('1'), b'', b'', FrameStatus.INCOMPLETE)]),
-    (b'\x7e12\x7e', [Expected(ord('1'), b'2', b'', FrameStatus.INCOMPLETE)]),
-    (b'\x7e12345\x7e', [Expected(ord('1'), b'2', b'',
-                                 FrameStatus.INCOMPLETE)]),
-    'Incorrect frame check sequence',
-    (b'\x7e123456\x7e',
-     [Expected(ord('1'), b'2', b'', FrameStatus.FCS_MISMATCH)]),
-    (b'\x7e\1\2msg\xff\xff\xff\xff\x7e',
-     [Expected(0x1, b'\2', b'msg', FrameStatus.FCS_MISMATCH)]),
-    (_encode(0xA, 0xB, b'???')[:-2] + _encode(1, 2, b'def'), [
-        Expected(0xA, b'\x0B', b'??', FrameStatus.FCS_MISMATCH),
-        Expected(1, b'\2', b'def'),
-    ]),
-    'Invalid escape in address',
-    (b'\x7e\x7d\x7d\0' + fcs(b'\x5d\0') + b'\x7e',
-     [Expected(0,
-               fcs(b'\x5d\0')[0:1], b'', FrameStatus.INVALID_ESCAPE)]),
-    'Invalid escape in control',
-    (b'\x7e\0\x7d\x7d' + fcs(b'\0\x5d') + b'\x7e',
-     [Expected(0,
-               fcs(b'\0\x5d')[0:1], b'', FrameStatus.INVALID_ESCAPE)]),
-    'Invalid escape in data',
-    (b'\x7e\0\1\x7d\x7d' + fcs(b'\0\1\x5d') + b'\x7e',
-     [Expected(0, b'\1', b'', FrameStatus.INVALID_ESCAPE)]),
-    'Frame ends with escape',
-    (b'\x7e\x7d\x7e', [Expected(NO_ADDRESS, b'', b'',
-                                FrameStatus.INCOMPLETE)]),
-    (b'\x7e\1\x7d\x7e', [Expected(1, b'', b'', FrameStatus.INCOMPLETE)]),
-    (b'\x7e\1\2abc\x7d\x7e', [Expected(1, b'\2', b'',
-                                       FrameStatus.INCOMPLETE)]),
-    (b'\x7e\1\2abcd\x7d\x7e',
-     [Expected(1, b'\2', b'', FrameStatus.INCOMPLETE)]),
-    (b'\x7e\1\2abcd1234\x7d\x7e',
-     [Expected(1, b'\2', b'abcd', FrameStatus.INCOMPLETE)]),
-    'Inter-frame data is only escapes',
-    (b'\x7e\x7d\x7e\x7d\x7e', [
-        Expected(NO_ADDRESS, b'', b'', FrameStatus.INCOMPLETE),
-        Expected(NO_ADDRESS, b'', b'', FrameStatus.INCOMPLETE),
-    ]),
-    (b'\x7e\x7d\x7d\x7e\x7d\x7d\x7e', [
-        Expected(NO_ADDRESS, b'', b'', FrameStatus.INVALID_ESCAPE),
-        Expected(NO_ADDRESS, b'', b'', FrameStatus.INVALID_ESCAPE),
-    ]),
-    'Data before first flag',
-    (b'\0\1' + fcs(b'\0\1'), []),
-    (b'\0\1' + fcs(b'\0\1') + b'\x7e',
-     [Expected(0, b'\1', b'', FrameStatus.INCOMPLETE)]),
-    'No frames emitted until flag',
-    (_encode(1, 2, b'3')[:-1], []),
-    (b'\x7e' + _encode(1, 2, b'3')[1:-1] * 2, []),
-)  # yapf: disable
-# Formatting for the above tuple is very slow, so disable yapf.
-
-_TESTS = TestGenerator(TEST_CASES)
-
-
-def _expected(frames: List[Frame]) -> Iterator[str]:
-    for i, frame in enumerate(frames, 1):
-        if frame.ok():
-            yield f'      Frame(kDecodedFrame{i:02}),'
-        else:
-            yield f'      Status::DATA_LOSS,  // Frame {i}'
-
-
-_CPP_HEADER = """\
-#include "pw_hdlc_lite/decoder.h"
-
-#include <array>
-#include <cstddef>
-#include <variant>
-
-#include "gtest/gtest.h"
-#include "pw_bytes/array.h"
-
-namespace pw::hdlc_lite {
-namespace {
-"""
-
-_CPP_FOOTER = """\
-}  // namespace
-}  // namespace pw::hdlc_lite"""
-
-
-def _cpp_test(ctx: Context) -> Iterator[str]:
-    """Generates a C++ test for the provided test data."""
-    data, _ = ctx.test_case
-    frames = list(FrameDecoder().process(data))
-    data_bytes = ''.join(rf'\x{byte:02x}' for byte in data)
-
-    yield f'TEST(Decoder, {ctx.cc_name()}) {{'
-    yield f'  static constexpr auto kData = bytes::String("{data_bytes}");\n'
-
-    for i, frame in enumerate(frames, 1):
-        if frame.status is FrameStatus.OK:
-            frame_bytes = ''.join(rf'\x{byte:02x}' for byte in frame.raw)
-            yield (f'  static constexpr auto kDecodedFrame{i:02} = '
-                   f'bytes::String("{frame_bytes}");')
-        else:
-            yield f'  // Frame {i}: {frame.status.value}'
-
-    yield ''
-
-    expected = '\n'.join(_expected(frames)) or '      // No frames'
-    decoder_size = max(len(data), 8)  # Make sure large enough for a frame
-
-    yield f"""\
-  DecoderBuffer<{decoder_size}> decoder;
-
-  static constexpr std::array<std::variant<Frame, Status>, {len(frames)}> kExpected = {{
-{expected}
-  }};
-
-  size_t decoded_frames = 0;
-
-  decoder.Process(kData, [&](const Result<Frame>& result) {{
-    ASSERT_LT(decoded_frames++, kExpected.size());
-    auto& expected = kExpected[decoded_frames - 1];
-
-    if (std::holds_alternative<Status>(expected)) {{
-      EXPECT_EQ(Status::DATA_LOSS, result.status());
-    }} else {{
-      ASSERT_EQ(Status::OK, result.status());
-
-      const Frame& decoded_frame = result.value();
-      const Frame& expected_frame = std::get<Frame>(expected);
-      EXPECT_EQ(expected_frame.address(), decoded_frame.address());
-      EXPECT_EQ(expected_frame.control(), decoded_frame.control());
-      ASSERT_EQ(expected_frame.data().size(), decoded_frame.data().size());
-      EXPECT_EQ(std::memcmp(expected_frame.data().data(),
-                            decoded_frame.data().data(),
-                            expected_frame.data().size()),
-                0);
-    }}
-  }});
-
-  EXPECT_EQ(decoded_frames, kExpected.size());
-}}"""
-
-
-def _define_py_test(ctx: Context) -> PyTest:
-    data, expected_frames = ctx.test_case
-
-    def test(self) -> None:
-        # Decode in one call
-        self.assertEqual(expected_frames,
-                         list(FrameDecoder().process(data)),
-                         msg=f'{ctx.group}: {data!r}')
-
-        # Decode byte-by-byte
-        decoder = FrameDecoder()
-        decoded_frames = []
-        for i in range(len(data)):
-            decoded_frames += decoder.process(data[i:i + 1])
-
-        self.assertEqual(expected_frames,
-                         decoded_frames,
-                         msg=f'{ctx.group} (byte-by-byte): {data!r}')
-
-    return test
-
-
-# Class that tests all cases in TEST_CASES.
-DecoderTest = _TESTS.python_tests('DecoderTest', _define_py_test)
-
-if __name__ == '__main__':
-    args = parse_test_generation_args()
-    if args.generate_cc_test:
-        _TESTS.cc_tests(args.generate_cc_test, _cpp_test, _CPP_HEADER,
-                        _CPP_FOOTER)
-    else:
-        unittest.main()
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/encode_test.py b/third_party/pigweed/repo/pw_hdlc_lite/py/encode_test.py
deleted file mode 100755 (executable)
index b0e68ab..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Tests encoding HDLC frames."""
-
-import unittest
-
-from pw_hdlc_lite import encode
-from pw_hdlc_lite import protocol
-from pw_hdlc_lite.protocol import frame_check_sequence as _fcs
-
-FLAG = bytes([protocol.FLAG])
-
-
-def _with_fcs(data: bytes) -> bytes:
-    return data + _fcs(data)
-
-
-class TestEncodeInformationFrame(unittest.TestCase):
-    """Tests Encoding bytes with different arguments using a custom serial."""
-    def test_empty(self):
-        self.assertEqual(encode.information_frame(0, b''),
-                         FLAG + _with_fcs(b'\0\0') + FLAG)
-        self.assertEqual(encode.information_frame(0x1a, b''),
-                         FLAG + _with_fcs(b'\x1a\0') + FLAG)
-
-    def test_1byte(self):
-        self.assertEqual(encode.information_frame(0, b'A'),
-                         FLAG + _with_fcs(b'\0\0A') + FLAG)
-
-    def test_multibyte(self):
-        self.assertEqual(encode.information_frame(0, b'123456789'),
-                         FLAG + _with_fcs(b'\x00\x00123456789') + FLAG)
-
-    def test_escape(self):
-        self.assertEqual(
-            encode.information_frame(0x7e, b'\x7d'),
-            FLAG + b'\x7d\x5e\x00\x7d\x5d' + _fcs(b'\x7e\x00\x7d') + FLAG)
-        self.assertEqual(
-            encode.information_frame(0x7d, b'A\x7e\x7dBC'),
-            FLAG + b'\x7d\x5d\x00A\x7d\x5e\x7d\x5dBC' +
-            _fcs(b'\x7d\x00A\x7e\x7dBC') + FLAG)
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/decode.py b/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/decode.py
deleted file mode 100644 (file)
index 70c63ae..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Decoder class for decoding bytes using HDLC-Lite protocol"""
-
-import enum
-import logging
-from typing import Iterator, NamedTuple, Optional, Tuple
-import zlib
-
-from pw_hdlc_lite import protocol
-
-_LOG = logging.getLogger('pw_hdlc_lite')
-
-
-class FrameStatus(enum.Enum):
-    """Indicates that an error occurred."""
-    OK = 'OK'
-    FCS_MISMATCH = 'frame check sequence failure'
-    INCOMPLETE = 'incomplete frame'
-    INVALID_ESCAPE = 'invalid escape character'
-
-
-_MIN_FRAME_SIZE = 6  # 1 B address + 1 B control + 4 B CRC-32
-
-NO_ADDRESS = -1
-
-
-class Frame(NamedTuple):
-    """Represents an HDLC frame."""
-
-    # All bytes in the frame (address, control, information, FCS)
-    raw: bytes
-
-    # Whether parsing the frame succeeded.
-    status: FrameStatus = FrameStatus.OK
-
-    @property
-    def address(self) -> int:
-        """The frame's address field (assumes only one byte for now)."""
-        return self.raw[0] if self.raw else NO_ADDRESS
-
-    @property
-    def control(self) -> bytes:
-        """The control byte (assumes only one byte for now)."""
-        return self.raw[1:2] if len(self.raw) >= 2 else b''
-
-    @property
-    def data(self) -> bytes:
-        """The information field in the frame."""
-        return self.raw[2:-4] if len(self.raw) >= _MIN_FRAME_SIZE else b''
-
-    def ok(self) -> bool:
-        """True if this represents a valid frame.
-
-        If false, then parsing failed. The status is set to indicate what type
-        of error occurred, and the data field contains all bytes parsed from the
-        frame (including bytes parsed as address or control bytes).
-        """
-        return self.status is FrameStatus.OK
-
-
-class _BaseFrameState:
-    """Base class for all frame parsing states."""
-    def __init__(self, data: bytearray):
-        self._data = data  # All data seen in the current frame
-        self._escape_next = False
-
-    def handle_flag(self) -> Tuple['_BaseFrameState', Optional[Frame]]:
-        """Handles an HDLC flag character (0x7e).
-
-        The HDLC flag is always interpreted as the start of a new frame.
-
-        Returns:
-            (next state, optional frame or error)
-        """
-        # If there is data or an escape character, the frame is incomplete.
-        if self._escape_next or self._data:
-            return _AddressState(), Frame(bytes(self._data),
-                                          FrameStatus.INCOMPLETE)
-
-        return _AddressState(), None
-
-    def handle_escape(self) -> '_BaseFrameState':
-        """Handles an HDLC escape character (0x7d); returns the next state."""
-        if self._escape_next:
-            # If two escapes occur in a row, the frame is invalid.
-            return _InterframeState(self._data, FrameStatus.INVALID_ESCAPE)
-
-        self._escape_next = True
-        return self
-
-    def handle_byte(self, byte: int) -> '_BaseFrameState':
-        """Handles a byte, which may have been escaped; returns next state."""
-        self._data.append(protocol.escape(byte) if self._escape_next else byte)
-        self._escape_next = False
-        return self
-
-
-class _InterframeState(_BaseFrameState):
-    """Not currently in a frame; any data is discarded."""
-    def __init__(self, data: bytearray, error: FrameStatus):
-        super().__init__(data)
-        self._error = error
-
-    def handle_flag(self) -> Tuple[_BaseFrameState, Optional[Frame]]:
-        # If this state was entered due to an error, report that error before
-        # starting a new frame.
-        if self._error is not FrameStatus.OK:
-            return _AddressState(), Frame(bytes(self._data), self._error)
-
-        return super().handle_flag()
-
-
-class _AddressState(_BaseFrameState):
-    """First field in a frame: the address."""
-    def __init__(self):
-        super().__init__(bytearray())
-
-    def handle_byte(self, byte: int) -> _BaseFrameState:
-        super().handle_byte(byte)
-        # Only handle single-byte addresses for now.
-        return _ControlState(self._data)
-
-
-class _ControlState(_BaseFrameState):
-    """Second field in a frame: control."""
-    def handle_byte(self, byte: int) -> _BaseFrameState:
-        super().handle_byte(byte)
-        # Only handle a single control byte for now.
-        return _DataState(self._data)
-
-
-class _DataState(_BaseFrameState):
-    """The information field in a frame."""
-    def handle_flag(self) -> Tuple[_BaseFrameState, Frame]:
-        return _AddressState(), Frame(bytes(self._data), self._check_frame())
-
-    def _check_frame(self) -> FrameStatus:
-        # If the last character was an escape, assume bytes are missing.
-        if self._escape_next or len(self._data) < _MIN_FRAME_SIZE:
-            return FrameStatus.INCOMPLETE
-
-        frame_crc = int.from_bytes(self._data[-4:], 'little')
-        if zlib.crc32(self._data[:-4]) != frame_crc:
-            return FrameStatus.FCS_MISMATCH
-
-        return FrameStatus.OK
-
-
-class FrameDecoder:
-    """Decodes one or more HDLC frames from a stream of data."""
-    def __init__(self):
-        self._data = bytearray()
-        self._unescape_next_byte_flag = False
-        self._state = _InterframeState(bytearray(), FrameStatus.OK)
-
-    def process(self, data: bytes) -> Iterator[Frame]:
-        """Decodes and yields HDLC frames, including corrupt frames.
-
-        The ok() method on Frame indicates whether it is valid or represents a
-        frame parsing error.
-
-        Yields:
-          Frames, which may be valid (frame.ok()) or corrupt (!frame.ok())
-        """
-        for byte in data:
-            frame = self._process_byte(byte)
-            if frame:
-                yield frame
-
-    def process_valid_frames(self, data: bytes) -> Iterator[Frame]:
-        """Decodes and yields valid HDLC frames, logging any errors."""
-        for frame in self.process(data):
-            if frame.ok():
-                yield frame
-            else:
-                _LOG.warning('Failed to decode frame: %s; discarded %d bytes',
-                             frame.status.value, len(frame.data))
-                _LOG.debug('Discarded data: %s', frame.data)
-
-    def _process_byte(self, byte: int) -> Optional[Frame]:
-        if byte == protocol.FLAG:
-            self._state, frame = self._state.handle_flag()
-            return frame
-
-        if byte == protocol.ESCAPE:
-            self._state = self._state.handle_escape()
-        else:
-            self._state = self._state.handle_byte(byte)
-
-        return None
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/encode.py b/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/encode.py
deleted file mode 100644 (file)
index 9db8a30..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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 encode module supports encoding HDLC frames."""
-
-from pw_hdlc_lite import protocol
-
-_ESCAPE_BYTE = bytes([protocol.ESCAPE])
-_FLAG_BYTE = bytes([protocol.FLAG])
-_CONTROL = 0  # Currently, hard-coded to 0; no sequence numbers are used
-
-
-def information_frame(address: int, data: bytes) -> bytes:
-    """Encodes an HDLC I-frame with a CRC-32 frame check sequence."""
-    frame = bytearray([address, _CONTROL]) + data
-    frame += protocol.frame_check_sequence(frame)
-    frame = frame.replace(_ESCAPE_BYTE, b'\x7d\x5d')
-    frame = frame.replace(_FLAG_BYTE, b'\x7d\x5e')
-    return b''.join([_FLAG_BYTE, frame, _FLAG_BYTE])
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/protocol.py b/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/protocol.py
deleted file mode 100644 (file)
index 4f9098a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Module for low-level HDLC protocol features."""
-
-import zlib
-
-# Special flag character for delimiting HDLC frames.
-FLAG = 0x7E
-
-# Special character for escaping other special characters in a frame.
-ESCAPE = 0x7D
-
-
-def escape(byte: int) -> int:
-    """Escapes or unescapes a byte, which should have been preceeded by 0x7d."""
-    return byte ^ 0x20
-
-
-def frame_check_sequence(data: bytes) -> bytes:
-    return zlib.crc32(data).to_bytes(4, 'little')
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/rpc.py b/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/rpc.py
deleted file mode 100644 (file)
index fd7c733..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Utilities for using HDLC with pw_rpc."""
-
-import logging
-import os
-from pathlib import Path
-import sys
-import threading
-import time
-from types import ModuleType
-from typing import Any, BinaryIO, Callable, Iterable, List, NoReturn, Union
-
-from pw_hdlc_lite.decode import FrameDecoder
-from pw_hdlc_lite import encode
-import pw_rpc
-from pw_rpc import callback_client
-from pw_protobuf_compiler import python_protos
-
-_LOG = logging.getLogger(__name__)
-
-STDOUT_ADDRESS = 1
-DEFAULT_ADDRESS = ord('R')
-
-
-def channel_output(writer: Callable[[bytes], Any],
-                   address: int = DEFAULT_ADDRESS,
-                   delay_s: float = 0) -> Callable[[bytes], None]:
-    """Returns a function that can be used as a channel output for pw_rpc."""
-
-    if delay_s:
-
-        def slow_write(data: bytes) -> None:
-            """Slows down writes in case unbuffered serial is in use."""
-            for byte in data:
-                time.sleep(delay_s)
-                writer(bytes([byte]))
-
-        return lambda data: slow_write(encode.information_frame(address, data))
-
-    return lambda data: writer(encode.information_frame(address, data))
-
-
-def read_and_process_data(rpc_client: pw_rpc.Client,
-                          device: BinaryIO,
-                          output: BinaryIO,
-                          output_sep: bytes = os.linesep.encode(),
-                          rpc_address: int = DEFAULT_ADDRESS) -> NoReturn:
-    """Reads HDLC frames from the device and passes them to the RPC client."""
-    decoder = FrameDecoder()
-
-    while True:
-        byte = device.read()
-        for frame in decoder.process_valid_frames(byte):
-            if not frame.ok():
-                _LOG.error('Failed to parse frame: %s', frame.status.value)
-                continue
-
-            if frame.address == rpc_address:
-                if not rpc_client.process_packet(frame.data):
-                    _LOG.error('Packet not handled by RPC client: %s', frame)
-            elif frame.address == STDOUT_ADDRESS:
-                output.write(frame.data)
-                output.write(output_sep)
-                output.flush()
-            else:
-                _LOG.error('Unhandled frame for address %d: %s', frame.address,
-                           frame.data.decoder(errors='replace'))
-
-
-_PathOrModule = Union[str, Path, ModuleType]
-
-
-class HdlcRpcClient:
-    """An RPC client configured to run over HDLC."""
-    def __init__(self,
-                 device: BinaryIO,
-                 proto_paths_or_modules: Iterable[_PathOrModule],
-                 output: BinaryIO = sys.stdout.buffer,
-                 channels: Iterable[pw_rpc.Channel] = None,
-                 client_impl: pw_rpc.client.ClientImpl = None):
-        """Creates an RPC client configured to communicate using HDLC.
-
-        Args:
-          device: serial.Serial (or any BinaryIO class) for reading/writing data
-          proto_paths_or_modules: paths to .proto files or proto modules
-          output: where to write "stdout" output from the device
-        """
-        self.device = device
-
-        proto_modules = []
-        proto_paths: List[Union[Path, str]] = []
-        for proto in proto_paths_or_modules:
-            if isinstance(proto, (Path, str)):
-                proto_paths.append(proto)
-            else:
-                proto_modules.append(proto)
-
-        proto_modules += python_protos.compile_and_import(proto_paths)
-
-        if channels is None:
-            channels = [pw_rpc.Channel(1, channel_output(device.write))]
-
-        if client_impl is None:
-            client_impl = callback_client.Impl()
-
-        self.client = pw_rpc.Client.from_modules(client_impl, channels,
-                                                 proto_modules)
-
-        # Start background thread that reads and processes RPC packets.
-        threading.Thread(target=read_and_process_data,
-                         daemon=True,
-                         args=(self.client, device, output)).start()
-
-    def rpcs(self, channel_id: int = None) -> pw_rpc.client.Services:
-        """Returns object for accessing services on the specified channel.
-
-        This skips some intermediate layers to make it simpler to invoke RPCs
-        from an HdlcRpcClient. If only one channel is in use, the channel ID is
-        not necessary.
-        """
-        if channel_id is None:
-            return next(iter(self.client.channels())).rpcs
-
-        return self.client.channel(channel_id).rpcs
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/rpc_console.py b/third_party/pigweed/repo/pw_hdlc_lite/py/pw_hdlc_lite/rpc_console.py
deleted file mode 100644 (file)
index 64ce81a..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Console for interacting with pw_rpc over HDLC.
-
-To start the console, provide a serial port as the --device argument and paths
-or globs for .proto files that define the RPC services to support:
-
-  python -m pw_hdlc_lite.rpc_console --device /dev/ttyUSB0 sample.proto
-
-This starts an IPython console for communicating with the connected device. A
-few variables are predefined in the interactive console. These include:
-
-    rpcs   - used to invoke RPCs
-    device - the serial device used for communication
-    client - the pw_rpc.Client
-
-An example echo RPC command:
-
-  rpcs.pw.rpc.EchoService.Echo(msg="hello!")
-"""
-
-import argparse
-import glob
-import logging
-from pathlib import Path
-import sys
-from typing import Collection, Iterable, Iterator, BinaryIO
-
-import IPython
-import serial
-
-from pw_hdlc_lite.rpc import HdlcRpcClient
-
-_LOG = logging.getLogger(__name__)
-
-
-def _parse_args():
-    """Parses and returns the command line arguments."""
-    parser = argparse.ArgumentParser(description=__doc__)
-    parser.add_argument('-d',
-                        '--device',
-                        required=True,
-                        help='the serial port to use')
-    parser.add_argument('-b',
-                        '--baudrate',
-                        type=int,
-                        default=115200,
-                        help='the baud rate to use')
-    parser.add_argument(
-        '-o',
-        '--output',
-        type=argparse.FileType('wb'),
-        default=sys.stdout.buffer,
-        help=('The file to which to write device output (HDLC channel 1); '
-              'provide - or omit for stdout.'))
-    parser.add_argument('proto_globs',
-                        nargs='+',
-                        help='glob pattern for .proto files')
-    return parser.parse_args()
-
-
-def _expand_globs(globs: Iterable[str]) -> Iterator[Path]:
-    for pattern in globs:
-        for file in glob.glob(pattern, recursive=True):
-            yield Path(file)
-
-
-def _start_ipython_terminal(client: HdlcRpcClient) -> None:
-    """Starts an interactive IPython terminal with preset variables."""
-    local_variables = dict(
-        client=client,
-        channel_client=client.client.channel(1),
-        rpcs=client.client.channel(1).rpcs,
-    )
-
-    print(__doc__)  # Print the banner
-    IPython.terminal.embed.InteractiveShellEmbed().mainloop(
-        local_ns=local_variables, module=argparse.Namespace())
-
-
-def console(device: str, baudrate: int, proto_globs: Collection[str],
-            output: BinaryIO) -> int:
-    """Starts an interactive RPC console for HDLC."""
-    # argparse.FileType doesn't correctly handle '-' for binary files.
-    if output is sys.stdout:
-        output = sys.stdout.buffer
-
-    if not proto_globs:
-        proto_globs = ['**/*.proto']
-
-    protos = list(_expand_globs(proto_globs))
-
-    if not protos:
-        _LOG.critical('No .proto files were found with %s',
-                      ', '.join(proto_globs))
-        _LOG.critical('At least one .proto file is required')
-        return 1
-
-    _LOG.debug('Found %d .proto files found with %s', len(protos),
-               ', '.join(proto_globs))
-
-    _start_ipython_terminal(
-        HdlcRpcClient(serial.Serial(device, baudrate), protos, output))
-    return 0
-
-
-def main() -> int:
-    return console(**vars(_parse_args()))
-
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/py/setup.py b/third_party/pigweed/repo/pw_hdlc_lite/py/setup.py
deleted file mode 100644 (file)
index dad879d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""pw_hdlc_lite"""
-
-import setuptools
-
-setuptools.setup(
-    name='pw_hdlc_lite',
-    version='0.0.1',
-    author='Pigweed Authors',
-    author_email='pigweed-developers@googlegroups.com',
-    description='Tools for Encoding/Decoding data using the HDLC-Lite protocol',
-    packages=setuptools.find_packages(),
-    install_requires=['ipython'],
-    tests_require=['pw_build'],
-)
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_channel_test.cc b/third_party/pigweed/repo/pw_hdlc_lite/rpc_channel_test.cc
deleted file mode 100644 (file)
index 7e0d0dd..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_hdlc_lite/rpc_channel.h"
-
-#include <algorithm>
-#include <array>
-#include <cstddef>
-
-#include "gtest/gtest.h"
-#include "pw_bytes/array.h"
-#include "pw_stream/memory_stream.h"
-
-using std::byte;
-
-namespace pw::hdlc_lite {
-namespace {
-
-constexpr byte kFlag = byte{0x7E};
-constexpr uint8_t kAddress = 0x7b;  // 123
-constexpr byte kControl = byte{0};
-
-// Size of the in-memory buffer to use for this test.
-constexpr size_t kSinkBufferSize = 15;
-
-TEST(RpcChannelOutput, 1BytePayload) {
-  std::array<byte, kSinkBufferSize> channel_output_buffer;
-  stream::MemoryWriterBuffer<kSinkBufferSize> memory_writer;
-
-  RpcChannelOutput output(
-      memory_writer, channel_output_buffer, kAddress, "RpcChannelOutput");
-
-  constexpr byte test_data = byte{'A'};
-  std::memcpy(output.AcquireBuffer().data(), &test_data, sizeof(test_data));
-
-  constexpr auto expected = bytes::Concat(
-      kFlag, kAddress, kControl, 'A', uint32_t{0xA63E2FA5}, kFlag);
-
-  EXPECT_EQ(Status::Ok(), output.SendAndReleaseBuffer(sizeof(test_data)));
-
-  ASSERT_EQ(memory_writer.bytes_written(), expected.size());
-  EXPECT_EQ(
-      std::memcmp(
-          memory_writer.data(), expected.data(), memory_writer.bytes_written()),
-      0);
-}
-
-TEST(RpcChannelOutput, EscapingPayloadTest) {
-  std::array<byte, kSinkBufferSize> channel_output_buffer;
-  stream::MemoryWriterBuffer<kSinkBufferSize> memory_writer;
-
-  RpcChannelOutput output(
-      memory_writer, channel_output_buffer, kAddress, "RpcChannelOutput");
-
-  constexpr auto test_data = bytes::Array<0x7D>();
-  std::memcpy(
-      output.AcquireBuffer().data(), test_data.data(), test_data.size());
-
-  constexpr auto expected = bytes::Concat(kFlag,
-                                          kAddress,
-                                          kControl,
-                                          byte{0x7d},
-                                          byte{0x7d} ^ byte{0x20},
-                                          uint32_t{0x89515322},
-                                          kFlag);
-  EXPECT_EQ(Status::Ok(), output.SendAndReleaseBuffer(test_data.size()));
-
-  ASSERT_EQ(memory_writer.bytes_written(), 10u);
-  EXPECT_EQ(
-      std::memcmp(
-          memory_writer.data(), expected.data(), memory_writer.bytes_written()),
-      0);
-}
-
-TEST(RpcChannelOutputBuffer, 1BytePayload) {
-  stream::MemoryWriterBuffer<kSinkBufferSize> memory_writer;
-
-  RpcChannelOutputBuffer<kSinkBufferSize> output(
-      memory_writer, kAddress, "RpcChannelOutput");
-
-  constexpr byte test_data = byte{'A'};
-  std::memcpy(output.AcquireBuffer().data(), &test_data, sizeof(test_data));
-
-  constexpr auto expected = bytes::Concat(
-      kFlag, kAddress, kControl, 'A', uint32_t{0xA63E2FA5}, kFlag);
-
-  EXPECT_EQ(Status::Ok(), output.SendAndReleaseBuffer(sizeof(test_data)));
-
-  ASSERT_EQ(memory_writer.bytes_written(), expected.size());
-  EXPECT_EQ(
-      std::memcmp(
-          memory_writer.data(), expected.data(), memory_writer.bytes_written()),
-      0);
-}
-
-}  // namespace
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/BUILD b/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/BUILD
deleted file mode 100644 (file)
index 7e6a30b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-
-load(
-    "//pw_build:pigweed.bzl",
-    "pw_cc_library",
-)
-
-pw_cc_library(
-    name = "rpc_example",
-    srcs = [
-        "hdlc_rpc_server.cc",
-        "main.cc",
-    ],
-    hdrs = [
-        "public/pw_hdlc_lite/decoder.h",
-        "public/pw_hdlc_lite/hdlc_channel.h",
-        "public/pw_hdlc_lite/rpc_server_packets.h",
-    ],
-    deps = [
-        "//pw_hdlc_lite",
-        "//pw_hdlc_lite:pw_rpc",
-        "//pw_rpc:server",
-        "//pw_log",
-    ],
-)
-
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/BUILD.gn b/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/BUILD.gn
deleted file mode 100644 (file)
index 375021f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-
-import("//build_overrides/pigweed.gni")
-
-import("$dir_pw_build/target_types.gni")
-import("$dir_pw_third_party/nanopb/nanopb.gni")
-
-if (dir_pw_third_party_nanopb == "") {
-  group("rpc_example") {
-  }
-} else {
-  pw_executable("rpc_example") {
-    sources = [
-      "hdlc_rpc_server.cc",
-      "main.cc",
-    ]
-    deps = [
-      "$dir_pw_rpc:server",
-      "$dir_pw_rpc/nanopb:echo_service",
-      "..:pw_rpc",
-      dir_pw_hdlc_lite,
-      dir_pw_log,
-    ]
-  }
-}
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/docs.rst b/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/docs.rst
deleted file mode 100644 (file)
index 492ec0e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-.. _module-pw_hdlc_lite-rpc-example:
-
-=============================
-RPC over HDLC example project
-=============================
-The :ref:`module-pw_hdlc_lite` module includes an example of bringing up a
-:ref:`module-pw_rpc` server that can be used to invoke RPCs. The example code
-is located at ``pw_hdlc_lite/rpc_example``. This section walks through invoking
-RPCs interactively and with a script using the RPC over HDLC example.
-
-These instructions assume the STM32F429i Discovery board, but they work with
-any target with :ref:`pw::sys_io <module-pw_sys_io>` implemented.
-
----------------------
-Getting started guide
----------------------
-
-1. Set up your board
-====================
-Connect the board you'll be communicating with. For the Discovery board, connect
-the mini USB port, and note which serial device it appears as (e.g.
-``/dev/ttyACM0``).
-
-2. Build Pigweed
-================
-Activate the Pigweed environment and run the default build.
-
-.. code-block:: sh
-
-  source activate.sh
-  gn gen out
-  ninja -C out
-
-3. Flash the firmware image
-===========================
-After a successful build, the binary for the example will be located at
-``out/<toolchain>/obj/pw_hdlc_lite/rpc_example/bin/rpc_example.elf``.
-
-Flash this image to your board. If you are using the STM32F429i Discovery Board,
-you can flash the image with `OpenOCD <http://openocd.org>`_.
-
-.. code-block:: sh
-
- openocd -f targets/stm32f429i-disc1/py/stm32f429i_disc1_utils/openocd_stm32f4xx.cfg \
-     -c "program out/stm32f429i_disc1_debug/obj/pw_hdlc_lite/rpc_example/bin/rpc_example.elf"
-
-4. Invoke RPCs from in an interactive console
-=============================================
-The RPC console uses `IPython <https://ipython.org>`_ to make a rich interactive
-console for working with pw_rpc. Run the RPC console with the following command,
-replacing ``/dev/ttyACM0`` with the correct serial device for your board.
-
-.. code-block:: text
-
-  $ python -m pw_hdlc_lite.rpc_console --device /dev/ttyACM0
-
-  Console for interacting with pw_rpc over HDLC.
-
-  To start the console, provide a serial port as the --device argument and paths
-  or globs for .proto files that define the RPC services to support:
-
-    python -m pw_hdlc_lite.rpc_console --device /dev/ttyUSB0 sample.proto
-
-  This starts an IPython console for communicating with the connected device. A
-  few variables are predefined in the interactive console. These include:
-
-      rpcs   - used to invoke RPCs
-      device - the serial device used for communication
-      client - the pw_rpc.Client
-
-  An example echo RPC command:
-
-    rpcs.pw.rpc.EchoService.Echo(msg="hello!")
-
-  In [1]:
-
-RPCs may be accessed through the predefined ``rpcs`` variable. RPCs are
-organized by their protocol buffer package and RPC service, as defined in a
-.proto file. To call the ``Echo`` method is part of the ``EchoService``, which
-is in the ``pw.rpc`` package. To invoke it synchronously, call
-``rpcs.pw.rpc.EchoService.Echo``:
-
-.. code-block:: python
-
-    In [1]: rpcs.pw.rpc.EchoService.Echo(msg="Your message here!")
-    Out[1]: (<Status.OK: 0>, msg: "Your message here!")
-
-5. Invoke RPCs with a script
-============================
-RPCs may also be invoked from Python scripts. Close the RPC console if it is
-running, and execute the example script. Set the --device argument to the
-serial port for your device.
-
-.. code-block:: text
-
-  $ pw_hdlc_lite/rpc_example/example_script.py --device /dev/ttyACM0
-  The status was Status.OK
-  The payload was msg: "Hello"
-
-  The device says: Goodbye!
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/example_script.py b/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/example_script.py
deleted file mode 100755 (executable)
index b8b2b0f..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Simple example script that uses pw_rpc."""
-
-import argparse
-import os
-from pathlib import Path
-
-import serial
-
-from pw_hdlc_lite.rpc import HdlcRpcClient
-
-# Point the script to the .proto file with our RPC services.
-PROTO = Path(os.environ['PW_ROOT'], 'pw_rpc/pw_rpc_protos/echo.proto')
-
-
-def script(device: str, baud: int) -> None:
-    # Set up a pw_rpc client that uses HDLC.
-    client = HdlcRpcClient(serial.Serial(device, baud), [PROTO])
-
-    # Make a shortcut to the EchoService.
-    echo_service = client.rpcs().pw.rpc.EchoService
-
-    # Call some RPCs and check the results.
-    status, payload = echo_service.Echo(msg='Hello')
-
-    if status.ok():
-        print('The status was', status)
-        print('The payload was', payload)
-    else:
-        print('Uh oh, this RPC returned', status)
-
-    status, payload = echo_service.Echo(msg='Goodbye!')
-
-    print('The device says:', payload.msg)
-
-
-def main():
-    parser = argparse.ArgumentParser(
-        description=__doc__,
-        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
-    parser.add_argument('--device',
-                        '-d',
-                        default='/dev/ttyACM0',
-                        help='serial device to use')
-    parser.add_argument('--baud',
-                        '-b',
-                        type=int,
-                        default=115200,
-                        help='baud rate for the serial device')
-    script(**vars(parser.parse_args()))
-
-
-if __name__ == '__main__':
-    main()
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/hdlc_rpc_server.cc b/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/hdlc_rpc_server.cc
deleted file mode 100644 (file)
index 319ee1b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <array>
-#include <span>
-#include <string_view>
-
-#include "pw_hdlc_lite/encoder.h"
-#include "pw_hdlc_lite/rpc_channel.h"
-#include "pw_hdlc_lite/rpc_packets.h"
-#include "pw_hdlc_lite/sys_io_stream.h"
-#include "pw_log/log.h"
-#include "pw_rpc/echo_service_nanopb.h"
-#include "pw_rpc/server.h"
-
-namespace hdlc_example {
-namespace {
-
-using std::byte;
-
-constexpr size_t kMaxTransmissionUnit = 256;
-
-// Used to write HDLC data to pw::sys_io.
-pw::stream::SysIoWriter writer;
-
-// Set up the output channel for the pw_rpc server to use to use.
-pw::hdlc_lite::RpcChannelOutputBuffer<kMaxTransmissionUnit> hdlc_channel_output(
-    writer, pw::hdlc_lite::kDefaultRpcAddress, "HDLC channel");
-
-pw::rpc::Channel channels[] = {
-    pw::rpc::Channel::Create<1>(&hdlc_channel_output)};
-
-// Declare the pw_rpc server with the HDLC channel.
-pw::rpc::Server server(channels);
-
-pw::rpc::EchoService echo_service;
-
-void RegisterServices() { server.RegisterService(echo_service); }
-
-}  // namespace
-
-void Start() {
-  // Send log messages to HDLC address 1. This prevents logs from interfering
-  // with pw_rpc communications.
-  pw::log_basic::SetOutput([](std::string_view log) {
-    pw::hdlc_lite::WriteInformationFrame(
-        1, std::as_bytes(std::span(log)), writer);
-  });
-
-  // Set up the server and start processing data.
-  RegisterServices();
-
-  // Declare a buffer for decoding incoming HDLC frames.
-  std::array<std::byte, kMaxTransmissionUnit> input_buffer;
-
-  PW_LOG_INFO("Starting pw_rpc server");
-  pw::hdlc_lite::ReadAndProcessPackets(
-      server, hdlc_channel_output, input_buffer);
-}
-
-}  // namespace hdlc_example
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/main.cc b/third_party/pigweed/repo/pw_hdlc_lite/rpc_example/main.cc
deleted file mode 100644 (file)
index 2b6f656..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-
-namespace hdlc_example {
-
-void Start();
-
-}  // namespace hdlc_example
-
-int main() {
-  hdlc_example::Start();
-  return 0;
-}
diff --git a/third_party/pigweed/repo/pw_hdlc_lite/rpc_packets.cc b/third_party/pigweed/repo/pw_hdlc_lite/rpc_packets.cc
deleted file mode 100644 (file)
index 95e95b3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_hdlc_lite/rpc_packets.h"
-
-#include "pw_status/try.h"
-#include "pw_sys_io/sys_io.h"
-
-namespace pw::hdlc_lite {
-
-Status ReadAndProcessPackets(rpc::Server& server,
-                             rpc::ChannelOutput& output,
-                             std::span<std::byte> decode_buffer,
-                             unsigned rpc_address) {
-  Decoder decoder(decode_buffer);
-
-  while (true) {
-    std::byte data;
-    PW_TRY(sys_io::ReadByte(&data));
-
-    if (auto result = decoder.Process(data); result.ok()) {
-      Frame& frame = result.value();
-      if (frame.address() == rpc_address) {
-        server.ProcessPacket(frame.data(), output);
-      }
-    }
-  }
-}
-
-}  // namespace pw::hdlc_lite
diff --git a/third_party/pigweed/repo/pw_log_rpc/log_queue.cc b/third_party/pigweed/repo/pw_log_rpc/log_queue.cc
deleted file mode 100644 (file)
index e23ca16..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_log_rpc/log_queue.h"
-
-#include "pw_log/levels.h"
-#include "pw_log_rpc_proto/log.pwpb.h"
-#include "pw_protobuf/wire_format.h"
-#include "pw_status/try.h"
-
-namespace pw::log_rpc {
-namespace {
-
-using pw::protobuf::WireType;
-constexpr std::byte kLogKey = static_cast<std::byte>(pw::protobuf::MakeKey(
-    static_cast<uint32_t>(pw::log_rpc::Log::Fields::ENTRIES),
-    WireType::kDelimited));
-
-}  // namespace
-
-Status LogQueue::PushTokenizedMessage(ConstByteSpan message,
-                                      uint32_t flags,
-                                      uint32_t level,
-                                      uint32_t line,
-                                      uint32_t thread,
-                                      int64_t timestamp) {
-  pw::protobuf::NestedEncoder nested_encoder(encode_buffer_);
-  LogEntry::Encoder encoder(&nested_encoder);
-  Status status;
-
-  encoder.WriteMessageTokenized(message);
-  encoder.WriteLineLevel(
-      (level & PW_LOG_LEVEL_BITMASK) |
-      ((line << PW_LOG_LEVEL_BITWIDTH) & ~PW_LOG_LEVEL_BITMASK));
-  encoder.WriteFlags(flags);
-  encoder.WriteThreadTokenized(thread);
-
-  // TODO(prashanthsw): Add support for delta encoding of the timestamp.
-  encoder.WriteTimestamp(timestamp);
-
-  if (dropped_entries_ > 0) {
-    encoder.WriteDropped(dropped_entries_);
-  }
-
-  ConstByteSpan log_entry;
-  status = nested_encoder.Encode(&log_entry);
-  if (!status.ok()) {
-    // When encoding failures occur, map the error to INTERNAL, as the
-    // underlying allocation of this encode buffer and the nested encoding
-    // sequencing are not the caller's responsibility.
-    status = PW_STATUS_INTERNAL;
-  } else {
-    // Try to push back the encoded log entry.
-    status = ring_buffer_.TryPushBack(log_entry, std::byte(kLogKey));
-  }
-
-  if (!status.ok()) {
-    // The ring buffer may hit the RESOURCE_EXHAUSTED state, causing us
-    // to drop packets. However, this check captures all failures from
-    // Encode and TryPushBack, as any failure here causes packet drop.
-    dropped_entries_++;
-    latest_dropped_timestamp_ = timestamp;
-    return status;
-  }
-
-  dropped_entries_ = 0;
-  return Status::Ok();
-}
-
-Result<ConstByteSpan> LogQueue::Pop(ByteSpan entry_buffer) {
-  size_t ring_buffer_entry_size = 0;
-  PW_TRY(ring_buffer_.PeekFrontWithPreamble(entry_buffer,
-                                            &ring_buffer_entry_size));
-  PW_DCHECK_OK(ring_buffer_.PopFront());
-  return ConstByteSpan(entry_buffer.first(ring_buffer_entry_size));
-}
-
-Result<ConstByteSpan> LogQueue::PopMultiple(ByteSpan entries_buffer) {
-  size_t offset = 0;
-  while (ring_buffer_.EntryCount() > 0 &&
-         (entries_buffer.size_bytes() - offset) >
-             ring_buffer_.FrontEntryTotalSizeBytes()) {
-    const Result<ConstByteSpan> result = Pop(entries_buffer.subspan(offset));
-    if (!result.ok()) {
-      break;
-    }
-    offset += result.value().size_bytes();
-  }
-  return ConstByteSpan(entries_buffer.first(offset));
-}
-
-}  // namespace pw::log_rpc
diff --git a/third_party/pigweed/repo/pw_log_rpc/log_queue_test.cc b/third_party/pigweed/repo/pw_log_rpc/log_queue_test.cc
deleted file mode 100644 (file)
index 2f648fd..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_log_rpc/log_queue.h"
-
-#include "gtest/gtest.h"
-#include "pw_log/levels.h"
-#include "pw_log_rpc_proto/log.pwpb.h"
-#include "pw_protobuf/decoder.h"
-
-namespace pw::log_rpc {
-namespace {
-
-constexpr size_t kEncodeBufferSize = 512;
-
-constexpr const char kTokenizedMessage[] = "msg_token";
-constexpr uint32_t kFlags = 0xF;
-constexpr uint32_t kLevel = 0b010;
-constexpr uint32_t kLine = 0b101011000;
-constexpr uint32_t kTokenizedThread = 0xF;
-constexpr int64_t kTimestamp = 0;
-
-constexpr size_t kLogBufferSize = kEncodeBufferSize * 3;
-
-void VerifyLogEntry(pw::protobuf::Decoder& log_decoder,
-                    const char* expected_tokenized_message,
-                    const uint32_t expected_flags,
-                    const uint32_t expected_level,
-                    const uint32_t expected_line,
-                    const uint32_t expected_tokenized_thread,
-                    const int64_t expected_timestamp) {
-  ConstByteSpan log_entry_message;
-  EXPECT_TRUE(log_decoder.Next().ok());  // preamble
-  EXPECT_EQ(1U, log_decoder.FieldNumber());
-  EXPECT_TRUE(log_decoder.ReadBytes(&log_entry_message).ok());
-
-  pw::protobuf::Decoder entry_decoder(log_entry_message);
-  ConstByteSpan tokenized_message;
-  EXPECT_TRUE(entry_decoder.Next().ok());  // tokenized_message
-  EXPECT_EQ(1U, entry_decoder.FieldNumber());
-  EXPECT_TRUE(entry_decoder.ReadBytes(&tokenized_message).ok());
-  EXPECT_TRUE(std::memcmp(tokenized_message.begin(),
-                          (const void*)expected_tokenized_message,
-                          tokenized_message.size()) == 0);
-
-  uint32_t line_level;
-  EXPECT_TRUE(entry_decoder.Next().ok());  // line_level
-  EXPECT_EQ(2U, entry_decoder.FieldNumber());
-  EXPECT_TRUE(entry_decoder.ReadUint32(&line_level).ok());
-  EXPECT_EQ(expected_level, line_level & PW_LOG_LEVEL_BITMASK);
-  EXPECT_EQ(expected_line,
-            (line_level & ~PW_LOG_LEVEL_BITMASK) >> PW_LOG_LEVEL_BITWIDTH);
-
-  uint32_t flags;
-  EXPECT_TRUE(entry_decoder.Next().ok());  // flags
-  EXPECT_EQ(3U, entry_decoder.FieldNumber());
-  EXPECT_TRUE(entry_decoder.ReadUint32(&flags).ok());
-  EXPECT_EQ(expected_flags, flags);
-
-  uint32_t tokenized_thread;
-  EXPECT_TRUE(entry_decoder.Next().ok());  // tokenized_thread
-  EXPECT_EQ(4U, entry_decoder.FieldNumber());
-  EXPECT_TRUE(entry_decoder.ReadUint32(&tokenized_thread).ok());
-  EXPECT_EQ(expected_tokenized_thread, tokenized_thread);
-
-  int64_t timestamp;
-  EXPECT_TRUE(entry_decoder.Next().ok());  // timestamp
-  EXPECT_EQ(5U, entry_decoder.FieldNumber());
-  EXPECT_TRUE(entry_decoder.ReadInt64(&timestamp).ok());
-  EXPECT_EQ(expected_timestamp, timestamp);
-}
-
-}  // namespace
-
-TEST(LogQueue, SinglePushPopTokenizedMessage) {
-  std::byte log_buffer[kLogBufferSize];
-  LogQueueWithEncodeBuffer<kEncodeBufferSize> log_queue(log_buffer);
-
-  EXPECT_EQ(Status::OK,
-            log_queue.PushTokenizedMessage(
-                std::as_bytes(std::span(kTokenizedMessage)),
-                kFlags,
-                kLevel,
-                kLine,
-                kTokenizedThread,
-                kTimestamp));
-
-  std::byte log_entry[kEncodeBufferSize];
-  Result<ConstByteSpan> pop_result = log_queue.Pop(std::span(log_entry));
-  EXPECT_TRUE(pop_result.ok());
-
-  pw::protobuf::Decoder log_decoder(pop_result.value());
-  VerifyLogEntry(log_decoder,
-                 kTokenizedMessage,
-                 kFlags,
-                 kLevel,
-                 kLine,
-                 kTokenizedThread,
-                 kTimestamp);
-}
-
-TEST(LogQueue, MultiplePushPopTokenizedMessage) {
-  constexpr int kEntryCount = 3;
-
-  std::byte log_buffer[1024];
-  LogQueueWithEncodeBuffer<kEncodeBufferSize> log_queue(log_buffer);
-
-  for (int i = 0; i < kEntryCount; i++) {
-    EXPECT_EQ(Status::OK,
-              log_queue.PushTokenizedMessage(
-                  std::as_bytes(std::span(kTokenizedMessage)),
-                  kFlags,
-                  kLevel,
-                  kLine + (i << 3),
-                  kTokenizedThread,
-                  kTimestamp + i));
-  }
-
-  std::byte log_entry[kEncodeBufferSize];
-  for (int i = 0; i < kEntryCount; i++) {
-    Result<ConstByteSpan> pop_result = log_queue.Pop(std::span(log_entry));
-    EXPECT_TRUE(pop_result.ok());
-
-    pw::protobuf::Decoder log_decoder(pop_result.value());
-    VerifyLogEntry(log_decoder,
-                   kTokenizedMessage,
-                   kFlags,
-                   kLevel,
-                   kLine + (i << 3),
-                   kTokenizedThread,
-                   kTimestamp + i);
-  }
-}
-
-TEST(LogQueue, PopMultiple) {
-  constexpr int kEntryCount = 3;
-
-  std::byte log_buffer[kLogBufferSize];
-  LogQueueWithEncodeBuffer<kEncodeBufferSize> log_queue(log_buffer);
-
-  for (int i = 0; i < kEntryCount; i++) {
-    EXPECT_EQ(Status::OK,
-              log_queue.PushTokenizedMessage(
-                  std::as_bytes(std::span(kTokenizedMessage)),
-                  kFlags,
-                  kLevel,
-                  kLine + (i << 3),
-                  kTokenizedThread,
-                  kTimestamp + i));
-  }
-
-  std::byte log_entries[kLogBufferSize];
-  Result<ConstByteSpan> pop_result = log_queue.PopMultiple(log_entries);
-  EXPECT_TRUE(pop_result.ok());
-
-  pw::protobuf::Decoder log_decoder(pop_result.value());
-  for (int i = 0; i < kEntryCount; i++) {
-    VerifyLogEntry(log_decoder,
-                   kTokenizedMessage,
-                   kFlags,
-                   kLevel,
-                   kLine + (i << 3),
-                   kTokenizedThread,
-                   kTimestamp + i);
-  }
-}
-
-TEST(LogQueue, TooSmallEncodeBuffer) {
-  constexpr size_t kSmallBuffer = 1;
-
-  std::byte log_buffer[kLogBufferSize];
-  LogQueueWithEncodeBuffer<kSmallBuffer> log_queue(log_buffer);
-  EXPECT_EQ(Status::INTERNAL,
-            log_queue.PushTokenizedMessage(
-                std::as_bytes(std::span(kTokenizedMessage)),
-                kFlags,
-                kLevel,
-                kLine,
-                kTokenizedThread,
-                kTimestamp));
-}
-
-TEST(LogQueue, TooSmallLogBuffer) {
-  constexpr size_t kSmallerThanPreamble = 1;
-  constexpr size_t kEntryCount = 100;
-
-  // Expect OUT_OF_RANGE when the buffer is smaller than a preamble.
-  std::byte log_buffer[kLogBufferSize];
-  LogQueueWithEncodeBuffer<kEncodeBufferSize> log_queue_small(
-      std::span(log_buffer, kSmallerThanPreamble));
-  EXPECT_EQ(Status::OUT_OF_RANGE,
-            log_queue_small.PushTokenizedMessage(
-                std::as_bytes(std::span(kTokenizedMessage)),
-                kFlags,
-                kLevel,
-                kLine,
-                kTokenizedThread,
-                kTimestamp));
-
-  // Expect RESOURCE_EXHAUSTED when there's not enough space for the chunk.
-  LogQueueWithEncodeBuffer<kEncodeBufferSize> log_queue_medium(log_buffer);
-  for (size_t i = 0; i < kEntryCount; i++) {
-    log_queue_medium.PushTokenizedMessage(
-        std::as_bytes(std::span(kTokenizedMessage)),
-        kFlags,
-        kLevel,
-        kLine,
-        kTokenizedThread,
-        kTimestamp);
-  }
-  EXPECT_EQ(Status::RESOURCE_EXHAUSTED,
-            log_queue_medium.PushTokenizedMessage(
-                std::as_bytes(std::span(kTokenizedMessage)),
-                kFlags,
-                kLevel,
-                kLine,
-                kTokenizedThread,
-                kTimestamp));
-}
-
-}  // namespace pw::log_rpc
diff --git a/third_party/pigweed/repo/pw_log_rpc/public/pw_log_rpc/log_queue.h b/third_party/pigweed/repo/pw_log_rpc/public/pw_log_rpc/log_queue.h
deleted file mode 100644 (file)
index 4c35893..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_bytes/span.h"
-#include "pw_result/result.h"
-#include "pw_ring_buffer/prefixed_entry_ring_buffer.h"
-#include "pw_status/status.h"
-#include "pw_status/status_with_size.h"
-
-// LogQueue is a ring-buffer queue of log messages. LogQueue is backed by
-// a caller-provided byte array and stores its messages in the format
-// dictated by the pw_rpc_log log.proto format.
-//
-// Logs can be returned as a repeated proto message and the output of this
-// class can be directly fed into an RPC stream.
-//
-// Push logs:
-// 0) Create LogQueue instance.
-// 1) LogQueue::PushTokenizedMessage().
-//
-// Pop logs:
-// 0) Use exsiting LogQueue instance.
-// 1) For single entires, LogQueue::Pop().
-// 2) For multiple entries, LogQueue::PopMultiple().
-namespace pw::log_rpc {
-
-class LogQueue {
- public:
-  LogQueue(ByteSpan log_buffer, ByteSpan encode_buffer)
-      : encode_buffer_(encode_buffer), ring_buffer_(true) {
-    ring_buffer_.SetBuffer(log_buffer);
-  }
-
-  LogQueue(const LogQueue&) = delete;
-  LogQueue& operator=(const LogQueue&) = delete;
-  LogQueue(LogQueue&&) = delete;
-  LogQueue& operator=(LogQueue&&) = delete;
-
-  // Construct a LogEntry proto message and push it into the ring buffer.
-  // Returns:
-  //
-  //  OK - success.
-  //  FAILED_PRECONDITION - Failed when encoding the proto message.
-  //  RESOURCE_EXHAUSTED - Not enough space in the buffer to write the entry.
-  pw::Status PushTokenizedMessage(ConstByteSpan message,
-                                  uint32_t flags,
-                                  uint32_t level,
-                                  uint32_t line,
-                                  uint32_t thread,
-                                  int64_t timestamp);
-
-  // Pop the oldest LogEntry from the queue into the provided buffer.
-  // On success, the size is the length of the entry, on failure, the size is 0.
-  // Returns:
-  //
-  // For now, don't support batching. This will always use a single absolute
-  // timestamp, and not use delta encoding.
-  //
-  //  OK - success.
-  //  OUT_OF_RANGE - No entries in queue to read.
-  //  RESOURCE_EXHAUSTED - Destination data std::span was smaller number of
-  //  bytes than the data size of the data chunk being read.  Available
-  //  destination bytes were filled, remaining bytes of the data chunk were
-  //  ignored.
-  pw::Result<ConstByteSpan> Pop(ByteSpan entry_buffer);
-
-  // Pop entries from the queue into the provided buffer. The provided buffer is
-  // filled until there is insufficient space for the next log entry.
-  //
-  //  OK - success.
-  pw::Result<ConstByteSpan> PopMultiple(ByteSpan entries_buffer);
-
- private:
-  size_t dropped_entries_;
-  int64_t latest_dropped_timestamp_;
-
-  ByteSpan encode_buffer_;
-  pw::ring_buffer::PrefixedEntryRingBuffer ring_buffer_{true};
-};
-
-// LogQueueWithEncodeBuffer is a LogQueue where the internal encode buffer is
-// created and managed by this class.
-template <size_t kEncodeBufferSize>
-class LogQueueWithEncodeBuffer : public LogQueue {
- public:
-  LogQueueWithEncodeBuffer(ByteSpan log_buffer)
-      : LogQueue(log_buffer, encode_buffer_) {}
-
- private:
-  std::byte encode_buffer_[kEncodeBufferSize];
-};
-
-}  // namespace pw::log_rpc
diff --git a/third_party/pigweed/repo/pw_log_rpc/pw_log_rpc_proto/log.proto b/third_party/pigweed/repo/pw_log_rpc/pw_log_rpc_proto/log.proto
deleted file mode 100644 (file)
index 052f866..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-
-syntax = "proto2";
-
-package pw.log_rpc;
-
-option java_package = "pw.rpc.proto";
-option java_outer_classname = "Log";
-
-message Log {
-  repeated LogEntry entries = 1;
-}
-
-// A log with a tokenized message, a string message, or dropped indicator.  A
-// message can be one of three types:
-//
-//  1. A tokenized log message (recommended for production)
-//  2. A non-tokenized log message (good for development)
-//  3. A "log missed" tombstone, indicating that some logs were dropped
-//
-// Size analysis:
-//
-// For tokenized log messages in the common case; including the proto tag for
-// the field (so adding the fields gives the total proto message size):
-//
-//  - message_tokenized  - 6-12 bytes, depending on # and value of arguments
-//  - line_level         - 3 bytes; 4 bytes if line > 2048 (uncommon)
-//  - timestamp          - 3 bytes; assuming delta encoding
-//  - thread_tokenized   - 3 bytes
-//
-// Total:
-//
-//    6-12 bytes - log
-//    9-15 bytes - log + level + line
-//   12-18 bytes - log + level + line + timestamp
-//   15-21 bytes - log + level + line + timestamp + task
-//
-// An analysis of a project's log token database revealed the following
-// distribution of the number of arguments to log messages:
-//
-//   # args   # messages
-//     0         2,700
-//     1         2,400
-//     2         1,200
-//     3+        1,000
-//
-// Note: The below proto makes some compromises compared to what one might
-// expect for a "clean" proto design, in order to shave bytes off of the
-// messages. It is critical that the log messages are as small as possible to
-// enable storing more logs in limited memory. This is why, for example, there
-// is no separate "DroppedLog" type, or a "TokenizedLog" and "StringLog", which
-// would add at least 2 extra bytes per message
-// Note: Time-related fields will likely support specifying the time as a ratio
-// (period) and an absolute time separate from the current delta fields.
-message LogEntry {
-  // The tokenized log message. Internally, the format has a 32-bit token
-  // followed by the arguments for that message. The unformatted log string
-  // corresponding to the token in the token database must follow this format:
-  //
-  //   file|module|message
-  //
-  // For example:
-  //
-  //   ../boot/bluetooth.cc|BOOT|Bluetooth is on the fritz; error code: %d
-  //
-  // Note: The level and flags are not included since level and flags are
-  // runtime values and so cannot be tokenized.
-  //
-  // Size analysis:
-  //
-  //   tag+wire = 1 byte
-  //   size     = 1 byte; payload will almost always be < 127 bytes
-  //   payload  = N bytes; typically 4-10 in practice
-  //
-  // Total: 2 + N ~= 6-12 bytes
-  optional bytes message_tokenized = 1;
-
-  // Packed log level and line number. Structure:
-  //
-  //   Level: Bottom 3 bits; level = line_level & 0x7
-  //   Line: Remaining bits; line = (line_level >> 3)
-  //
-  // Note: This packing saves two bytes per log message in most cases compared
-  // to having line and level separately; and is zero-cost if the log backend
-  // omits the line number.
-  optional uint32 line_level = 2;
-
-  // Some log messages have flags to indicate for example assert or PII. The
-  // particular flags are product- and implementation-dependent. When no flags
-  // are present, the field is omitted entirely.
-  optional uint32 flags = 3;
-
-  // The task or thread that created the log message.
-  //
-  // In practice, the task token and tag should be just 3 bytes, since a 14 bit
-  // token for the task name should be enough.
-  optional uint32 thread_tokenized = 4;
-
-  // Timestamp. Note: The units here are TBD and will likely require a separate
-  // mechanism to indicate units. This field is likely to change as we figure
-  // out the right strategy for timestamps in Pigweed. This is a variable-sized
-  // integer to enable scaling this up to a uint64 later on without impacting
-  // the wire format.
-  optional int64 timestamp = 5;
-
-  // Time since the last entry. Generally, one of timestamp or this field will
-  // be specified. This enables delta encoding when batching entries together.
-  //
-  // Size analysis for this field including tag and varint:
-  //
-  //           < 127 ms gap == 127 ms      ==  7 bits == 2 bytes
-  //        < 16,000 ms gap ==  16 seconds == 14 bits == 3 bytes
-  //     < 2,000,000 ms gap ==  35 minutes == 21 bits == 4 bytes
-  //   < 300,000,000 ms gap ==  74 hours   == 28 bits == 5 bytes
-  //
-  // Log bursts will thus consume just 2 bytes (tag + up to 127ms delta) for
-  // the timestamp, which is a good improvement over timestamp in many cases.
-  // Note: The units of this field are TBD and will likely require a separate
-  // mechanism to indicate units. The calculations above assume milliseconds
-  // and may change if the units differ.
-  optional int64 elapsed_time_since_last_entry = 6;
-
-  // Fully formatted textual log message.
-  optional string message_string = 16;
-
-  // For non-tokenized logging, the file name.
-  optional string file = 17;
-
-  // String representation of the task that created the log message.
-  optional string thread_string = 18;
-
-  // When the log buffers are full but more logs come in, the logs are counted
-  // and a special log message is omitted with only counts for the number of
-  // messages dropped. The timestamp indicates the time that the "missed logs"
-  // message was inserted into the queue.
-  //
-  // Missed logs messages will only have one of the timestamp fields and these
-  // counters specified.
-  optional uint32 dropped = 19;
-  optional uint32 dropped_warning_or_above = 20;
-
-  // Some messages are associated with trace events, which may carry additional
-  // contextual data. This is a tuple of a data format string which could be
-  // used by the decoder to identify the data (e.g. printf-style tokens) and the
-  // data itself in bytes.
-  optional string data_format_string = 21;
-  optional bytes data = 22;
-}
diff --git a/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/full_test.proto b/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/full_test.proto
deleted file mode 100644 (file)
index 7262d32..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-// This is a test .proto file for pw_protobuf's codegen implementation.
-
-package pw.protobuf.test;
-
-// Top-level enum definition.
-enum Bool {
-  TRUE = 0;
-  FALSE = 1;
-  FILE_NOT_FOUND = 2;
-}
-
-// A message!
-message Pigweed {
-  // Nested messages and enums.
-  message Pigweed {
-    enum Binary {
-      ZERO = 0;
-      ONE = 1;
-    }
-
-    Bool status = 1;
-  }
-
-  message Protobuf {
-    enum Binary {
-      ONE = 0;
-      ZERO = 1;
-    }
-
-    // We must go deeper.
-    message Compiler {
-      enum Status {
-        OK = 0;
-        ERROR = 1;
-        FUBAR = 2;
-      }
-
-      string file_name = 1;
-      Status status = 2;
-      Binary protobuf_bin = 3;
-      Pigweed.Binary pigweed_bin = 4;
-    }
-
-    Binary binary_value = 1;
-  }
-
-  // Regular types.
-  uint32 magic_number = 1;
-  sint32 ziggy = 2;
-  fixed64 cycles = 3;
-  float ratio = 4;
-  string error_message = 5;
-
-  DeviceInfo device_info = 6;
-
-  // Nested messages and enums as fields.
-  Pigweed pigweed = 7;
-  Protobuf.Binary bin = 8;
-
-  Proto proto = 9;
-  repeated Proto.ID id = 10;
-}
-
-// Another message.
-message Proto {
-  enum Binary {
-    OFF = 0;
-    ON = 1;
-  }
-
-  message ID {
-    uint32 id = 1;
-  }
-
-  // Circular dependency with Pigweed.
-  Pigweed pigweed = 1;
-
-  // Same name, different namespace.
-  Binary bin = 2;
-  Pigweed.Pigweed.Binary pigweed_pigweed_bin = 3;
-  Pigweed.Protobuf.Binary pigweed_protobuf_bin = 4;
-
-  Pigweed.Protobuf.Compiler meta = 5;
-}
-
-// Yet another message.
-message DeviceInfo {
-  enum DeviceStatus {
-    OK = 0;
-    ASSERT = 1;
-    FAULT = 2;
-    PANIC = 3;
-  }
-
-  string device_name = 1;
-  fixed32 device_id = 2;
-  DeviceStatus status = 3;
-
-  repeated KeyValuePair attributes = 4;
-}
-
-// This might be useful.
-message KeyValuePair {
-  string key = 1;
-  string value = 2;
-}
diff --git a/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/imported.proto b/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/imported.proto
deleted file mode 100644 (file)
index c375380..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-package pw.protobuf.test.imported;
-
-message Timestamp {
-  uint64 seconds = 1;
-  uint32 nanoseconds = 2;
-}
diff --git a/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/importer.proto b/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/importer.proto
deleted file mode 100644 (file)
index 298a88c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-import 'pw_protobuf_protos/test_protos/imported.proto';
-
-package pw.protobuf.test;
-
-message Period {
-  imported.Timestamp start = 1;
-  imported.Timestamp end = 2;
-}
diff --git a/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/non_pw_package.proto b/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/non_pw_package.proto
deleted file mode 100644 (file)
index ddc11ff..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-// Test that non-pigweed packages work as expected when generating code. Pigweed
-// packages start with `package pw.*` which results in some implicit
-// namespacing in generated code.
-package non.pigweed.package.name;
-
-// Packed has both a repeated and length delimited messaged type. This should
-// result in a span being generated in the corresponding *pwpb.h file.
-message Packed {
-  string packed = 1;
-  repeated int64 rep = 2;
-}
diff --git a/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/proto2.proto b/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/proto2.proto
deleted file mode 100644 (file)
index c8d9e8e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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.
-syntax = "proto2";
-
-package pw.protobuf.test;
-
-message Foo {
-  required uint32 int = 1;
-  optional string str = 2;
-  repeated Bar bar = 3;
-  optional pb pb = 4;
-};
-
-message Bar {
-  optional bytes data = 1;
-};
-
-// This message's name starts with a character which is in the package path,
-// which exposes a bug in the original implementation of the pw_protobuf
-// compiler plugin.
-message pb {
-  optional Foo foo = 1;
-};
diff --git a/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/repeated.proto b/third_party/pigweed/repo/pw_protobuf/pw_protobuf_protos/test_protos/repeated.proto
deleted file mode 100644 (file)
index c281db0..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-package pw.protobuf.test;
-
-message RepeatedTest {
-  repeated uint32 uint32s = 1;
-  repeated sint32 sint32s = 2;
-  repeated string strings = 3;
-  repeated double doubles = 4;
-  repeated Struct structs = 5;
-};
-
-message Struct {
-  uint32 one = 1;
-  uint32 two = 2;
-}
diff --git a/third_party/pigweed/repo/pw_protobuf_compiler/pw_protobuf_compiler_protos/nanopb_test.proto b/third_party/pigweed/repo/pw_protobuf_compiler/pw_protobuf_compiler_protos/nanopb_test.proto
deleted file mode 100644 (file)
index 3a02c41..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-import "nanopb.proto";
-
-package pw.protobuf_compiler;
-
-message Point {
-  uint32 x = 1;
-  uint32 y = 2;
-  string name = 3 [(nanopb).max_size = 16];
-};
diff --git a/third_party/pigweed/repo/pw_protobuf_compiler/py/pw_protobuf_compiler/generator_not_selected.py b/third_party/pigweed/repo/pw_protobuf_compiler/py/pw_protobuf_compiler/generator_not_selected.py
deleted file mode 100644 (file)
index e089cdb..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Emits an error when using a protobuf library that is not generated"""
-
-import argparse
-import sys
-
-
-def parse_args():
-    parser = argparse.ArgumentParser(description=__doc__)
-    parser.add_argument('--library',
-                        required=True,
-                        help='The protobuf library being built')
-    parser.add_argument('--generator',
-                        required=True,
-                        help='The protobuf generator requested')
-    return parser.parse_args()
-
-
-def main(library: str, generator: str):
-    print(f'ERROR: Attempting to build protobuf library {library}, but the '
-          f'{generator} protobuf generator is not in use.')
-    print(f'To use {generator} protobufs, list "{generator}" in '
-          'pw_protobuf_GENERATORS.')
-    sys.exit(1)
-
-
-if __name__ == '__main__':
-    main(**vars(parse_args()))
diff --git a/third_party/pigweed/repo/pw_rpc/nanopb/public/pw_rpc/internal/service_method_traits.h b/third_party/pigweed/repo/pw_rpc/nanopb/public/pw_rpc/internal/service_method_traits.h
deleted file mode 100644 (file)
index a458f44..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_rpc/internal/nanopb_method.h"
-
-namespace pw::rpc::internal {
-
-// Identifies a base class from a member function it defines. This should be
-// used with decltype to retrieve the base class.
-template <typename T, typename U>
-T BaseFromMember(U T::*);
-
-// Gets information about a service and method at compile-time. Uses a pointer
-// to a member function of the service implementation to identify the service
-// class, generated service class, and Method object.This class is friended by
-// the generated service classes to give it access to the internal method list.
-template <auto impl_method>
-class ServiceMethodTraits {
- public:
-  ServiceMethodTraits() = delete;
-
-  // Type of the service implementation derived class.
-  using Service = typename internal::RpcTraits<decltype(impl_method)>::Service;
-
-  // Type of the generic service base class.
-  using BaseService =
-      decltype(BaseFromMember(&Service::_PwRpcInternalGeneratedBase));
-
-  // Reference to the Method object corresponding to this method.
-  static constexpr const NanopbMethod& method() {
-    return *BaseService::template MethodFor<impl_method>();
-  }
-
-  static_assert(BaseService::template MethodFor<impl_method>() != nullptr,
-                "The selected function is not an RPC service method");
-};
-
-}  // namespace pw::rpc::internal
diff --git a/third_party/pigweed/repo/pw_rpc/nanopb/public/pw_rpc/test_method_context.h b/third_party/pigweed/repo/pw_rpc/nanopb/public/pw_rpc/test_method_context.h
deleted file mode 100644 (file)
index 246d966..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <tuple>
-#include <utility>
-
-#include "pw_assert/assert.h"
-#include "pw_containers/vector.h"
-#include "pw_preprocessor/arguments.h"
-#include "pw_rpc/channel.h"
-#include "pw_rpc/internal/hash.h"
-#include "pw_rpc/internal/nanopb_method.h"
-#include "pw_rpc/internal/packet.h"
-#include "pw_rpc/internal/server.h"
-#include "pw_rpc/internal/service_method_traits.h"
-
-namespace pw::rpc {
-
-// Declares a context object that may be used to invoke an RPC. The context is
-// declared with a pointer to the service member function (&Service::Method).
-// The RPC can then be invoked with the call method.
-//
-// For a unary RPC, context.call(request) returns the status, and the response
-// struct can be accessed via context.response().
-//
-//   pw::rpc::TestMethodContext<&my::CoolService::TheMethod> context;
-//   EXPECT_EQ(Status::Ok(), context.call({.some_arg = 123}));
-//   EXPECT_EQ(500, context.response().some_response_value);
-//
-// For a server streaming RPC, context.call(request) invokes the method. As in a
-// normal RPC, the method completes when the ServerWriter's Finish method is
-// called (or it goes out of scope).
-//
-//   pw::rpc::TestMethodContext<&my::CoolService::TheStreamingMethod> context;
-//   context.call({.some_arg = 123});
-//
-//   EXPECT_TRUE(context.done());  // Check that the RPC completed
-//   EXPECT_EQ(Status::Ok(), context.status());  // Check the status
-//
-//   EXPECT_EQ(3u, context.responses().size());
-//   EXPECT_EQ(123, context.responses()[0].value); // check individual responses
-//
-//   for (const MyResponse& response : context.responses()) {
-//     // iterate over the responses
-//   }
-//
-// TestMethodContext forwards its constructor arguments to the underlying
-// serivce. For example:
-//
-//   pw::rpc::TestMethodContext<&MyService::Go> context(serivce, args);
-//
-// pw::rpc::TestMethodContext takes two optional template arguments:
-//
-//   size_t max_responses: maximum responses to store; ignored unless streaming
-//   size_t output_size_bytes: buffer size; must be large enough for a packet
-//
-// Example:
-//
-//   pw::rpc::TestMethodContext<&MyService::BestMethod, 3, 256> context;
-//   ASSERT_EQ(3u, context.responses().max_size());
-//
-template <auto method, size_t max_responses = 4, size_t output_size_bytes = 128>
-class TestMethodContext;
-
-// Internal classes that implement TestMethodContext.
-namespace internal::test {
-
-// A ChannelOutput implementation that stores the outgoing payloads and status.
-template <typename Response>
-class MessageOutput final : public ChannelOutput {
- public:
-  MessageOutput(const internal::NanopbMethod& method,
-                Vector<Response>& responses,
-                std::span<std::byte> buffer)
-      : ChannelOutput("internal::test::MessageOutput"),
-        method_(method),
-        responses_(responses),
-        buffer_(buffer) {
-    clear();
-  }
-
-  Status last_status() const { return last_status_; }
-  void set_last_status(Status status) { last_status_ = status; }
-
-  size_t total_responses() const { return total_responses_; }
-
-  bool stream_ended() const { return stream_ended_; }
-
-  void clear();
-
- private:
-  std::span<std::byte> AcquireBuffer() override { return buffer_; }
-
-  Status SendAndReleaseBuffer(size_t size) override;
-
-  const internal::NanopbMethod& method_;
-  Vector<Response>& responses_;
-  std::span<std::byte> buffer_;
-  size_t total_responses_;
-  bool stream_ended_;
-  Status last_status_;
-};
-
-// Collects everything needed to invoke a particular RPC.
-template <auto method, size_t max_responses, size_t output_size>
-struct InvocationContext {
-  using Request = internal::Request<method>;
-  using Response = internal::Response<method>;
-
-  template <typename... Args>
-  InvocationContext(Args&&... args)
-      : output(ServiceMethodTraits<method>::method(), responses, buffer),
-        channel(Channel::Create<123>(&output)),
-        server(std::span(&channel, 1)),
-        service(std::forward<Args>(args)...),
-        call(static_cast<internal::Server&>(server),
-             static_cast<internal::Channel&>(channel),
-             service,
-             ServiceMethodTraits<method>::method()) {}
-
-  MessageOutput<Response> output;
-
-  rpc::Channel channel;
-  rpc::Server server;
-  typename ServiceMethodTraits<method>::Service service;
-  Vector<Response, max_responses> responses;
-  std::array<std::byte, output_size> buffer = {};
-
-  internal::ServerCall call;
-};
-
-// Method invocation context for a unary RPC. Returns the status in call() and
-// provides the response through the response() method.
-template <auto method, size_t output_size>
-class UnaryContext {
- private:
-  InvocationContext<method, 1, output_size> ctx_;
-
- public:
-  using Request = typename decltype(ctx_)::Request;
-  using Response = typename decltype(ctx_)::Response;
-
-  template <typename... Args>
-  UnaryContext(Args&&... args) : ctx_(std::forward<Args>(args)...) {}
-
-  // Invokes the RPC with the provided request. Returns the status.
-  Status call(const Request& request) {
-    ctx_.output.clear();
-    ctx_.responses.emplace_back();
-    ctx_.responses.back() = {};
-    return (ctx_.service.*method)(
-        ctx_.call.context(), request, ctx_.responses.back());
-  }
-
-  // Gives access to the RPC's response.
-  const Response& response() const {
-    PW_CHECK_UINT_GT(ctx_.responses.size(), 0);
-    return ctx_.responses.back();
-  }
-};
-
-// Method invocation context for a server streaming RPC.
-template <auto method, size_t max_responses, size_t output_size>
-class ServerStreamingContext {
- private:
-  InvocationContext<method, max_responses, output_size> ctx_;
-
- public:
-  using Request = typename decltype(ctx_)::Request;
-  using Response = typename decltype(ctx_)::Response;
-
-  template <typename... Args>
-  ServerStreamingContext(Args&&... args) : ctx_(std::forward<Args>(args)...) {}
-
-  // Invokes the RPC with the provided request.
-  void call(const Request& request) {
-    ctx_.output.clear();
-    internal::BaseServerWriter server_writer(ctx_.call);
-    return (ctx_.service.*method)(
-        ctx_.call.context(),
-        request,
-        static_cast<ServerWriter<Response>&>(server_writer));
-  }
-
-  // Returns a server writer which writes responses into the context's buffer.
-  // This should not be called alongside call(); use one or the other.
-  ServerWriter<Response> writer() {
-    ctx_.output.clear();
-    internal::BaseServerWriter server_writer(ctx_.call);
-    return std::move(static_cast<ServerWriter<Response>&>(server_writer));
-  }
-
-  // Returns the responses that have been recorded. The maximum number of
-  // responses is responses().max_size(). responses().back() is always the most
-  // recent response, even if total_responses() > responses().max_size().
-  const Vector<Response>& responses() const { return ctx_.responses; }
-
-  // The total number of responses sent, which may be larger than
-  // responses.max_size().
-  size_t total_responses() const { return ctx_.output.total_responses(); }
-
-  // True if the stream has terminated.
-  bool done() const { return ctx_.output.stream_ended(); }
-
-  // The status of the stream. Only valid if done() is true.
-  Status status() const {
-    PW_CHECK(done());
-    return ctx_.output.last_status();
-  }
-};
-
-// Alias to select the type of the context object to use based on which type of
-// RPC it is for.
-template <auto method, size_t responses, size_t output_size>
-using Context = std::tuple_element_t<
-    static_cast<size_t>(internal::RpcTraits<decltype(method)>::kType),
-    std::tuple<
-        internal::test::UnaryContext<method, output_size>,
-        internal::test::ServerStreamingContext<method, responses, output_size>
-        // TODO(hepler): Support client and bidi streaming
-        >>;
-
-template <typename Response>
-void MessageOutput<Response>::clear() {
-  responses_.clear();
-  total_responses_ = 0;
-  stream_ended_ = false;
-  last_status_ = Status::Unknown();
-}
-
-template <typename Response>
-Status MessageOutput<Response>::SendAndReleaseBuffer(size_t size) {
-  PW_CHECK(!stream_ended_);
-
-  if (size == 0u) {
-    return Status::Ok();
-  }
-
-  Result<internal::Packet> result =
-      internal::Packet::FromBuffer(std::span(buffer_.data(), size));
-
-  last_status_ = result.status();
-
-  switch (result.value().type()) {
-    case internal::PacketType::RESPONSE:
-      // If we run out of space, the back message is always the most recent.
-      responses_.emplace_back();
-      responses_.back() = {};
-      PW_CHECK(
-          method_.DecodeResponse(result.value().payload(), &responses_.back()));
-      total_responses_ += 1;
-      break;
-    case internal::PacketType::SERVER_STREAM_END:
-      stream_ended_ = true;
-      break;
-    default:
-      PW_CRASH("Unhandled PacketType");
-  }
-  return Status::Ok();
-}
-
-}  // namespace internal::test
-
-template <auto method, size_t max_responses, size_t output_size_bytes>
-class TestMethodContext
-    : public internal::test::Context<method, max_responses, output_size_bytes> {
- public:
-  // Forwards constructor arguments to the service class.
-  template <typename... ServiceArgs>
-  TestMethodContext(ServiceArgs&&... service_args)
-      : internal::test::Context<method, max_responses, output_size_bytes>(
-            std::forward<ServiceArgs>(service_args)...) {}
-};
-
-}  // namespace pw::rpc
diff --git a/third_party/pigweed/repo/pw_rpc/nanopb/service_method_traits_test.cc b/third_party/pigweed/repo/pw_rpc/nanopb/service_method_traits_test.cc
deleted file mode 100644 (file)
index 245a01c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_rpc/internal/service_method_traits.h"
-
-#include <type_traits>
-
-#include "pw_rpc/echo_service_nanopb.h"
-
-namespace pw::rpc::internal {
-namespace {
-
-static_assert(std::is_same_v<ServiceMethodTraits<&EchoService::Echo>::Service,
-                             EchoService>);
-static_assert(
-    std::is_same_v<ServiceMethodTraits<&EchoService::Echo>::BaseService,
-                   generated::EchoService<EchoService>>);
-
-static_assert(
-    std::is_same_v<decltype(ServiceMethodTraits<&EchoService::Echo>::method()),
-                   const NanopbMethod&>);
-
-}  // namespace
-}  // namespace pw::rpc::internal
diff --git a/third_party/pigweed/repo/pw_rpc/pw_rpc_protos/packet.proto b/third_party/pigweed/repo/pw_rpc/pw_rpc_protos/packet.proto
deleted file mode 100644 (file)
index 459ac94..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-package pw.rpc.internal;
-
-option java_package = "dev.pigweed.pw.rpc.internal";
-
-enum PacketType {
-  // To simplify identifying the origin of a packet, client-to-server packets
-  // use even numbers and server-to-client packets use odd numbers.
-
-  // Client-to-server packets
-
-  // A request from a client for a service method.
-  REQUEST = 0;
-
-  // A client stream has completed.
-  CLIENT_STREAM_END = 2;
-
-  // The client received a packet for an RPC it did not request.
-  CLIENT_ERROR = 4;
-
-  // The client requests cancellation of an ongoing server stream.
-  CANCEL_SERVER_STREAM = 6;
-
-  // Server-to-client packets
-
-  // A response from a server for a service method.
-  RESPONSE = 1;
-
-  // A server streaming or bidirectional RPC has completed.
-  SERVER_STREAM_END = 3;
-
-  // The server was unable to process a request.
-  SERVER_ERROR = 5;
-}
-
-message RpcPacket {
-  // The type of packet. Determines which other fields are used.
-  PacketType type = 1;
-
-  // Channel through which the packet is sent.
-  uint32 channel_id = 2;
-
-  // Hash of the fully-qualified name of the service with which this packet is
-  // associated. For RPC packets, this is the service that processes the packet.
-  fixed32 service_id = 3;
-
-  // Hash of the name of the method which should process this packet.
-  fixed32 method_id = 4;
-
-  // The packet's payload, which is an encoded protobuf.
-  bytes payload = 5;
-
-  // Status code for the RPC response or error.
-  uint32 status = 6;
-}
diff --git a/third_party/pigweed/repo/pw_rpc/py/codegen_test.py b/third_party/pigweed/repo/pw_rpc/py/codegen_test.py
deleted file mode 100644 (file)
index ee96a8c..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Tests the generated pw_rpc code."""
-
-from pathlib import Path
-import os
-import subprocess
-import tempfile
-import unittest
-
-TEST_PROTO_FILE = b"""\
-syntax = "proto3";
-
-package pw.rpc.test;
-
-message TestRequest {
-  float integer = 1;
-}
-
-message TestResponse {
-  int32 value = 1;
-}
-
-message TestStreamResponse {
-  bytes chunk = 1;
-}
-
-message Empty {}
-
-service TestService {
-  rpc TestRpc(TestRequest) returns (TestResponse) {}
-  rpc TestStreamRpc(Empty) returns (stream TestStreamResponse) {}
-}
-"""
-
-EXPECTED_NANOPB_CODE = """\
-#pragma once
-
-#include <array>
-#include <cstddef>
-#include <cstdint>
-#include <type_traits>
-
-#include "pw_rpc/internal/method.h"
-#include "pw_rpc/server_context.h"
-#include "pw_rpc/service.h"
-#include "test.pb.h"
-
-namespace pw::rpc::internal {
-
-template <auto>
-class ServiceMethodTraits;
-
-}  // namespace pw::rpc::internal
-
-namespace pw::rpc::test {
-namespace generated {
-
-template <typename Implementation>
-class TestService : public ::pw::rpc::Service {
- public:
-  using ServerContext = ::pw::rpc::ServerContext;
-  template <typename T>
-  using ServerWriter = ::pw::rpc::ServerWriter<T>;
-
-  constexpr TestService()
-      : ::pw::rpc::Service(kServiceId, kMethods) {}
-
-  TestService(const TestService&) = delete;
-  TestService& operator=(const TestService&) = delete;
-
-  static constexpr const char* name() { return "TestService"; }
-
-  // Used by ServiceMethodTraits to identify a base service.
-  constexpr void _PwRpcInternalGeneratedBase() const {}
-
- private:
-  // Hash of "pw.rpc.test.TestService".
-  static constexpr uint32_t kServiceId = 0xcc0f6de0;
-
-  static ::pw::Status Invoke_TestRpc(
-      ::pw::rpc::internal::ServerCall& call,
-      const pw_rpc_test_TestRequest& request,
-      pw_rpc_test_TestResponse& response) {
-    return static_cast<Implementation&>(call.service())
-        .TestRpc(call.context(), request, response);
-  }
-
-  static void Invoke_TestStreamRpc(
-      ::pw::rpc::internal::ServerCall& call,
-      const pw_rpc_test_TestRequest& request,
-      ServerWriter<pw_rpc_test_TestStreamResponse>& writer) {
-    static_cast<Implementation&>(call.service())
-        .TestStreamRpc(call.context(), request, writer);
-  }
-
-  static constexpr std::array<::pw::rpc::internal::Method, 2> kMethods = {
-      ::pw::rpc::internal::Method::Unary<Invoke_TestRpc>(
-          0xbc924054,  // Hash of "TestRpc"
-          pw_rpc_test_TestRequest_fields,
-          pw_rpc_test_TestResponse_fields),
-      ::pw::rpc::internal::Method::ServerStreaming<Invoke_TestStreamRpc>(
-          0xd97a28fa,  // Hash of "TestStreamRpc"
-          pw_rpc_test_TestRequest_fields,
-          pw_rpc_test_TestStreamResponse_fields),
-  };
-
-  template <auto impl_method>
-  static constexpr const ::pw::rpc::internal::Method* MethodFor() {
-    if constexpr (std::is_same_v<decltype(impl_method), decltype(&Implementation::TestRpc)>) {
-      if constexpr (impl_method == &Implementation::TestRpc) {
-        return &std::get<0>(kMethods);
-      }
-    }
-    if constexpr (std::is_same_v<decltype(impl_method), decltype(&Implementation::TestStreamRpc)>) {
-      if constexpr (impl_method == &Implementation::TestStreamRpc) {
-        return &std::get<1>(kMethods);
-      }
-    }
-    return nullptr;
-  }
-
-  template <auto>
-  friend class ::pw::rpc::internal::ServiceMethodTraits;
-};
-
-}  // namespace generated
-}  // namespace pw::rpc::test
-"""
-
-
-class TestNanopbCodegen(unittest.TestCase):
-    """Test case for nanopb code generation."""
-    def setUp(self):
-        self._output_dir = tempfile.TemporaryDirectory()
-
-    def tearDown(self):
-        self._output_dir.cleanup()
-
-    def test_nanopb_codegen(self):
-        root = Path(os.getenv('PW_ROOT'))
-        proto_dir = root / 'pw_rpc' / 'pw_rpc_test_protos'
-        proto_file = proto_dir / 'test.proto'
-
-        venv_bin = 'Scripts' if os.name == 'nt' else 'bin'
-        plugin = root / '.python3-env' / venv_bin / 'pw_rpc_codegen'
-
-        command = (
-            'protoc',
-            f'-I{proto_dir}',
-            proto_file,
-            '--plugin',
-            f'protoc-gen-custom={plugin}',
-            '--custom_out',
-            self._output_dir.name,
-        )
-
-        subprocess.run(command)
-
-        generated_files = os.listdir(self._output_dir.name)
-        self.assertEqual(len(generated_files), 1)
-        self.assertEqual(generated_files[0], 'test.rpc.pb.h')
-
-        # Read the generated file, ignoring its preamble.
-        generated_code = Path(self._output_dir.name,
-                              generated_files[0]).read_text()
-        generated_code = generated_code[generated_code.index('#pragma'):]
-
-        self.assertEqual(generated_code, EXPECTED_NANOPB_CODE)
diff --git a/third_party/pigweed/repo/pw_rpc/py/pw_rpc/packet_pb2.py b/third_party/pigweed/repo/pw_rpc/py/pw_rpc/packet_pb2.py
deleted file mode 100644 (file)
index a86d53c..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-# [Pigweed] This file is a checked-in version of a generated protobuf module.
-# TODO(pwbug/239) Implement the pw_protobuf_package GN template and Python
-#     proto generation, then delete this file.
-
-# pylint: skip-file
-
-# type: ignore
-
-# yapf: disable
-
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler.  DO NOT EDIT!
-# source: pw_rpc/pw_rpc_protos/packet.proto
-
-import sys
-_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
-from google.protobuf.internal import enum_type_wrapper
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from google.protobuf import reflection as _reflection
-from google.protobuf import symbol_database as _symbol_database
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-
-
-DESCRIPTOR = _descriptor.FileDescriptor(
-  name='pw_rpc/pw_rpc_protos/packet.proto',
-  package='pw.rpc.internal',
-  syntax='proto3',
-  serialized_options=None,
-  serialized_pb=_b('\n!pw_rpc/pw_rpc_protos/packet.proto\x12\x0fpw.rpc.internal\"\x92\x01\n\tRpcPacket\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.pw.rpc.internal.PacketType\x12\x12\n\nchannel_id\x18\x02 \x01(\r\x12\x12\n\nservice_id\x18\x03 \x01(\x07\x12\x11\n\tmethod_id\x18\x04 \x01(\x07\x12\x0f\n\x07payload\x18\x05 \x01(\x0c\x12\x0e\n\x06status\x18\x06 \x01(\r*\x93\x01\n\nPacketType\x12\x0b\n\x07REQUEST\x10\x00\x12\x15\n\x11\x43LIENT_STREAM_END\x10\x02\x12\x10\n\x0c\x43LIENT_ERROR\x10\x04\x12\x18\n\x14\x43\x41NCEL_SERVER_STREAM\x10\x06\x12\x0c\n\x08RESPONSE\x10\x01\x12\x15\n\x11SERVER_STREAM_END\x10\x03\x12\x10\n\x0cSERVER_ERROR\x10\x05\x62\x06proto3')
-)
-
-_PACKETTYPE = _descriptor.EnumDescriptor(
-  name='PacketType',
-  full_name='pw.rpc.internal.PacketType',
-  filename=None,
-  file=DESCRIPTOR,
-  values=[
-    _descriptor.EnumValueDescriptor(
-      name='REQUEST', index=0, number=0,
-      serialized_options=None,
-      type=None),
-    _descriptor.EnumValueDescriptor(
-      name='CLIENT_STREAM_END', index=1, number=2,
-      serialized_options=None,
-      type=None),
-    _descriptor.EnumValueDescriptor(
-      name='CLIENT_ERROR', index=2, number=4,
-      serialized_options=None,
-      type=None),
-    _descriptor.EnumValueDescriptor(
-      name='CANCEL_SERVER_STREAM', index=3, number=6,
-      serialized_options=None,
-      type=None),
-    _descriptor.EnumValueDescriptor(
-      name='RESPONSE', index=4, number=1,
-      serialized_options=None,
-      type=None),
-    _descriptor.EnumValueDescriptor(
-      name='SERVER_STREAM_END', index=5, number=3,
-      serialized_options=None,
-      type=None),
-    _descriptor.EnumValueDescriptor(
-      name='SERVER_ERROR', index=6, number=5,
-      serialized_options=None,
-      type=None),
-  ],
-  containing_type=None,
-  serialized_options=None,
-  serialized_start=204,
-  serialized_end=351,
-)
-_sym_db.RegisterEnumDescriptor(_PACKETTYPE)
-
-PacketType = enum_type_wrapper.EnumTypeWrapper(_PACKETTYPE)
-REQUEST = 0
-CLIENT_STREAM_END = 2
-CLIENT_ERROR = 4
-CANCEL_SERVER_STREAM = 6
-RESPONSE = 1
-SERVER_STREAM_END = 3
-SERVER_ERROR = 5
-
-
-
-_RPCPACKET = _descriptor.Descriptor(
-  name='RpcPacket',
-  full_name='pw.rpc.internal.RpcPacket',
-  filename=None,
-  file=DESCRIPTOR,
-  containing_type=None,
-  fields=[
-    _descriptor.FieldDescriptor(
-      name='type', full_name='pw.rpc.internal.RpcPacket.type', index=0,
-      number=1, type=14, cpp_type=8, label=1,
-      has_default_value=False, default_value=0,
-      message_type=None, enum_type=None, containing_type=None,
-      is_extension=False, extension_scope=None,
-      serialized_options=None, file=DESCRIPTOR),
-    _descriptor.FieldDescriptor(
-      name='channel_id', full_name='pw.rpc.internal.RpcPacket.channel_id', index=1,
-      number=2, type=13, cpp_type=3, label=1,
-      has_default_value=False, default_value=0,
-      message_type=None, enum_type=None, containing_type=None,
-      is_extension=False, extension_scope=None,
-      serialized_options=None, file=DESCRIPTOR),
-    _descriptor.FieldDescriptor(
-      name='service_id', full_name='pw.rpc.internal.RpcPacket.service_id', index=2,
-      number=3, type=7, cpp_type=3, label=1,
-      has_default_value=False, default_value=0,
-      message_type=None, enum_type=None, containing_type=None,
-      is_extension=False, extension_scope=None,
-      serialized_options=None, file=DESCRIPTOR),
-    _descriptor.FieldDescriptor(
-      name='method_id', full_name='pw.rpc.internal.RpcPacket.method_id', index=3,
-      number=4, type=7, cpp_type=3, label=1,
-      has_default_value=False, default_value=0,
-      message_type=None, enum_type=None, containing_type=None,
-      is_extension=False, extension_scope=None,
-      serialized_options=None, file=DESCRIPTOR),
-    _descriptor.FieldDescriptor(
-      name='payload', full_name='pw.rpc.internal.RpcPacket.payload', index=4,
-      number=5, type=12, cpp_type=9, label=1,
-      has_default_value=False, default_value=_b(""),
-      message_type=None, enum_type=None, containing_type=None,
-      is_extension=False, extension_scope=None,
-      serialized_options=None, file=DESCRIPTOR),
-    _descriptor.FieldDescriptor(
-      name='status', full_name='pw.rpc.internal.RpcPacket.status', index=5,
-      number=6, type=13, cpp_type=3, label=1,
-      has_default_value=False, default_value=0,
-      message_type=None, enum_type=None, containing_type=None,
-      is_extension=False, extension_scope=None,
-      serialized_options=None, file=DESCRIPTOR),
-  ],
-  extensions=[
-  ],
-  nested_types=[],
-  enum_types=[
-  ],
-  serialized_options=None,
-  is_extendable=False,
-  syntax='proto3',
-  extension_ranges=[],
-  oneofs=[
-  ],
-  serialized_start=55,
-  serialized_end=201,
-)
-
-_RPCPACKET.fields_by_name['type'].enum_type = _PACKETTYPE
-DESCRIPTOR.message_types_by_name['RpcPacket'] = _RPCPACKET
-DESCRIPTOR.enum_types_by_name['PacketType'] = _PACKETTYPE
-_sym_db.RegisterFileDescriptor(DESCRIPTOR)
-
-RpcPacket = _reflection.GeneratedProtocolMessageType('RpcPacket', (_message.Message,), {
-  'DESCRIPTOR' : _RPCPACKET,
-  '__module__' : 'pw_rpc.pw_rpc_protos.packet_pb2'
-  # @@protoc_insertion_point(class_scope:pw.rpc.internal.RpcPacket)
-  })
-_sym_db.RegisterMessage(RpcPacket)
-
-
-# @@protoc_insertion_point(module_scope)
diff --git a/third_party/pigweed/repo/pw_rpc/py/pw_rpc/packet_pb2.pyi b/third_party/pigweed/repo/pw_rpc/py/pw_rpc/packet_pb2.pyi
deleted file mode 100644 (file)
index e13b07d..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-# @generated by generate_proto_mypy_stubs.py.  Do not edit!
-import sys
-from google.protobuf.descriptor import (
-    Descriptor as google___protobuf___descriptor___Descriptor,
-    EnumDescriptor as google___protobuf___descriptor___EnumDescriptor,
-    FileDescriptor as google___protobuf___descriptor___FileDescriptor,
-)
-
-from google.protobuf.internal.enum_type_wrapper import (  # type: ignore
-    _EnumTypeWrapper as google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper,
-)
-
-from google.protobuf.message import (
-    Message as google___protobuf___message___Message,
-)
-
-from typing import (
-    NewType as typing___NewType,
-    Optional as typing___Optional,
-    cast as typing___cast,
-)
-
-from typing_extensions import (
-    Literal as typing_extensions___Literal,
-)
-
-
-builtin___bool = bool
-builtin___bytes = bytes
-builtin___float = float
-builtin___int = int
-
-
-DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...
-
-PacketTypeValue = typing___NewType('PacketTypeValue', builtin___int)
-type___PacketTypeValue = PacketTypeValue
-PacketType: _PacketType
-class _PacketType(google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper[PacketTypeValue]):
-    DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ...
-    REQUEST = typing___cast(PacketTypeValue, 0)
-    CLIENT_STREAM_END = typing___cast(PacketTypeValue, 2)
-    CLIENT_ERROR = typing___cast(PacketTypeValue, 4)
-    CANCEL_SERVER_STREAM = typing___cast(PacketTypeValue, 6)
-    RESPONSE = typing___cast(PacketTypeValue, 1)
-    SERVER_STREAM_END = typing___cast(PacketTypeValue, 3)
-    SERVER_ERROR = typing___cast(PacketTypeValue, 5)
-REQUEST = typing___cast(PacketTypeValue, 0)
-CLIENT_STREAM_END = typing___cast(PacketTypeValue, 2)
-CLIENT_ERROR = typing___cast(PacketTypeValue, 4)
-CANCEL_SERVER_STREAM = typing___cast(PacketTypeValue, 6)
-RESPONSE = typing___cast(PacketTypeValue, 1)
-SERVER_STREAM_END = typing___cast(PacketTypeValue, 3)
-SERVER_ERROR = typing___cast(PacketTypeValue, 5)
-type___PacketType = PacketType
-
-class RpcPacket(google___protobuf___message___Message):
-    DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
-    type: type___PacketTypeValue = ...
-    channel_id: builtin___int = ...
-    service_id: builtin___int = ...
-    method_id: builtin___int = ...
-    payload: builtin___bytes = ...
-    status: builtin___int = ...
-
-    def __init__(self,
-        *,
-        type : typing___Optional[type___PacketTypeValue] = None,
-        channel_id : typing___Optional[builtin___int] = None,
-        service_id : typing___Optional[builtin___int] = None,
-        method_id : typing___Optional[builtin___int] = None,
-        payload : typing___Optional[builtin___bytes] = None,
-        status : typing___Optional[builtin___int] = None,
-        ) -> None: ...
-    def ClearField(self, field_name: typing_extensions___Literal[u"channel_id",b"channel_id",u"method_id",b"method_id",u"payload",b"payload",u"service_id",b"service_id",u"status",b"status",u"type",b"type"]) -> None: ...
-type___RpcPacket = RpcPacket
diff --git a/third_party/pigweed/repo/pw_status/py/pw_status/update_style.py b/third_party/pigweed/repo/pw_status/py/pw_status/update_style.py
deleted file mode 100755 (executable)
index 57c92bb..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Updates pw::Status usages from Status::CODE to Status::Code() style.
-
-Also updates StatusWithSize.
-"""
-
-import argparse
-from pathlib import Path
-import re
-import sys
-from typing import Iterable
-
-from pw_presubmit import git_repo
-
-_REMAP = {
-    'OK': 'Ok',
-    'CANCELLED': 'Cancelled',
-    'UNKNOWN': 'Unknown',
-    'INVALID_ARGUMENT': 'InvalidArgument',
-    'DEADLINE_EXCEEDED': 'DeadlineExceeded',
-    'NOT_FOUND': 'NotFound',
-    'ALREADY_EXISTS': 'AlreadyExists',
-    'PERMISSION_DENIED': 'PermissionDenied',
-    'UNAUTHENTICATED': 'Unauthenticated',
-    'RESOURCE_EXHAUSTED': 'ResourceExhausted',
-    'FAILED_PRECONDITION': 'FailedPrecondition',
-    'ABORTED': 'Aborted',
-    'OUT_OF_RANGE': 'OutOfRange',
-    'UNIMPLEMENTED': 'Unimplemented',
-    'INTERNAL': 'Internal',
-    'UNAVAILABLE': 'Unavailable',
-    'DATA_LOSS': 'DataLoss',
-}
-
-
-def _remap_status_with_size(match) -> str:
-    return f'StatusWithSize::{_REMAP[match.group(1)]}('
-
-
-def _remap_codes(match) -> str:
-    return f'{match.group(1)}::{_REMAP[match.group(2)]}()'
-
-
-_CODES = '|'.join(_REMAP.keys())
-
-_STATUS_WITH_SIZE_CTOR = re.compile(
-    fr'\bStatusWithSize\(Status::({_CODES}),\s*')
-_STATUS = re.compile(fr'\b(Status|StatusWithSize)::({_CODES})(?!")\b')
-
-
-def _parse_args():
-    """Parses and return command line arguments."""
-
-    parser = argparse.ArgumentParser(description=__doc__)
-    parser.add_argument('paths',
-                        nargs='*',
-                        type=Path,
-                        help='Paths to repositories')
-    return parser.parse_args()
-
-
-def update_status(paths: Iterable[Path]) -> None:
-    if not paths:
-        paths = [Path.cwd()]
-
-    for path in paths:
-        if git_repo.has_uncommitted_changes(path):
-            raise RuntimeError('There are pending changes in the Git repo!')
-
-        updated = 0
-
-        for file in git_repo.list_files(pathspecs=('*.h', '*.cc', '*.cpp'),
-                                        repo_path=path):
-            orig = file.read_text()
-
-            # Replace StatusAWithSize constructor
-            text = _STATUS_WITH_SIZE_CTOR.sub(_remap_status_with_size, orig)
-
-            # Replace Status and StatusAWithSize
-            text = _STATUS.sub(_remap_codes, text)
-
-            if orig != text:
-                updated += 1
-                file.write_text(text)
-
-    print('Updated', updated, 'files.')
-    print('Manually inspect the changes! This script is not perfect.')
-
-
-def main():
-    return update_status(**vars(_parse_args()))
-
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/third_party/pigweed/repo/pw_target_runner/pw_target_runner_protos/exec_server_config.proto b/third_party/pigweed/repo/pw_target_runner/pw_target_runner_protos/exec_server_config.proto
deleted file mode 100644 (file)
index bcbe9f9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2019 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-package pw.target_runner;
-
-option go_package = "pigweed.dev/proto/pw_target_runner/exec_server_config_pb";
-
-// Configuration options for running a test server.
-message ServerConfig {
-  // All runner programs that can be launched concurrently.
-  repeated TestRunner runner = 1;
-}
-
-// A program that can run a unit test binary. Must take the path to a test
-// executable as a single positional argument.
-message TestRunner {
-  // The program to run.
-  string command = 1;
-
-  // Other option arguments to the program.
-  repeated string args = 2;
-}
diff --git a/third_party/pigweed/repo/pw_tokenizer/public/pw_tokenizer/pw_tokenizer_65599_fixed_length_hash.h b/third_party/pigweed/repo/pw_tokenizer/public/pw_tokenizer/pw_tokenizer_65599_fixed_length_hash.h
deleted file mode 100644 (file)
index 2d2983e..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 <cstddef>
-#include <cstdint>
-#include <string_view>
-
-#include "pw_preprocessor/compiler.h"
-
-namespace pw::tokenizer {
-
-// The constant to use when generating the hash. Changing this changes the value
-// of all hashes, so do not change it randomly.
-inline constexpr uint32_t k65599HashConstant = 65599u;
-
-// Calculates the hash of a string. This function calculates hashes at either
-// runtime or compile time in C++ code.
-//
-// This function only hashes up to a fixed length. Characters beyond that length
-// are ignored. Hashing to a fixed length makes it possible to compute this hash
-// in a preprocessor macro. To eliminate some collisions, the length of the
-// string is hashed as if it were the first character.
-//
-// This hash is calculated with the following equation, where s is the string
-// and k is the maximum hash length:
-//
-//    H(s, k) = len(s) + 65599 * s[0] + 65599^2 * s[1] + ... + 65599^k * s[k-1]
-//
-// The hash algorithm is a modified version of the x65599 hash used by the SDBM
-// open source project. This hash has the following differences from x65599:
-//   - Characters are only hashed up to a fixed maximum string length.
-//   - Characters are hashed in reverse order.
-//   - The string length is hashed as the first character in the string.
-constexpr uint32_t PwTokenizer65599FixedLengthHash(std::string_view string,
-                                                   size_t hash_length)
-    PW_NO_SANITIZE("unsigned-integer-overflow") {
-  // The length is hashed as if it were the first character.
-  uint32_t hash = string.size();
-  uint32_t coefficient = k65599HashConstant;
-
-  // Hash all of the characters in the string as unsigned ints.
-  // The coefficient calculation is done modulo 0x100000000, so the unsigned
-  // integer overflows are intentional.
-  for (uint8_t ch : string.substr(0, hash_length)) {
-    hash += coefficient * ch;
-    coefficient *= k65599HashConstant;
-  }
-
-  return hash;
-}
-
-// Take the string as an array to support either literals or character arrays,
-// but not const char*.
-template <size_t length>
-constexpr uint32_t PwTokenizer65599FixedLengthHashArray(
-    const char (&string)[length], size_t hash_length) {
-  static_assert(length > 0);
-  return PwTokenizer65599FixedLengthHash(std::string_view(string, length - 1),
-                                         hash_length);
-}
-
-}  // namespace pw::tokenizer
diff --git a/third_party/pigweed/repo/pw_toolchain/dummy/bad_toolchain.py b/third_party/pigweed/repo/pw_toolchain/dummy/bad_toolchain.py
deleted file mode 100644 (file)
index c87150d..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright 2020 The Pigweed 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
-#
-#     https://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.
-"""Emits an error telling the user not to use the default toolchain."""
-
-import sys
-
-_ERROR_MESSAGE = """
-Error: trying to build a target with the default toolchain
-
-  This occurs when a GN target is listed as a dependency outside of a toolchain
-  group (such as host_clang or stm32f429i) in the root BUILD.gn file.
-
-  Make sure that your top-level targets are always instantiated with a toolchain
-  and that no dependencies are pulled in through the default toolchain.
-
-  group("my_target_wrapper") {
-    deps = [ ":my_target(//path/to/my/toolchain)" ]
-  }
-
-  group("my_target") {
-    deps = []
-    if (current_toolchain != default_toolchain) {
-      deps += [ "//my_application:image" ]
-    }
-  }
-
-  If you are developing in Pigweed itself, list your build target under one of
-  the predefined groups in //BUILD.gn. For example,
-
-    # apps is an existing group intended for building application images.
-    group("apps") {
-      deps = [
-        ...
-        "your_target:here",
-      ]
-    }
-
-  Other predefined groups include host_tools, pw_modules, and pw_module_tests.
-
-  If you want to add a custom group instead of using an existing one, it must be
-  defined alongside the predefined groups, within the toolchain condition block:
-
-    if (current_toolchain != default_toolchain) {
-      group("apps") {
-        ...
-      }
-
-      # Other predefined groups...
-
-      group("my_custom_group") {
-        deps = [ "//path/to:my_target" ]
-      }
-    }
-
-  To include your custom group in the build, add it to the pigweed_default group
-  to have it compile for every supported Pigweed target.
-
-    group("pigweed_default") {
-      deps = []
-
-      if (current_toolchain != default_toolchain) {
-        # Standard Pigweed dependencies...
-
-        # Add your group here.
-        deps += [ ":my_custom_group" ]
-      }
-    }
-
-  For more details on the Pigweed build structure and how to configure custom
-  build targets or toolchains, please refer to "Build system" in the Pigweed
-  documentation.
-"""
-
-
-def main() -> int:
-    print(_ERROR_MESSAGE, file=sys.stderr)
-    return 1
-
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/third_party/pigweed/repo/targets/lm3s6965evb-qemu/vector_table.cc b/third_party/pigweed/repo/targets/lm3s6965evb-qemu/vector_table.cc
deleted file mode 100644 (file)
index 575a673..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_boot_armv7m/boot.h"
-
-namespace {
-
-// Default handler to insert into the ARMv7-M vector table (below).
-// This function exists for convenience. If a device isn't doing what you
-// expect, it might have hit a fault and ended up here.
-void DefaultFaultHandler(void) {
-  while (true) {
-    // Wait for debugger to attach.
-  }
-}
-
-// This is the device's interrupt vector table. It's not referenced in any
-// code because the platform (STM32F4xx) expects this table to be present at the
-// beginning of flash. The exact address is specified in the pw_boot_armv7m
-// configuration as part of the target config.
-//
-// For more information, see ARMv7-M Architecture Reference Manual DDI 0403E.b
-// section B1.5.3.
-
-// This typedef is for convenience when building the vector table. With the
-// exception of SP_main (0th entry in the vector table), all the entries of the
-// vector table are function pointers.
-typedef void (*InterruptHandler)();
-
-PW_KEEP_IN_SECTION(".vector_table")
-const InterruptHandler vector_table[] = {
-    // The starting location of the stack pointer.
-    // This address is NOT an interrupt handler/function pointer, it is simply
-    // the address that the main stack pointer should be initialized to. The
-    // value is reinterpret casted because it needs to be in the vector table.
-    [0] = reinterpret_cast<InterruptHandler>(&pw_boot_stack_high_addr),
-
-    // Reset handler, dictates how to handle reset interrupt. This is the
-    // address that the Program Counter (PC) is initialized to at boot.
-    [1] = pw_boot_Entry,
-
-    // NMI handler.
-    [2] = DefaultFaultHandler,
-    // HardFault handler.
-    [3] = DefaultFaultHandler,
-};
-
-}  // namespace
diff --git a/third_party/pigweed/repo/targets/stm32f429i-disc1/vector_table.cc b/third_party/pigweed/repo/targets/stm32f429i-disc1/vector_table.cc
deleted file mode 100644 (file)
index 575a673..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2020 The Pigweed 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
-//
-//     https://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 "pw_boot_armv7m/boot.h"
-
-namespace {
-
-// Default handler to insert into the ARMv7-M vector table (below).
-// This function exists for convenience. If a device isn't doing what you
-// expect, it might have hit a fault and ended up here.
-void DefaultFaultHandler(void) {
-  while (true) {
-    // Wait for debugger to attach.
-  }
-}
-
-// This is the device's interrupt vector table. It's not referenced in any
-// code because the platform (STM32F4xx) expects this table to be present at the
-// beginning of flash. The exact address is specified in the pw_boot_armv7m
-// configuration as part of the target config.
-//
-// For more information, see ARMv7-M Architecture Reference Manual DDI 0403E.b
-// section B1.5.3.
-
-// This typedef is for convenience when building the vector table. With the
-// exception of SP_main (0th entry in the vector table), all the entries of the
-// vector table are function pointers.
-typedef void (*InterruptHandler)();
-
-PW_KEEP_IN_SECTION(".vector_table")
-const InterruptHandler vector_table[] = {
-    // The starting location of the stack pointer.
-    // This address is NOT an interrupt handler/function pointer, it is simply
-    // the address that the main stack pointer should be initialized to. The
-    // value is reinterpret casted because it needs to be in the vector table.
-    [0] = reinterpret_cast<InterruptHandler>(&pw_boot_stack_high_addr),
-
-    // Reset handler, dictates how to handle reset interrupt. This is the
-    // address that the Program Counter (PC) is initialized to at boot.
-    [1] = pw_boot_Entry,
-
-    // NMI handler.
-    [2] = DefaultFaultHandler,
-    // HardFault handler.
-    [3] = DefaultFaultHandler,
-};
-
-}  // namespace
diff --git a/third_party/qpg_sdk/repo/qpg6100/comps/libmbedtls/random_qorvo.h b/third_party/qpg_sdk/repo/qpg6100/comps/libmbedtls/random_qorvo.h
deleted file mode 100644 (file)
index d48d564..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *   This file includes the declarations of the random functions from the Qorvo library.
- *
- */
-
-#ifndef RANDOM_QORVO_H_
-#define RANDOM_QORVO_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-/**
- * This function initializes the random number service used by OpenThread.
- *
- */
-void qorvoRandomInit(void);
-
-/**
- * This function returns an array of random numbers.
- *
- * @param[out]  aOutput        Pointer to an array which will be filled with random data.
- * @param[in]   aOutputLength  number of bytes which will be written into the array.
- *
- */
-void qorvoRandomGet(uint8_t *aOutput, uint8_t aOutputLength);
-
-#endif // RANDOM_QORVO_H_
diff --git a/tools/README.md b/tools/README.md
deleted file mode 100644 (file)
index a109acc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-## Tools