Line data Source code
1 : /**
2 : * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 : #ifndef AICPU_TS_UB_RTP_CHANNEL_H
11 : #define AICPU_TS_UB_RTP_CHANNEL_H
12 :
13 : #include "aicpu_ts_uboe_ub_rtp_channel_helper.h"
14 :
15 : namespace hcomm {
16 :
17 : constexpr char_t UB_RTP_FINISH_MSG[FINISH_MSG_SIZE] = "UbRtp Comm Pipe ready!";
18 :
19 : class AicpuTsUbRtpChannel : public AicpuTsUboeUbRtpChannelHelper {
20 : public:
21 16 : AicpuTsUbRtpChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc)
22 16 : : AicpuTsUboeUbRtpChannelHelper(endpointHandle, channelDesc)
23 16 : {}
24 :
25 16 : ~AicpuTsUbRtpChannel() = default;
26 :
27 1 : HcommChannelKind GetChannelKind() const override { return HcommChannelKind::AICPU_TS_UB_RTP; }
28 :
29 : HcclResult Init() override;
30 : ChannelStatus GetStatus() override;
31 : HcclResult Clean() override;
32 : HcclResult Resume() override;
33 :
34 : protected:
35 : HcclResult BuildConnection() override;
36 : void SendFinish() override;
37 : void RecvFinish() override;
38 :
39 : private:
40 : void ProcessUbRtpState();
41 : void ProcessUbRtpDataState();
42 :
43 34 : MAKE_ENUM(
44 : UbRtpStatus, INIT, BUILD_CONN, SEND_SIZE, RECV_SIZE, SEND_DATA, RECV_DATA, SEND_FIN, RECV_FIN, PROCESS_DATA,
45 : SET_READY, READY)
46 : UbRtpStatus ubRtpStatus{UbRtpStatus::INIT};
47 : };
48 :
49 : } // namespace hcomm
50 :
51 : #endif // AICPU_TS_UB_RTP_CHANNEL_H
|