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 <messaging/ExchangeDelegate.h> 24 : #include <messaging/ExchangeMgr.h> 25 : #include <protocols/bdx/BdxTransferDiagnosticLog.h> 26 : 27 : namespace chip { 28 : namespace bdx { 29 : 30 : class BdxTransferDiagnosticLog; 31 : 32 : class BDXTransferServer : public Messaging::UnsolicitedMessageHandler 33 : { 34 : public: 35 0 : BDXTransferServer(){}; 36 : 37 0 : ~BDXTransferServer() { Shutdown(); }; 38 : 39 : CHIP_ERROR Init(System::Layer * systemLayer, Messaging::ExchangeManager * exchangeMgr); 40 : 41 : void Shutdown(); 42 : 43 : void SetDelegate(BDXTransferServerDelegate * delegate) { mDelegate = delegate; } 44 : 45 : protected: 46 : CHIP_ERROR OnUnsolicitedMessageReceived(const PayloadHeader & payloadHeader, 47 : Messaging::ExchangeDelegate *& newDelegate) override; 48 : void OnExchangeCreationFailed(Messaging::ExchangeDelegate * delegate) override; 49 : 50 : private: 51 : System::Layer * mSystemLayer; 52 : Messaging::ExchangeManager * mExchangeMgr; 53 : 54 : BDXTransferServerDelegate * mDelegate; 55 : BdxTransferDiagnosticLogPool<CHIP_CONFIG_MAX_BDX_LOG_TRANSFERS> mPoolDelegate; 56 : }; 57 : 58 : } // namespace bdx 59 : } // namespace chip