• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 OHOS_DISTRIBUTED_SCHED_INTERFACE_H
17 #define OHOS_DISTRIBUTED_SCHED_INTERFACE_H
18 
19 #include <vector>
20 #include "ability_info.h"
21 #include "caller_info.h"
22 #include "iremote_broker.h"
23 #include "mission_info.h"
24 #include "mission/distributed_mission_info.h"
25 #include "mission_snapshot.h"
26 #include "ohos/aafwk/content/want.h"
27 
28 namespace OHOS {
29 namespace DistributedSchedule {
30 class IDistributedSched : public OHOS::IRemoteBroker {
31 public:
32     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedSchedule.IDistributedSched");
33     enum {
34         SAME_ACCOUNT_TYPE = 0,
35         DIFF_ACCOUNT_TYPE,
36     };
37     struct AccountInfo {
38         int32_t accountType = DIFF_ACCOUNT_TYPE;
39         std::vector<std::string> groupIdList;
40     };
41 
42     virtual int32_t StartRemoteAbility(const OHOS::AAFwk::Want& want, int32_t callerUid, int32_t requestCode,
43         uint32_t accessToken) = 0;
44     virtual int32_t StartAbilityFromRemote(const OHOS::AAFwk::Want& want,
45         const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode, const CallerInfo& callerInfo,
46         const AccountInfo& accountInfo) = 0;
47     virtual int32_t ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
48         int32_t missionId, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams) = 0;
49     virtual int32_t StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId, int32_t callerUid,
50         int32_t status, uint32_t accessToken) = 0;
51     virtual void NotifyCompleteContinuation(const std::u16string& devId, int32_t sessionId, bool isSuccess) = 0;
52     virtual int32_t NotifyContinuationResultFromRemote(int32_t sessionId, bool isSuccess) = 0;
53     virtual int32_t ConnectRemoteAbility(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
54         int32_t callerUid, int32_t callerPid, uint32_t accessToken) = 0;
55     virtual int32_t DisconnectRemoteAbility(const sptr<IRemoteObject>& connect, int32_t callerUid,
56         uint32_t accessToken) = 0;
57     virtual int32_t ConnectAbilityFromRemote(const OHOS::AAFwk::Want& want, const AppExecFwk::AbilityInfo& abilityInfo,
58         const sptr<IRemoteObject>& connect, const CallerInfo& callerInfo, const AccountInfo& accountInfo) = 0;
59     virtual int32_t DisconnectAbilityFromRemote(const sptr<IRemoteObject>& connect,
60         int32_t uid, const std::string& sourceDeviceId) = 0;
61     virtual int32_t NotifyProcessDiedFromRemote(const CallerInfo& callerInfo) = 0;
62     virtual int32_t StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) = 0;
63     virtual int32_t StartSyncMissionsFromRemote(const CallerInfo& callerInfo,
64         std::vector<DstbMissionInfo>& missionInfos) = 0;
65     virtual int32_t StopSyncRemoteMissions(const std::string& devId) = 0;
66     virtual int32_t StopSyncMissionsFromRemote(const CallerInfo& callerInfo) = 0;
67     virtual int32_t RegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) = 0;
68     virtual int32_t UnRegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) = 0;
69     virtual int32_t GetMissionInfos(const std::string& deviceId, int32_t numMissions,
70         std::vector<AAFwk::MissionInfo>& missionInfos) = 0;
71     virtual int32_t StoreSnapshotInfo(const std::string& deviceId, int32_t missionId,
72         const uint8_t* byteStream, size_t len) = 0;
73     virtual int32_t RemoveSnapshotInfo(const std::string& deviceId, int32_t missionId) = 0;
74     virtual int32_t GetRemoteMissionSnapshotInfo(const std::string& networkId, int32_t missionId,
75         std::unique_ptr<AAFwk::MissionSnapshot>& missionSnapshot) = 0;
76     virtual int32_t NotifyMissionsChangedFromRemote(const std::vector<DstbMissionInfo>& missionInfos,
77          const CallerInfo& callerInfo) = 0;
78     virtual int32_t CheckSupportOsd(const std::string& deviceId) = 0;
79     virtual void GetCachedOsdSwitch(std::vector<std::u16string>& deviceIds, std::vector<int32_t>& values) = 0;
80     virtual int32_t GetOsdSwitchValueFromRemote() = 0;
81     virtual int32_t UpdateOsdSwitchValueFromRemote(int32_t switchVal, const std::string& sourceDeviceId) = 0;
82     virtual int32_t StartRemoteAbilityByCall(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
83         int32_t callerUid, int32_t callerPid, uint32_t accessToken) = 0;
84     virtual int32_t ReleaseRemoteAbility(const sptr<IRemoteObject>& connect,
85         const AppExecFwk::ElementName &element) = 0;
86     virtual int32_t StartAbilityByCallFromRemote(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
87         const CallerInfo& callerInfo, const AccountInfo& accountInfo) = 0;
88     virtual int32_t ReleaseAbilityFromRemote(const sptr<IRemoteObject>& connect, const AppExecFwk::ElementName &element,
89         const CallerInfo& callerInfo) = 0;
90     enum {
91         START_REMOTE_ABILITY = 1,
92         STOP_REMOTE_ABILITY = 3,
93         START_ABILITY_FROM_REMOTE = 4,
94         STOP_ABILITY_FROM_REMOTE = 5,
95         CONNECT_REMOTE_ABILITY = 6,
96         DISCONNECT_REMOTE_ABILITY = 7,
97         CONNECT_ABILITY_FROM_REMOTE = 8,
98         DISCONNECT_ABILITY_FROM_REMOTE = 9,
99         START_CONTINUATION = 11,
100         NOTIFY_COMPLETE_CONTINUATION = 12,
101         NOTIFY_CONTINUATION_RESULT_FROM_REMOTE = 13,
102         REGISTER_ABILITY_TOKEN = 14,
103         UNREGISTER_ABILITY_TOKEN = 15,
104         CONTINUE_ABILITY = 16,
105         NOTIFY_PROCESS_DIED_FROM_REMOTE = 17,
106         GET_REMOTE_APPTHREAD = 35,
107         CONTINUE_MISSION = 36,
108 
109         // request code for mission
110         GET_MISSION_INFOS = 80,
111         STORE_SNAPSHOT_INFO = 81,
112         GET_REMOTE_SNAPSHOT_INFO = 82,
113         REMOVE_SNAPSHOT_INFO = 83,
114         REGISTER_MISSION_LISTENER = 84,
115         UNREGISTER_MISSION_LISTENER = 85,
116         START_SYNC_MISSIONS_FROM_REMOTE = 86,
117         STOP_SYNC_MISSIONS_FROM_REMOTE = 87,
118         CHECK_SUPPORTED_OSD = 88,
119         CHECK_SUPPORT_OSD_FROM_REMOTE = 89,
120         MISSION_CHANGED = 90,
121         NOTIFY_MISSIONS_CHANGED_FROM_REMOTE = 91,
122         START_SYNC_MISSIONS = 92,
123         TRY_OPENP2PSESSION_FROM_REMOTE = 93,
124         SWITCH_CHANGED = 94,
125         NOTIFY_SWITCH_CHANGED_FROM_REMOTE = 95,
126         GET_CACHED_SUPPORTED_OSD = 96,
127         ALL_CONNECT_TO_DMS = 97,
128         STOP_SYNC_MISSIONS = 98,
129         GET_REMOTE_MISSION_SNAPSHOT_INFO = 99,
130 
131         // request code for call ability
132         START_REMOTE_ABILITY_BY_CALL = 150,
133         RELEASE_REMOTE_ABILITY = 151,
134         START_ABILITY_BY_CALL_FROM_REMOTE = 152,
135         RELEASE_ABILITY_FROM_REMOTE = 153,
136     };
137 };
138 } // namespace DistributedSchedule
139 } // namespace OHOS
140 #endif // OHOS_DISTRIBUTED_SCHED_INTERFACE_H
141