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 "notify_interface.h" 25 #include "request_common.h" 26 27 namespace OHOS::Request { 28 class RequestServiceInterface : public IRemoteBroker { 29 public: 30 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Download.RequestServiceInterface"); 31 virtual ExceptionErrorCode CreateTasks(const std::vector<Config> &configs, std::vector<TaskRet> &rets) = 0; 32 virtual ExceptionErrorCode StartTasks( 33 const std::vector<std::string> &tids, std::vector<ExceptionErrorCode> &rets) = 0; 34 virtual ExceptionErrorCode StopTasks( 35 const std::vector<std::string> &tids, std::vector<ExceptionErrorCode> &rets) = 0; 36 virtual ExceptionErrorCode ResumeTasks( 37 const std::vector<std::string> &tids, std::vector<ExceptionErrorCode> &rets) = 0; 38 virtual ExceptionErrorCode RemoveTasks( 39 const std::vector<std::string> &tids, const Version version, std::vector<ExceptionErrorCode> &rets) = 0; 40 virtual ExceptionErrorCode PauseTasks( 41 const std::vector<std::string> &tids, const Version version, std::vector<ExceptionErrorCode> &rets) = 0; 42 virtual ExceptionErrorCode QueryTasks(const std::vector<std::string> &tids, std::vector<TaskInfoRet> &rets) = 0; 43 virtual ExceptionErrorCode ShowTasks(const std::vector<std::string> &tids, std::vector<TaskInfoRet> &rets) = 0; 44 virtual ExceptionErrorCode TouchTasks( 45 const std::vector<TaskIdAndToken> &tidTokens, std::vector<TaskInfoRet> &rets) = 0; 46 virtual ExceptionErrorCode SetMaxSpeeds( 47 const std::vector<SpeedConfig> &speedConfig, std::vector<ExceptionErrorCode> &rets) = 0; 48 49 virtual ExceptionErrorCode SetMode(const std::string &tid, const Mode mode) = 0; 50 virtual ExceptionErrorCode DisableTaskNotification( 51 const std::vector<std::string> &tids, std::vector<ExceptionErrorCode> &rets) = 0; 52 53 virtual int32_t Create(const Config &config, std::string &taskId) = 0; 54 virtual int32_t GetTask(const std::string &tid, const std::string &token, Config &config) = 0; 55 virtual int32_t Start(const std::string &tid) = 0; 56 virtual int32_t Pause(const std::string &tid, const Version version) = 0; 57 virtual int32_t QueryMimeType(const std::string &tid, std::string &mimeType) = 0; 58 virtual int32_t Remove(const std::string &tid, const Version version) = 0; 59 virtual int32_t Resume(const std::string &tid) = 0; 60 virtual int32_t SetMaxSpeed(const std::string &tid, const int64_t maxSpeed) = 0; 61 62 virtual int32_t Stop(const std::string &tid) = 0; 63 virtual int32_t Query(const std::string &tid, TaskInfo &info) = 0; 64 virtual int32_t Touch(const std::string &tid, const std::string &token, TaskInfo &info) = 0; 65 virtual int32_t Search(const Filter &filter, std::vector<std::string> &tids) = 0; 66 virtual int32_t Show(const std::string &tid, TaskInfo &info) = 0; 67 68 virtual int32_t OpenChannel(int32_t &sockFd) = 0; 69 virtual int32_t Subscribe(const std::string &taskId) = 0; 70 virtual int32_t Unsubscribe(const std::string &taskId) = 0; 71 virtual int32_t SubRunCount(const sptr<NotifyInterface> &listener) = 0; 72 virtual int32_t UnsubRunCount() = 0; 73 virtual int32_t CreateGroup( 74 std::string &gid, const bool gauge, Notification ¬ification) = 0; 75 virtual int32_t AttachGroup(const std::string &gid, const std::vector<std::string> &tids) = 0; 76 virtual int32_t DeleteGroup(const std::string &gid) = 0; 77 }; 78 } // namespace OHOS::Request 79 #endif // DOWNLOAD_SERVICE_INTERFACE_H