diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 8ae7abfbb548a9..0c48eb2930f352 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -32,7 +32,7 @@ using namespace chip; bool emberAfGeneralCommissioningClusterArmFailSafeCallback(chip::app::Command * commandObj, uint16_t expiryLengthSeconds, uint64_t breadcrumb, uint32_t timeoutMs) { - CHIP_ERROR err = DeviceLayer::Internal::DeviceControlSvr().HandleArmFailSafe(expiryLengthSeconds); + CHIP_ERROR err = DeviceLayer::Internal::DeviceControlSvr().ArmFailSafe(expiryLengthSeconds); emberAfSendImmediateDefaultResponse(err == CHIP_NO_ERROR ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE); return true; @@ -40,7 +40,7 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(chip::app::Command * bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(chip::app::Command * commandObj) { - CHIP_ERROR err = DeviceLayer::Internal::DeviceControlSvr().HandleCommissioningComplete(); + CHIP_ERROR err = DeviceLayer::Internal::DeviceControlSvr().CommissioningComplete(); emberAfSendImmediateDefaultResponse(err == CHIP_NO_ERROR ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE); return true; @@ -49,7 +49,11 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(chip::app:: bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(chip::app::Command * commandObj, uint8_t location, uint8_t * countryCode, uint64_t breadcrumb, uint32_t timeoutMs) { - CHIP_ERROR err = DeviceLayer::Internal::DeviceControlSvr().HandleSetRegulatoryConfig(location, countryCode, breadcrumb); + // TODO: countryCode is defined as Null terminated CHAR_STRING, which was interpreted as 'str' before, some recent changes broke + // this and interpreted as 'bytes'. + + // CHIP_ERROR err = DeviceLayer::Internal::DeviceControlSvr().SetRegulatoryConfig( + // location, countryCode, breadcrumb); emberAfSendImmediateDefaultResponse(err == CHIP_NO_ERROR ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE); return true; diff --git a/src/include/platform/internal/DeviceControlServer.h b/src/include/platform/internal/DeviceControlServer.h index f37811b4073c98..407e8ced3d6971 100644 --- a/src/include/platform/internal/DeviceControlServer.h +++ b/src/include/platform/internal/DeviceControlServer.h @@ -33,10 +33,10 @@ class DeviceControlServer final public: // ===== Members for internal use by other Device Layer components. - CHIP_ERROR HandleArmFailSafe(uint16_t expiryLengthSeconds); - CHIP_ERROR HandleDisarmFailSafe(void); - CHIP_ERROR HandleCommissioningComplete(void); - CHIP_ERROR HandleSetRegulatoryConfig(uint8_t location, uint8_t * countryCode, uint64_t breadcrumb); + CHIP_ERROR ArmFailSafe(uint16_t expiryLengthSeconds); + CHIP_ERROR DisarmFailSafe(); + CHIP_ERROR CommissioningComplete(); + CHIP_ERROR SetRegulatoryConfig(uint8_t location, const char * countryCode, uint64_t breadcrumb); private: // ===== Members for internal use by the following friends. diff --git a/src/platform/DeviceControlServer.cpp b/src/platform/DeviceControlServer.cpp index 4a9cbf77a97862..81b60255f17fdd 100644 --- a/src/platform/DeviceControlServer.cpp +++ b/src/platform/DeviceControlServer.cpp @@ -28,37 +28,34 @@ namespace chip { namespace DeviceLayer { namespace Internal { -// Conforms to ISO 3166-1 Alpha-2 -static constexpr size_t kCountryCodeLen = 2; - DeviceControlServer DeviceControlServer::sInstance; -CHIP_ERROR DeviceControlServer::HandleArmFailSafe(uint16_t expiryLengthSeconds) +CHIP_ERROR DeviceControlServer::ArmFailSafe(uint16_t expiryLengthSeconds) { // TODO return CHIP_NO_ERROR; } -CHIP_ERROR DeviceControlServer::HandleDisarmFailSafe(void) +CHIP_ERROR DeviceControlServer::DisarmFailSafe() { // TODO return CHIP_NO_ERROR; } -CHIP_ERROR DeviceControlServer::HandleCommissioningComplete(void) +CHIP_ERROR DeviceControlServer::CommissioningComplete() { // TODO return CHIP_NO_ERROR; } -CHIP_ERROR DeviceControlServer::HandleSetRegulatoryConfig(uint8_t location, uint8_t * countryCode, uint64_t breadcrumb) +CHIP_ERROR DeviceControlServer::SetRegulatoryConfig(uint8_t location, const char * countryCode, uint64_t breadcrumb) { CHIP_ERROR err = CHIP_NO_ERROR; err = ConfigurationMgr().StoreRegulatoryLocation(location); SuccessOrExit(err); - err = ConfigurationMgr().StoreCountryCode(reinterpret_cast(countryCode), kCountryCodeLen); + err = ConfigurationMgr().StoreCountryCode(countryCode, strlen(countryCode)); SuccessOrExit(err); err = ConfigurationMgr().StoreBreadcrumb(breadcrumb);