• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 <string>
20 
21 #include "download_config.h"
22 #include "download_info.h"
23 #include "download_notify_interface.h"
24 #include "iremote_broker.h"
25 
26 namespace OHOS::Request::Download {
27 class DownloadServiceInterface : public IRemoteBroker {
28 public:
29     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Download.DownloadServiceInterface");
30     virtual uint32_t Request(const DownloadConfig &config) = 0;
31     virtual bool Pause(uint32_t taskId) = 0;
32     virtual bool Query(uint32_t taskId, DownloadInfo &info) = 0;
33     virtual bool QueryMimeType(uint32_t taskId, std::string &mimeType) = 0;
34     virtual bool Remove(uint32_t taskId) = 0;
35     virtual bool Resume(uint32_t taskId) = 0;
36     virtual bool On(uint32_t taskId, const std::string &type, const sptr<DownloadNotifyInterface> &listener) = 0;
37     virtual bool Off(uint32_t taskId, const std::string &type) = 0;
38     virtual bool CheckPermission() = 0;
39 };
40 
41 enum {
42     CMD_REQUEST,
43     CMD_PAUSE,
44     CMD_QUERY,
45     CMD_QUERYMIMETYPE,
46     CMD_REMOVE,
47     CMD_RESUME,
48     CMD_ON,
49     CMD_OFF,
50     CMD_CHECKPERMISSION,
51 };
52 } // namespace OHOS::Request::Download
53 #endif // DOWNLOAD_SERVICE_INTERFACE_H
54