diff --git a/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp b/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp index 9d641fc824f16c..48ae4ae13b3863 100644 --- a/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp +++ b/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp @@ -79,7 +79,7 @@ CHIP_ERROR LogProvider::GetLogForIntent(IntentEnum intent, MutableByteSpan & out err = CollectLog(sessionHandle, outBuffer, unusedOutIsEndOfLog); VerifyOrReturnError(CHIP_NO_ERROR == err, err, outBuffer.reduce_size(0)); - err = EndLogCollection(sessionHandle, CHIP_NO_ERROR); + err = EndLogCollection(sessionHandle); VerifyOrReturnError(CHIP_NO_ERROR == err, err, outBuffer.reduce_size(0)); return CHIP_NO_ERROR; diff --git a/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h b/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h index f52ffda3fde03a..28daba63837cc3 100644 --- a/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h +++ b/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h @@ -48,7 +48,7 @@ class LogProvider : public DiagnosticLogsProviderDelegate /////////// DiagnosticLogsProviderDelegate Interface ///////// CHIP_ERROR StartLogCollection(IntentEnum intent, LogSessionHandle & outHandle, Optional & outTimeStamp, Optional & outTimeSinceBoot) override; - CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error) override; + CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error = CHIP_NO_ERROR) override; CHIP_ERROR CollectLog(LogSessionHandle sessionHandle, MutableByteSpan & outBuffer, bool & outIsEndOfLog) override; size_t GetSizeForIntent(IntentEnum intent) override; CHIP_ERROR GetLogForIntent(IntentEnum intent, MutableByteSpan & outBuffer, Optional & outTimeStamp, diff --git a/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsProviderDelegateImpl.h b/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsProviderDelegateImpl.h index b1ff9b453563f2..12152fb47dfddb 100644 --- a/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsProviderDelegateImpl.h +++ b/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsProviderDelegateImpl.h @@ -41,7 +41,7 @@ class LogProvider : public DiagnosticLogsProviderDelegate /////////// DiagnosticLogsProviderDelegate Interface ///////// CHIP_ERROR StartLogCollection(IntentEnum intent, LogSessionHandle & outHandle, Optional & outTimeStamp, Optional & outTimeSinceBoot) override; - CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error) override; + CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error = CHIP_NO_ERROR) override; CHIP_ERROR CollectLog(LogSessionHandle sessionHandle, MutableByteSpan & outBuffer, bool & outIsEndOfLog) override; size_t GetSizeForIntent(IntentEnum intent) override; CHIP_ERROR GetLogForIntent(IntentEnum intent, MutableByteSpan & outBuffer, Optional & outTimeStamp, diff --git a/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp b/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp index 12c4e0a3dac291..e684455acaf2b8 100644 --- a/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp +++ b/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp @@ -48,7 +48,7 @@ CHIP_ERROR LogProvider::GetLogForIntent(IntentEnum intent, MutableByteSpan & out err = CollectLog(sessionHandle, outBuffer, unusedOutIsEndOfLog); VerifyOrReturnError(CHIP_NO_ERROR == err, err, outBuffer.reduce_size(0)); - err = EndLogCollection(sessionHandle, CHIP_NO_ERROR); + err = EndLogCollection(sessionHandle); VerifyOrReturnError(CHIP_NO_ERROR == err, err, outBuffer.reduce_size(0)); return CHIP_NO_ERROR; diff --git a/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp b/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp index 9ece5cee34bc20..0fce2abd8c0ca7 100644 --- a/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp +++ b/examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp @@ -65,7 +65,7 @@ CHIP_ERROR LogProvider::GetLogForIntent(IntentEnum intent, MutableByteSpan & out err = CollectLog(sessionHandle, outBuffer, unusedOutIsEndOfLog); VerifyOrReturnError(CHIP_NO_ERROR == err, err, outBuffer.reduce_size(0)); - err = EndLogCollection(sessionHandle, CHIP_NO_ERROR); + err = EndLogCollection(sessionHandle); VerifyOrReturnError(CHIP_NO_ERROR == err, err, outBuffer.reduce_size(0)); return CHIP_NO_ERROR; diff --git a/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h b/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h index fc1350ed3ec265..853086c6824b5e 100644 --- a/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h +++ b/examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h @@ -44,7 +44,7 @@ class LogProvider : public DiagnosticLogsProviderDelegate /////////// DiagnosticLogsProviderDelegate Interface ///////// CHIP_ERROR StartLogCollection(IntentEnum intent, LogSessionHandle & outHandle, Optional & outTimeStamp, Optional & outTimeSinceBoot) override; - CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error) override; + CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error = CHIP_NO_ERROR) override; CHIP_ERROR CollectLog(LogSessionHandle sessionHandle, MutableByteSpan & outBuffer, bool & outIsEndOfLog) override; size_t GetSizeForIntent(IntentEnum intent) override; CHIP_ERROR GetLogForIntent(IntentEnum intent, MutableByteSpan & outBuffer, Optional & outTimeStamp, diff --git a/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.cpp b/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.cpp index 469f462b872c5e..bbdd826d5f3343 100644 --- a/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.cpp +++ b/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.cpp @@ -191,7 +191,7 @@ void BDXDiagnosticLogsProvider::OnAckReceived() // If the buffer has empty space, end the log collection session. if (isEndOfLog) { - mDelegate->EndLogCollection(mLogSessionHandle, CHIP_NO_ERROR); + mDelegate->EndLogCollection(mLogSessionHandle); mLogSessionHandle = kInvalidLogSessionHandle; } @@ -213,7 +213,7 @@ void BDXDiagnosticLogsProvider::OnAckEOFReceived() { ChipLogProgress(BDX, "Diagnostic logs transfer: Success"); - Reset(CHIP_NO_ERROR); + Reset(); } void BDXDiagnosticLogsProvider::OnStatusReceived(TransferSession::OutputEvent & event) diff --git a/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.h b/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.h index b4294fcc756759..ddf355b70c90ed 100644 --- a/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.h +++ b/src/app/clusters/diagnostic-logs-server/BDXDiagnosticLogsProvider.h @@ -76,8 +76,10 @@ class BDXDiagnosticLogsProvider : public bdx::Initiator /** * This method is called to reset state. It resets the transfer, cleans up the * exchange and ends log collection. + * @param[in] error A CHIP_ERROR value indicating the reason for resetting the state. + * It is permissible to pass CHIP_NO_ERROR to indicate normal termination. */ - void Reset(CHIP_ERROR error); + void Reset(CHIP_ERROR error = CHIP_NO_ERROR); Messaging::ExchangeContext * mBDXTransferExchangeCtx; DiagnosticLogsProviderDelegate * mDelegate; diff --git a/src/app/clusters/diagnostic-logs-server/DiagnosticLogsProviderDelegate.h b/src/app/clusters/diagnostic-logs-server/DiagnosticLogsProviderDelegate.h index 96bbae63ef558c..aa03af34d02c11 100644 --- a/src/app/clusters/diagnostic-logs-server/DiagnosticLogsProviderDelegate.h +++ b/src/app/clusters/diagnostic-logs-server/DiagnosticLogsProviderDelegate.h @@ -59,10 +59,11 @@ class DiagnosticLogsProviderDelegate * returned from StartLogCollection. * * @param[in] sessionHandle The unique handle for this log session returned from a call to StartLogCollection. - * @param[in] error A CHIP_ERROR value that indicates the reason for ending the log collection. + * @param[in] error A CHIP_ERROR value indicating the reason for ending the log collection. + * It is permissible to pass CHIP_NO_ERROR to indicate normal termination. * */ - virtual CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error) = 0; + virtual CHIP_ERROR EndLogCollection(LogSessionHandle sessionHandle, CHIP_ERROR error = CHIP_NO_ERROR) = 0; /** * Called to get the next chunk for the log session identified by sessionHandle.