1bc03f14fSopenharmony_ci/*
2bc03f14fSopenharmony_ci * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
3bc03f14fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4bc03f14fSopenharmony_ci * you may not use this file except in compliance with the License.
5bc03f14fSopenharmony_ci * You may obtain a copy of the License at
6bc03f14fSopenharmony_ci *
7bc03f14fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8bc03f14fSopenharmony_ci *
9bc03f14fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10bc03f14fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11bc03f14fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12bc03f14fSopenharmony_ci * See the License for the specific language governing permissions and
13bc03f14fSopenharmony_ci * limitations under the License.
14bc03f14fSopenharmony_ci */
15bc03f14fSopenharmony_ci
16bc03f14fSopenharmony_ci#ifndef PASTE_BOARD_SERVICE_STUB_H
17bc03f14fSopenharmony_ci#define PASTE_BOARD_SERVICE_STUB_H
18bc03f14fSopenharmony_ci
19bc03f14fSopenharmony_ci#include <cstdint>
20bc03f14fSopenharmony_ci#include <map>
21bc03f14fSopenharmony_ci
22bc03f14fSopenharmony_ci#include "ipc_skeleton.h"
23bc03f14fSopenharmony_ci#include "iremote_stub.h"
24bc03f14fSopenharmony_ci#include "i_pasteboard_service.h"
25bc03f14fSopenharmony_ci
26bc03f14fSopenharmony_cinamespace OHOS {
27bc03f14fSopenharmony_cinamespace MiscServices {
28bc03f14fSopenharmony_ciclass PasteboardServiceStub : public IRemoteStub<IPasteboardService> {
29bc03f14fSopenharmony_cipublic:
30bc03f14fSopenharmony_ci    PasteboardServiceStub();
31bc03f14fSopenharmony_ci    ~PasteboardServiceStub();
32bc03f14fSopenharmony_ci    API_EXPORT int32_t OnRemoteRequest(
33bc03f14fSopenharmony_ci        uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
34bc03f14fSopenharmony_ci
35bc03f14fSopenharmony_ciprivate:
36bc03f14fSopenharmony_ci    using PasteboardServiceFunc = int32_t (PasteboardServiceStub::*)(MessageParcel &data, MessageParcel &reply);
37bc03f14fSopenharmony_ci    virtual int32_t SavePasteData(std::shared_ptr<PasteData> &pasteData,
38bc03f14fSopenharmony_ci        sptr<IPasteboardDelayGetter> delayGetter = nullptr,
39bc03f14fSopenharmony_ci        sptr<IPasteboardEntryGetter> entryGetter = nullptr) = 0;
40bc03f14fSopenharmony_ci    int32_t OnClear(MessageParcel &data, MessageParcel &reply);
41bc03f14fSopenharmony_ci    int32_t OnGetRecordValueByType(MessageParcel &data, MessageParcel &reply);
42bc03f14fSopenharmony_ci    int32_t OnGetPasteData(MessageParcel &data, MessageParcel &reply);
43bc03f14fSopenharmony_ci    int32_t OnHasPasteData(MessageParcel &data, MessageParcel &reply);
44bc03f14fSopenharmony_ci    int32_t OnSetPasteData(MessageParcel &data, MessageParcel &reply);
45bc03f14fSopenharmony_ci    int32_t OnSubscribeObserver(MessageParcel &data, MessageParcel &reply);
46bc03f14fSopenharmony_ci    int32_t OnUnsubscribeObserver(MessageParcel &data, MessageParcel &reply);
47bc03f14fSopenharmony_ci    int32_t OnUnsubscribeAllObserver(MessageParcel &data, MessageParcel &reply);
48bc03f14fSopenharmony_ci    int32_t OnIsRemoteData(MessageParcel &data, MessageParcel &reply);
49bc03f14fSopenharmony_ci    int32_t OnGetDataSource(MessageParcel &data, MessageParcel &reply);
50bc03f14fSopenharmony_ci    int32_t OnHasDataType(MessageParcel &data, MessageParcel &reply);
51bc03f14fSopenharmony_ci    int32_t OnDetectPatterns(MessageParcel &data, MessageParcel &reply);
52bc03f14fSopenharmony_ci    int32_t OnSetGlobalShareOption(MessageParcel &data, MessageParcel &reply);
53bc03f14fSopenharmony_ci    int32_t OnRemoveGlobalShareOption(MessageParcel &data, MessageParcel &reply);
54bc03f14fSopenharmony_ci    int32_t OnGetGlobalShareOption(MessageParcel &data, MessageParcel &reply);
55bc03f14fSopenharmony_ci    int32_t OnSetAppShareOptions(MessageParcel &data, MessageParcel &reply);
56bc03f14fSopenharmony_ci    int32_t OnRemoveAppShareOptions(MessageParcel &data, MessageParcel &reply);
57bc03f14fSopenharmony_ci    bool IsObserverValid(MessageParcel &data, uint32_t &type, sptr<IPasteboardChangedObserver> &callback);
58bc03f14fSopenharmony_ci    int32_t OnPasteStart(MessageParcel &data, MessageParcel &reply);
59bc03f14fSopenharmony_ci    int32_t OnPasteComplete(MessageParcel &data, MessageParcel &reply);
60bc03f14fSopenharmony_ci    int32_t OnRegisterClientDeathObserver(MessageParcel &data, MessageParcel &reply);
61bc03f14fSopenharmony_ci
62bc03f14fSopenharmony_ci    std::shared_ptr<PasteData> UnmarshalPasteData(MessageParcel &data, MessageParcel &reply);
63bc03f14fSopenharmony_ci
64bc03f14fSopenharmony_ci    std::map<uint32_t, PasteboardServiceFunc> memberFuncMap_;
65bc03f14fSopenharmony_ci    static constexpr uint32_t MAX_BUNDLE_NAME_LENGTH = 127;
66bc03f14fSopenharmony_ci    static constexpr int32_t MAX_SET_GLOBAL_SHARE_OPTION_SIZE = 100;
67bc03f14fSopenharmony_ci};
68bc03f14fSopenharmony_ci} // namespace MiscServices
69bc03f14fSopenharmony_ci} // namespace OHOS
70bc03f14fSopenharmony_ci
71bc03f14fSopenharmony_ci#endif // PASTE_BOARD_SERVICE_STUB_H