Changes to CommandStatusIB to reflect 1.3 spec (#30595)

diff --git a/src/app/MessageDef/CommandDataIB.h b/src/app/MessageDef/CommandDataIB.h
index b3bd2f4..9872f5e 100644
--- a/src/app/MessageDef/CommandDataIB.h
+++ b/src/app/MessageDef/CommandDataIB.h
@@ -71,7 +71,7 @@
     /**
      *  @brief Get the provided command reference associated with the CommandData
      *
-     *  @param [in] apRef    A pointer to apRef
+     *  @param [out] apRef    A pointer to apRef
      *
      *  @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
diff --git a/src/app/MessageDef/CommandStatusIB.cpp b/src/app/MessageDef/CommandStatusIB.cpp
index 4f38bb2..566ea0a 100644
--- a/src/app/MessageDef/CommandStatusIB.cpp
+++ b/src/app/MessageDef/CommandStatusIB.cpp
@@ -75,6 +75,14 @@
                 PRETTY_PRINT_DECDEPTH();
             }
             break;
+        case to_underlying(Tag::kRef):
+            VerifyOrReturnError(TLV::kTLVType_UnsignedInteger == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE);
+            {
+                uint16_t reference;
+                ReturnErrorOnFailure(reader.Get(reference));
+                PRETTY_PRINT("\tRef = 0x%x,", reference);
+            }
+            break;
         default:
             PRETTY_PRINT("Unknown tag num %" PRIu32, tagNum);
             break;
@@ -108,6 +116,11 @@
     return apErrorStatus->Init(reader);
 }
 
+CHIP_ERROR CommandStatusIB::Parser::GetRef(uint16_t * const apRef) const
+{
+    return GetUnsignedInteger(to_underlying(Tag::kRef), apRef);
+}
+
 CommandPathIB::Builder & CommandStatusIB::Builder::CreatePath()
 {
     if (mError == CHIP_NO_ERROR)
@@ -126,6 +139,11 @@
     return mErrorStatus;
 }
 
+CHIP_ERROR CommandStatusIB::Builder::Ref(const uint16_t aRef)
+{
+    return mpWriter->Put(TLV::ContextTag(Tag::kRef), aRef);
+}
+
 CHIP_ERROR CommandStatusIB::Builder::EndOfCommandStatusIB()
 {
     EndOfContainer();
diff --git a/src/app/MessageDef/CommandStatusIB.h b/src/app/MessageDef/CommandStatusIB.h
index 8614df2..a780e02 100644
--- a/src/app/MessageDef/CommandStatusIB.h
+++ b/src/app/MessageDef/CommandStatusIB.h
@@ -37,6 +37,7 @@
 {
     kPath        = 0,
     kErrorStatus = 1,
+    kRef         = 2,
 };
 
 class Parser : public StructParser
@@ -67,6 +68,17 @@
      *          #CHIP_END_OF_TLV if there is no such element
      */
     CHIP_ERROR GetErrorStatus(StatusIB::Parser * const apErrorStatus) const;
+
+    /**
+     *  @brief Get the provided command reference associated with the CommandStatus
+     *
+     *  @param [out] apRef    A pointer to apRef
+     *
+     *  @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 GetRef(uint16_t * const apRef) const;
 };
 
 class Builder : public StructBuilder
@@ -87,6 +99,15 @@
     StatusIB::Builder & CreateErrorStatus();
 
     /**
+     *  @brief Inject Command Ref into the TLV stream.
+     *
+     *  @param [in] aRef refer to the CommandRef to set in CommandStatusIB.
+     *
+     *  @return #CHIP_NO_ERROR on success
+     */
+    CHIP_ERROR Ref(const uint16_t aRef);
+
+    /**
      *  @brief Mark the end of this CommandStatusIB
      *
      *  @return The builder's final status.