• 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 #ifndef FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_IWORK_SCHED_SERVICE_H
16 #define FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_IWORK_SCHED_SERVICE_H
17 
18 #include <string>
19 #include <vector>
20 
21 #include <iremote_broker.h>
22 #include <iremote_object.h>
23 
24 #include "work_info.h"
25 
26 namespace OHOS {
27 namespace WorkScheduler {
28 class IWorkSchedService : public IRemoteBroker {
29 public:
30     enum {
31         START_WORK = 0,
32         STOP_WORK,
33         STOP_AND_CANCEL_WORK,
34         STOP_AND_CLEAR_WORKS,
35         IS_LAST_WORK_TIMEOUT,
36         OBTAIN_ALL_WORKS,
37         GET_WORK_STATUS,
38         DUMP_INFO
39     };
40 
41     virtual bool StartWork(WorkInfo& workInfo) = 0;
42     virtual bool StopWork(WorkInfo& workInfo) = 0;
43     virtual bool StopAndCancelWork(WorkInfo& workInfo) = 0;
44     virtual bool StopAndClearWorks() = 0;
45     virtual bool IsLastWorkTimeout(int32_t workId) = 0;
46     virtual std::list<std::shared_ptr<WorkInfo>> ObtainAllWorks(int32_t &uid, int32_t &pid) = 0;
47     virtual std::shared_ptr<WorkInfo> GetWorkStatus(int32_t &uid, int32_t &workId) = 0;
48     virtual bool ShellDump(const std::vector<std::string> &dumpOption, std::vector<std::string> &dumpInfo) = 0;
49 
50     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.workscheduler.iworkschedservice");
51 };
52 } // namespace WorkScheduler
53 } // namespace OHOS
54 #endif // FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_IWORK_SCHED_SERVICE_H