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