Line data Source code
1 : /* 2 : * Copyright (c) 2023 Project CHIP Authors 3 : * All rights reserved. 4 : * 5 : * Licensed under the Apache License, Version 2.0 (the "License"); 6 : * you may not use this file except in compliance with the License. 7 : * You may obtain a copy of the License at 8 : * 9 : * http://www.apache.org/licenses/LICENSE-2.0 10 : * 11 : * Unless required by applicable law or agreed to in writing, software 12 : * distributed under the License is distributed on an "AS IS" BASIS, 13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 : * See the License for the specific language governing permissions and 15 : * limitations under the License. 16 : * 17 : */ 18 : 19 : #pragma once 20 : 21 : #include <protocols/bdx/BdxTransferProxy.h> 22 : #include <protocols/bdx/BdxTransferSession.h> 23 : #include <protocols/bdx/DiagnosticLogs.h> 24 : 25 : namespace chip { 26 : namespace bdx { 27 : 28 : class BDXTransferProxyDiagnosticLog : public BDXTransferProxy 29 : { 30 : public: 31 : CHIP_ERROR Init(TransferSession * transferSession); 32 : void Reset(); 33 : 34 0 : void SetFabricIndex(FabricIndex fabricIndex) { mFabricIndex = fabricIndex; } 35 0 : void SetPeerNodeId(NodeId nodeId) { mPeerNodeId = nodeId; } 36 : 37 : CHIP_ERROR Accept() override; 38 : CHIP_ERROR Reject(CHIP_ERROR error) override; 39 : CHIP_ERROR Continue() override; 40 : 41 0 : FabricIndex GetFabricIndex() const override { return mFabricIndex; } 42 0 : NodeId GetPeerNodeId() const override { return mPeerNodeId; } 43 0 : CharSpan GetFileDesignator() const override { return CharSpan(mFileDesignator, mFileDesignatorLen); }; 44 : 45 : private: 46 : CHIP_ERROR EnsureState() const; 47 : 48 : uint8_t mFileDesignatorLen = 0; 49 : char mFileDesignator[DiagnosticLogs::kMaxFileDesignatorLen] = {}; 50 : TransferSession * mTransfer = nullptr; 51 : FabricIndex mFabricIndex = kUndefinedFabricIndex; 52 : NodeId mPeerNodeId = kUndefinedNodeId; 53 : }; 54 : 55 : } // namespace bdx 56 : } // namespace chip