1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 * Description: Channel for transmitting data
15 * Author: sunhong
16 * Create: 2022-01-19
17 */
18
19#ifndef CASTSESSION_CHANNEL_H
20#define CASTSESSION_CHANNEL_H
21
22#include <memory>
23#include "channel_request.h"
24#include "channel_listener.h"
25
26namespace OHOS {
27namespace CastEngine {
28namespace CastEngineService {
29class Channel {
30public:
31    virtual ~Channel() = default;
32
33    void SetRequest(const ChannelRequest &request)
34    {
35        channelRequest_ = request;
36    }
37
38    const ChannelRequest &GetRequest() const
39    {
40        return channelRequest_;
41    }
42
43    void SetListener(std::shared_ptr<IChannelListener> listener)
44    {
45        channelListener_ = listener;
46    }
47
48    std::shared_ptr<IChannelListener> GetListener()
49    {
50        return channelListener_;
51    }
52
53    virtual bool Send(const uint8_t *buffer, int length)
54    {
55        return false;
56    }
57
58private:
59    ChannelRequest channelRequest_;
60    std::shared_ptr<IChannelListener> channelListener_;
61};
62} // namespace CastEngineService
63} // namespace CastEngine
64} // namespace OHOS
65
66#endif // CASTSESSION_CHANNEL_H
67