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 :
11 : #ifndef AICPU_TS_UB_RTP_CHANNEL_H
12 : #define AICPU_TS_UB_RTP_CHANNEL_H
13 :
14 : #include "aicpu_ts_uboe_ub_rtp_channel_helper.h"
15 :
16 : namespace hcomm {
17 :
18 : constexpr char_t UB_RTP_FINISH_MSG[FINISH_MSG_SIZE] = "UbRtp Comm Pipe ready!";
19 :
20 : class AicpuTsUbRtpChannel : public AicpuTsUboeUbRtpChannelHelper {
21 : public:
22 16 : AicpuTsUbRtpChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc)
23 16 : : AicpuTsUboeUbRtpChannelHelper(endpointHandle, channelDesc)
24 16 : {}
25 :
26 16 : ~AicpuTsUbRtpChannel() = default;
27 :
28 1 : HcommChannelKind GetChannelKind() const override { return HcommChannelKind::AICPU_TS_UB_RTP; }
29 :
30 : HcclResult Init() override;
31 : ChannelStatus GetStatus() override;
32 : HcclResult Clean() override;
33 : HcclResult Resume() override;
34 :
35 : protected:
36 : HcclResult BuildConnection() override;
37 : void SendFinish() override;
38 : void RecvFinish() override;
39 :
40 : private:
41 : void ProcessUbRtpState();
42 : void ProcessUbRtpDataState();
43 :
44 34 : MAKE_ENUM(
45 : UbRtpStatus, INIT, BUILD_CONN, SEND_SIZE, RECV_SIZE, SEND_DATA, RECV_DATA, SEND_FIN, RECV_FIN, PROCESS_DATA,
46 : SET_READY, READY)
47 : UbRtpStatus ubRtpStatus{UbRtpStatus::INIT};
48 : };
49 :
50 : } // namespace hcomm
51 :
52 : #endif // AICPU_TS_UB_RTP_CHANNEL_H
|