1/*
2 * Copyright (c) 2022-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 */
15
16#ifndef OHOS_IDAUDIO_HDI_CALLBACK_H
17#define OHOS_IDAUDIO_HDI_CALLBACK_H
18
19#include "audio_data.h"
20#include "audio_event.h"
21#include "audio_param.h"
22
23namespace OHOS {
24namespace DistributedHardware {
25class IDAudioHdiCallback {
26public:
27    virtual ~IDAudioHdiCallback() = default;
28
29    virtual int32_t CreateStream(const int32_t streamId) = 0;
30
31    virtual int32_t DestroyStream(const int32_t streamId) = 0;
32
33    virtual int32_t SetParameters(const int32_t streamId, const AudioParamHDF &param) = 0;
34
35    virtual int32_t NotifyEvent(const int32_t streamId, const AudioEvent &event) = 0;
36
37    virtual int32_t WriteStreamData(const int32_t streamId, std::shared_ptr<AudioData> &data) = 0;
38
39    virtual int32_t ReadStreamData(const int32_t streamId, std::shared_ptr<AudioData> &data) = 0;
40
41    virtual int32_t ReadMmapPosition(const int32_t streamId, uint64_t &frames, CurrentTimeHDF &time) = 0;
42
43    virtual int32_t RefreshAshmemInfo(const int32_t streamId,
44        int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) = 0;
45};
46} // DistributedHardware
47} // OHOS
48
49#endif // OHOS_IDAUDIO_HDI_CALLBACK_H