Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2023 Project CHIP Authors
4 : * All rights reserved.
5 : *
6 : * Licensed under the Apache License, Version 2.0 (the "License");
7 : * you may not use this file except in compliance with the License.
8 : * You may obtain a copy of the License at
9 : *
10 : * http://www.apache.org/licenses/LICENSE-2.0
11 : *
12 : * Unless required by applicable law or agreed to in writing, software
13 : * distributed under the License is distributed on an "AS IS" BASIS,
14 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 : * See the License for the specific language governing permissions and
16 : * limitations under the License.
17 : */
18 :
19 : #pragma once
20 :
21 : #include <protocols/bdx/BdxTransferDiagnosticLogPool.h>
22 :
23 : #include <lib/core/DataModelTypes.h>
24 : #include <messaging/ExchangeDelegate.h>
25 : #include <messaging/ExchangeMgr.h>
26 : #include <protocols/bdx/BdxTransferDiagnosticLog.h>
27 :
28 : namespace chip {
29 : namespace bdx {
30 :
31 : class BdxTransferDiagnosticLog;
32 :
33 : class BDXTransferServer : public Messaging::UnsolicitedMessageHandler
34 : {
35 : public:
36 0 : BDXTransferServer(){};
37 :
38 0 : ~BDXTransferServer() { Shutdown(); };
39 :
40 : CHIP_ERROR Init(System::Layer * systemLayer, Messaging::ExchangeManager * exchangeMgr);
41 :
42 : void Shutdown();
43 :
44 : void SetDelegate(BDXTransferServerDelegate * delegate) { mDelegate = delegate; }
45 :
46 0 : void AbortTransfersForFabric(FabricIndex fabricIndex) { mPoolDelegate.AbortTransfersForFabric(fabricIndex); }
47 :
48 : protected:
49 : CHIP_ERROR OnUnsolicitedMessageReceived(const PayloadHeader & payloadHeader,
50 : Messaging::ExchangeDelegate *& newDelegate) override;
51 : void OnExchangeCreationFailed(Messaging::ExchangeDelegate * delegate) override;
52 :
53 : private:
54 : System::Layer * mSystemLayer;
55 : Messaging::ExchangeManager * mExchangeMgr;
56 :
57 : BDXTransferServerDelegate * mDelegate;
58 : BdxTransferDiagnosticLogPool<CHIP_CONFIG_MAX_BDX_LOG_TRANSFERS> mPoolDelegate;
59 : };
60 :
61 : } // namespace bdx
62 : } // namespace chip
|