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 DOWNLOAD_SERVICE_PROXY_H
17 #define DOWNLOAD_SERVICE_PROXY_H
18 
19 #include <cstdint>
20 
21 #include "iremote_proxy.h"
22 #include "js_common.h"
23 #include "notify_interface.h"
24 #include "request_service_interface.h"
25 
26 namespace OHOS::Request {
27 class RequestServiceProxy : public IRemoteProxy<RequestServiceInterface> {
28 public:
29     explicit RequestServiceProxy(const sptr<IRemoteObject> &object);
30     ~RequestServiceProxy() = default;
31     DISALLOW_COPY_AND_MOVE(RequestServiceProxy);
32     int32_t Create(const Config &config, std::string &tid) override;
33     int32_t GetTask(const std::string &tid, const std::string &token, Config &config) override;
34     int32_t Start(const std::string &tid) override;
35     int32_t Pause(const std::string &tid, Version version) override;
36     int32_t QueryMimeType(const std::string &tid, std::string &mimeType) override;
37     int32_t Remove(const std::string &tid, Version version) override;
38     int32_t Resume(const std::string &tid) override;
39 
40     int32_t Stop(const std::string &tid) override;
41     int32_t Query(const std::string &tid, TaskInfo &info) override;
42     int32_t Touch(const std::string &tid, const std::string &token, TaskInfo &info) override;
43     int32_t Search(const Filter &filter, std::vector<std::string> &tids) override;
44     int32_t Show(const std::string &tid, TaskInfo &info) override;
45 
46     int32_t OpenChannel(int32_t &sockFd) override;
47     int32_t Subscribe(const std::string &tid) override;
48     int32_t Unsubscribe(const std::string &tid) override;
49     int32_t SubRunCount(const sptr<NotifyInterface> &listener) override;
50     int32_t UnsubRunCount() override;
51 
52 private:
53     static void GetVectorData(const Config &config, MessageParcel &data);
54     static inline BrokerDelegator<RequestServiceProxy> delegator_;
55 };
56 } // namespace OHOS::Request
57 #endif // DOWNLOAD_SERVICE_PROXY_H
58