-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for diagnostic logs server cluster and add the log provid…
…er delegate to all-clusters-app - Add darwin code to download logs of differnt types and get the logs transferred via BDX
- Loading branch information
1 parent
836ceec
commit bb90d85
Showing
31 changed files
with
2,252 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...les/all-clusters-app/all-clusters-common/include/diagnostic-logs-provider-delegate-impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <app/clusters/diagnostic-logs-server/diagnostic-logs-provider-delegate.h> | ||
#include <app/clusters/diagnostic-logs-server/diagnostic-logs-server.h> | ||
|
||
#include <fstream> | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
namespace DiagnosticLogs { | ||
|
||
/** | ||
* The application delegate to statically define the options. | ||
*/ | ||
|
||
class LogProvider : public LogProviderDelegate | ||
{ | ||
static LogSessionHandle sLogSessionHandle; | ||
static LogProvider sInstance; | ||
|
||
public: | ||
|
||
LogSessionHandle StartLogCollection(IntentEnum logType); | ||
|
||
uint64_t GetNextChunk(LogSessionHandle logSessionHandle, chip::MutableByteSpan & outBuffer, bool & outIsEOF); | ||
|
||
void EndLogCollection(LogSessionHandle logSessionHandle); | ||
|
||
uint64_t GetTotalNumberOfBytesConsumed(LogSessionHandle logSessionHandle); | ||
|
||
void SetEndUserSupportLogFileDesignator(const char * logFileName); | ||
|
||
void SetNetworkDiagnosticsLogFileDesignator(const char * logFileName); | ||
|
||
void SetCrashLogFileDesignator(const char * logFileName); | ||
|
||
LogProvider() = default; | ||
|
||
~LogProvider() = default; | ||
|
||
static inline LogProvider & getLogProvider() { return sInstance; } | ||
|
||
private: | ||
|
||
const char * GetLogFilePath(IntentEnum logType); | ||
|
||
char mEndUserSupportLogFileDesignator[kLogFileDesignatorMaxLen]; | ||
char mNetworkDiagnosticsLogFileDesignator[kLogFileDesignatorMaxLen]; | ||
char mCrashLogFileDesignator[kLogFileDesignatorMaxLen]; | ||
|
||
//std::ifstream mFileStream; | ||
char mFileDesignator[kLogFileDesignatorMaxLen]; | ||
|
||
LogSessionHandle mLogSessionHandle; | ||
|
||
uint64_t mTotalNumberOfBytesConsumed; | ||
}; | ||
|
||
} // namespace DiagnosticLogs | ||
} // namespace Clusters | ||
} // namespace app | ||
} // namespace chip |
Oops, something went wrong.