Resolve issues in lamp test feature

This commit implements the following changes in lamp test

1. Reset lamp test timer on assert to assert case
2. Reject stopping lamp test when there is a request to
deassert lamp test.

Test:
Case 1: Start lamp test (False to True).
Result: 4mins of lamp test execution and Asserted is set back to
false after 4mins.

Case 2: Stop lamp test (False to False).
Result: Lamp test is not performed and Asserted remains false.

Case 3: Stop request when lamp test is still on (True to false)
Result: Stop request not allowed and lamp test continues to execute.
        Asserted stays true until the lamp test ends.

Case 4: Retrigger lamp test (True to True).
Result: 4mins timer restarts. Asserted should be back to false after
4mins.

Change-Id: Ib6086f223d5c5ce80b872ed5f35645893ce79cf9
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
diff --git a/manager/group.cpp b/manager/group.cpp
index c9ad161..93be9a5 100644
--- a/manager/group.cpp
+++ b/manager/group.cpp
@@ -13,6 +13,23 @@
 /** @brief Overloaded Property Setter function */
 bool Group::asserted(bool value)
 {
+    if (customCallBack != nullptr)
+    {
+        // Custom callback method tells if the lamptest request is handled
+        // successfully or not.
+        if (customCallBack(this, value))
+        {
+            // If the lamp test request is handled successfully, update the
+            // asserted property.
+            return sdbusplus::xyz::openbmc_project::Led::server::Group::
+                asserted(value);
+        }
+
+        // If the lamp test request is not handled successfully, return the
+        // existing asserted value without any change.
+        return sdbusplus::xyz::openbmc_project::Led::server::Group::asserted();
+    }
+
     // If the value is already what is before, return right away
     if (value ==
         sdbusplus::xyz::openbmc_project::Led::server::Group::asserted())
@@ -20,15 +37,6 @@
         return value;
     }
 
-    if (customCallBack != nullptr)
-    {
-        // Call the custom callback method
-        customCallBack(this, value);
-
-        return sdbusplus::xyz::openbmc_project::Led::server::Group::asserted(
-            value);
-    }
-
     // Introducing these to enable gtest.
     ActionSet ledsAssert{};
     ActionSet ledsDeAssert{};