1/*
2 * Copyright (c) 2023 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_HDI_DISPLAY_BUFFER_V1_0_MAPPERSTUB_H
17#define OHOS_HDI_DISPLAY_BUFFER_V1_0_MAPPERSTUB_H
18
19#include <ipc_object_stub.h>
20#include <message_option.h>
21#include <message_parcel.h>
22#include <object_collector.h>
23#include <refbase.h>
24#include "v1_0/imapper.h"
25
26namespace OHOS {
27namespace HDI {
28namespace Display {
29namespace Buffer {
30namespace V1_0 {
31
32using namespace OHOS;
33class MapperStub : public IPCObjectStub {
34public:
35    explicit MapperStub(const sptr<IMapper> &impl);
36    virtual ~MapperStub();
37
38    int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
39
40    static int32_t MapperStubFreeMem_(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption, sptr<OHOS::HDI::Display::Buffer::V1_0::IMapper> impl);
41
42    static int32_t MapperStubMmap_(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption, sptr<OHOS::HDI::Display::Buffer::V1_0::IMapper> impl);
43
44    static int32_t MapperStubUnmap_(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption, sptr<OHOS::HDI::Display::Buffer::V1_0::IMapper> impl);
45
46    static int32_t MapperStubFlushCache_(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption, sptr<OHOS::HDI::Display::Buffer::V1_0::IMapper> impl);
47
48    static int32_t MapperStubInvalidateCache_(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption, sptr<OHOS::HDI::Display::Buffer::V1_0::IMapper> impl);
49
50    static int32_t MapperStubGetVersion_(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption, sptr<OHOS::HDI::Display::Buffer::V1_0::IMapper> impl);
51
52private:
53    int32_t MapperStubFreeMem(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption);
54
55    int32_t MapperStubMmap(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption);
56
57    int32_t MapperStubUnmap(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption);
58
59    int32_t MapperStubFlushCache(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption);
60
61    int32_t MapperStubInvalidateCache(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption);
62
63    int32_t MapperStubGetVersion(MessageParcel& mapperData, MessageParcel& mapperReply, MessageOption& mapperOption);
64
65
66    static inline ObjectDelegator<OHOS::HDI::Display::Buffer::V1_0::MapperStub, OHOS::HDI::Display::Buffer::V1_0::IMapper> objDelegator_;
67    sptr<OHOS::HDI::Display::Buffer::V1_0::IMapper> impl_;
68};
69} // V1_0
70} // Buffer
71} // Display
72} // HDI
73} // OHOS
74
75#endif // OHOS_HDI_DISPLAY_BUFFER_V1_0_MAPPERSTUB_H
76
77