Skip to content

Commit

Permalink
diagnostic-logs-cluster: make changes backword compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
esp committed Dec 11, 2024
1 parent 9e7dc2d commit acb0ac5
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LogProvider : public DiagnosticLogsProviderDelegate
/////////// DiagnosticLogsProviderDelegate Interface /////////
CHIP_ERROR StartLogCollection(IntentEnum intent, LogSessionHandle & outHandle, Optional<uint64_t> & outTimeStamp,
Optional<uint64_t> & 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<uint64_t> & outTimeStamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class LogProvider : public DiagnosticLogsProviderDelegate
/////////// DiagnosticLogsProviderDelegate Interface /////////
CHIP_ERROR StartLogCollection(IntentEnum intent, LogSessionHandle & outHandle, Optional<uint64_t> & outTimeStamp,
Optional<uint64_t> & 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<uint64_t> & outTimeStamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LogProvider : public DiagnosticLogsProviderDelegate
/////////// DiagnosticLogsProviderDelegate Interface /////////
CHIP_ERROR StartLogCollection(IntentEnum intent, LogSessionHandle & outHandle, Optional<uint64_t> & outTimeStamp,
Optional<uint64_t> & 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<uint64_t> & outTimeStamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -213,7 +213,7 @@ void BDXDiagnosticLogsProvider::OnAckEOFReceived()
{
ChipLogProgress(BDX, "Diagnostic logs transfer: Success");

Reset(CHIP_NO_ERROR);
Reset();
}

void BDXDiagnosticLogsProvider::OnStatusReceived(TransferSession::OutputEvent & event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit acb0ac5

Please sign in to comment.