From b7eec4d47e7e7de2feed5051eb9da44275008929 Mon Sep 17 00:00:00 2001
From: ex_liangpy4 <ex_liangpy4@partner.midea.com>
Date: Mon, 27 Nov 2023 10:08:47 +0800
Subject: [PATCH] update add-more-time command function name

---
 .../include/microwave-oven-control-delegate.h          |  8 ++++----
 .../include/microwave-oven-device.h                    |  6 +++---
 .../src/microwave-oven-control-delegate.cpp            | 10 +++++-----
 .../src/microwave-oven-device.cpp                      |  2 +-
 .../microwave-oven-control-server.cpp                  |  6 ++++--
 .../microwave-oven-control-server.h                    |  4 ++--
 6 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-control-delegate.h b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-control-delegate.h
index 312de4ab740cad..41ce5247996696 100644
--- a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-control-delegate.h
+++ b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-control-delegate.h
@@ -40,19 +40,19 @@ class ExampleMicrowaveOvenControlDelegate : public MicrowaveOvenControl::Delegat
      */
     Platform::UniquePtr<std::function<Protocols::InteractionModel::Status(uint8_t, uint32_t, uint8_t)>>
         mHandleSetCookingParametersCallback;
-    Platform::UniquePtr<std::function<Protocols::InteractionModel::Status(uint32_t)>> mHandleAddMoreTimeCallback;
+    Platform::UniquePtr<std::function<Protocols::InteractionModel::Status(uint32_t)>> mHandleSetCookTimeCallback;
 
 public:
     /**
      * Handle Command Callback in application: set-cooking-parameters
      */
-    Protocols::InteractionModel::Status HandleSetCookingParametersCommandCallback(uint8_t cookMode, uint32_t cookTime,
+    Protocols::InteractionModel::Status HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTime,
                                                                                   uint8_t powerSetting) override;
 
     /**
      * Handle Command Callback in application: add-more-time
      */
-    Protocols::InteractionModel::Status HandleAddMoreTimeCommandCallback(uint32_t finalCookTime) override;
+    Protocols::InteractionModel::Status HandleSetCookTimeCallback(uint32_t finalCookTime) override;
 
     /**
      * Get the value of MinPower.
@@ -78,7 +78,7 @@ class ExampleMicrowaveOvenControlDelegate : public MicrowaveOvenControl::Delegat
     /**
      * Set callback function for add more time
      */
-    void SetMicrowaveOvenControlAddMoreTimeCallback(std::function<Protocols::InteractionModel::Status(uint32_t)> aCallback);
+    void SetMicrowaveOvenControlSetCookTimeCallback(std::function<Protocols::InteractionModel::Status(uint32_t)> aCallback);
 };
 
 } // namespace MicrowaveOvenControl
diff --git a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h
index fbe210529b7550..fc1750f94aa350 100644
--- a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h
+++ b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h
@@ -33,8 +33,8 @@ class MicrowaveOvenDevice
         mMicrowaveOvenControlDelegate.SetMicrowaveOvenControlSetCookingParametersCallback(
             std::bind(&MicrowaveOvenDevice::HandleMicrowaveOvenSetCookingParametersCommandCallback, this, std::placeholders::_1,
                       std::placeholders::_2, std::placeholders::_3));
-        mMicrowaveOvenControlDelegate.SetMicrowaveOvenControlAddMoreTimeCallback(
-            std::bind(&MicrowaveOvenDevice::HandleMicrowaveOvenAddMoreTimeCommandCallback, this, std::placeholders::_1));
+        mMicrowaveOvenControlDelegate.SetMicrowaveOvenControlSetCookTimeCallback(
+            std::bind(&MicrowaveOvenDevice::HandleMicrowaveOvenSetCookTimeCommandCallback, this, std::placeholders::_1));
         mOperationalStateDelegate.SetOpStatePauseCallback(
             std::bind(&MicrowaveOvenDevice::HandleMicrowaveOvenOpStatePauseCallback, this, std::placeholders::_1));
         mOperationalStateDelegate.SetOpStateResumeCallback(
@@ -61,7 +61,7 @@ class MicrowaveOvenDevice
     /**
      * handle command for microwave oven control: add more time
      */
-    Protocols::InteractionModel::Status HandleMicrowaveOvenAddMoreTimeCommandCallback(uint32_t finalCookTime);
+    Protocols::InteractionModel::Status HandleMicrowaveOvenSetCookTimeCommandCallback(uint32_t finalCookTime);
 
     /**
      * handle command for operational state: pause
diff --git a/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-control-delegate.cpp b/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-control-delegate.cpp
index d17da28cbb95f3..943173c1b997b3 100644
--- a/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-control-delegate.cpp
+++ b/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-control-delegate.cpp
@@ -24,15 +24,15 @@ using namespace chip::app::Clusters::MicrowaveOvenControl;
 
 // Microwave Oven Control command callbacks
 Protocols::InteractionModel::Status
-ExampleMicrowaveOvenControlDelegate::HandleSetCookingParametersCommandCallback(uint8_t cookMode, uint32_t cookTime,
+ExampleMicrowaveOvenControlDelegate::HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTime,
                                                                                uint8_t powerSetting)
 {
     return (*mHandleSetCookingParametersCallback.get())(cookMode, cookTime, powerSetting);
 }
 
-Protocols::InteractionModel::Status ExampleMicrowaveOvenControlDelegate::HandleAddMoreTimeCommandCallback(uint32_t finalCookTime)
+Protocols::InteractionModel::Status ExampleMicrowaveOvenControlDelegate::HandleSetCookTimeCallback(uint32_t finalCookTime)
 {
-    return (*mHandleAddMoreTimeCallback.get())(finalCookTime);
+    return (*mHandleSetCookTimeCallback.get())(finalCookTime);
 }
 
 void ExampleMicrowaveOvenControlDelegate::SetMicrowaveOvenControlSetCookingParametersCallback(
@@ -42,8 +42,8 @@ void ExampleMicrowaveOvenControlDelegate::SetMicrowaveOvenControlSetCookingParam
         Platform::MakeUnique<std::function<Protocols::InteractionModel::Status(uint8_t, uint32_t, uint8_t)>>(aCallback);
 }
 
-void ExampleMicrowaveOvenControlDelegate::SetMicrowaveOvenControlAddMoreTimeCallback(
+void ExampleMicrowaveOvenControlDelegate::SetMicrowaveOvenControlSetCookTimeCallback(
     std::function<Protocols::InteractionModel::Status(uint32_t)> aCallback)
 {
-    mHandleAddMoreTimeCallback = Platform::MakeUnique<std::function<Protocols::InteractionModel::Status(uint32_t)>>(aCallback);
+    mHandleSetCookTimeCallback = Platform::MakeUnique<std::function<Protocols::InteractionModel::Status(uint32_t)>>(aCallback);
 }
diff --git a/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp b/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp
index bbb2433543e57b..552c7d2f2d06c7 100644
--- a/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp
+++ b/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp
@@ -36,7 +36,7 @@ MicrowaveOvenDevice::HandleMicrowaveOvenSetCookingParametersCommandCallback(uint
     return Status::Success;
 }
 
-Protocols::InteractionModel::Status MicrowaveOvenDevice::HandleMicrowaveOvenAddMoreTimeCommandCallback(uint32_t finalCookTime)
+Protocols::InteractionModel::Status MicrowaveOvenDevice::HandleMicrowaveOvenSetCookTimeCommandCallback(uint32_t finalCookTime)
 {
     // placeholder implementation
     mMicrowaveOvenControlInstance.SetCookTime(finalCookTime);
diff --git a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp
index c57ac6a3928075..3c52e2d67523c2 100644
--- a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp
+++ b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp
@@ -205,10 +205,12 @@ void Instance::HandleSetCookingParameters(HandlerContext & ctx, const Commands::
         if (CookMode.HasValue())
         {
             // TODO: set Microwave Oven cooking mode by CookMode.Value().
+            reqCookMode = CookMode.Value();
         }
         else
         {
             // TODO: set Microwave Oven cooking mode to normal mode.
+            reqCookMode = 0;
         }
 
         if (CookTime.HasValue())
@@ -230,7 +232,7 @@ void Instance::HandleSetCookingParameters(HandlerContext & ctx, const Commands::
             // set Microwave Oven cooking power to max power(default).
             reqPowerSetting = mDelegate->GetMaxPower();
         }
-        status = mDelegate->HandleSetCookingParametersCommandCallback(reqCookMode, reqCookTime, reqPowerSetting);
+        status = mDelegate->HandleSetCookingParametersCallback(reqCookMode, reqCookTime, reqPowerSetting);
         goto exit;
     }
     else
@@ -268,7 +270,7 @@ void Instance::HandleAddMoreTime(HandlerContext & ctx, const Commands::AddMoreTi
         // if the added cooking time is greater than the max cooking time, the cooking time stay unchanged.
         if (finalCookTime < kMaxCookTime)
         {
-            status = mDelegate->HandleAddMoreTimeCommandCallback(finalCookTime);
+            status = mDelegate->HandleSetCookTimeCallback(finalCookTime);
             goto exit;
         }
         else
diff --git a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h
index e2261903e2b341..41b6d25a4bc33c 100644
--- a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h
+++ b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h
@@ -121,14 +121,14 @@ class Delegate
      *   @brief Handle Command Callback in application: SetCookingParameters
      *   @return Returns the Interaction Model status code which was user determined in the business logic
      */
-    virtual Protocols::InteractionModel::Status HandleSetCookingParametersCommandCallback(uint8_t cookMode, uint32_t cookTime,
+    virtual Protocols::InteractionModel::Status HandleSetCookingParametersCallback(uint8_t cookMode, uint32_t cookTime,
                                                                                           uint8_t powerSetting) = 0;
 
     /**
      *   @brief Handle Command Callback in application: AddMoreTime
      *   @return Returns the Interaction Model status code which was user determined in the business logic
      */
-    virtual Protocols::InteractionModel::Status HandleAddMoreTimeCommandCallback(uint32_t finalCookTime) = 0;
+    virtual Protocols::InteractionModel::Status HandleSetCookTimeCallback(uint32_t finalCookTime) = 0;
 
     /**
      *   @brief get the MinPower