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_INTERFACE_H 17 #define DOWNLOAD_SERVICE_INTERFACE_H 18 19 #include <cstdint> 20 #include <string> 21 22 #include "constant.h" 23 #include "iremote_broker.h" 24 #include "js_common.h" 25 #include "notify_interface.h" 26 27 namespace OHOS::Request { 28 class RequestServiceInterface : public IRemoteBroker { 29 public: 30 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Download.RequestServiceInterface"); 31 virtual int32_t Create(const Config &config, std::string &taskId) = 0; 32 virtual int32_t GetTask(const std::string &tid, const std::string &token, Config &config) = 0; 33 virtual int32_t Start(const std::string &tid) = 0; 34 virtual int32_t Pause(const std::string &tid, Version version) = 0; 35 virtual int32_t QueryMimeType(const std::string &tid, std::string &mimeType) = 0; 36 virtual int32_t Remove(const std::string &tid, Version version) = 0; 37 virtual int32_t Resume(const std::string &tid) = 0; 38 39 virtual int32_t Stop(const std::string &tid) = 0; 40 virtual int32_t Query(const std::string &tid, TaskInfo &info) = 0; 41 virtual int32_t Touch(const std::string &tid, const std::string &token, TaskInfo &info) = 0; 42 virtual int32_t Search(const Filter &filter, std::vector<std::string> &tids) = 0; 43 virtual int32_t Show(const std::string &tid, TaskInfo &info) = 0; 44 45 virtual int32_t OpenChannel(int32_t &sockFd) = 0; 46 virtual int32_t Subscribe(const std::string &taskId) = 0; 47 virtual int32_t Unsubscribe(const std::string &taskId) = 0; 48 virtual int32_t SubRunCount(const sptr<NotifyInterface> &listener) = 0; 49 virtual int32_t UnsubRunCount() = 0; 50 }; 51 } // namespace OHOS::Request 52 #endif // DOWNLOAD_SERVICE_INTERFACE_H