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 FOUNDATION_APPEXECFWK_SERVICES_DBMS_INCLUDE_DISTRIBUTED_BMS_INTERFACE_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_DBMS_INCLUDE_DISTRIBUTED_BMS_INTERFACE_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "appexecfwk_errors.h"
23 #include "distributed_bundle_info.h"
24 #include "element_name.h"
25 #include "iremote_broker.h"
26 #include "remote_ability_info.h"
27 
28 namespace OHOS {
29 namespace AppExecFwk {
30 class IDistributedBms : public IRemoteBroker {
31 public:
32     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IDistributedbms");
33 
34     /**
35      * @brief get remote ability info
36      * @param elementName Indicates the elementName.
37      * @param remoteAbilityInfo Indicates the remote ability info.
38      * @return Returns result code when get remote ability info.
39      */
GetRemoteAbilityInfo(const OHOS::AppExecFwk::ElementName & elementName,RemoteAbilityInfo & remoteAbilityInfo)40     virtual int32_t GetRemoteAbilityInfo(
41         const OHOS::AppExecFwk::ElementName &elementName, RemoteAbilityInfo &remoteAbilityInfo)
42     {
43         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
44     }
45 
46     /**
47      * @brief get remote ability info
48      * @param elementName Indicates the elementName.
49      * @param localeInfo Indicates the localeInfo.
50      * @param remoteAbilityInfo Indicates the remote ability info.
51      * @return Returns result code when get remote ability info.
52      */
GetRemoteAbilityInfo(const OHOS::AppExecFwk::ElementName & elementName,const std::string & localeInfo,RemoteAbilityInfo & remoteAbilityInfo)53     virtual int32_t GetRemoteAbilityInfo(const OHOS::AppExecFwk::ElementName &elementName,
54         const std::string &localeInfo, RemoteAbilityInfo &remoteAbilityInfo)
55     {
56         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
57     }
58 
59     /**
60      * @brief get remote ability infos
61      * @param elementNames Indicates the elementNames.
62      * @param remoteAbilityInfos Indicates the remote ability infos.
63      * @return Returns result code when get remote ability infos.
64      */
GetRemoteAbilityInfos(const std::vector<ElementName> & elementNames,std::vector<RemoteAbilityInfo> & remoteAbilityInfos)65     virtual int32_t GetRemoteAbilityInfos(
66         const std::vector<ElementName> &elementNames, std::vector<RemoteAbilityInfo> &remoteAbilityInfos)
67     {
68         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
69     }
70 
71     /**
72      * @brief get remote ability infos
73      * @param elementNames Indicates the elementNames.
74      * @param localeInfo Indicates the localeInfo.
75      * @param remoteAbilityInfos Indicates the remote ability infos.
76      * @return Returns result code when get remote ability infos.
77      */
GetRemoteAbilityInfos(const std::vector<ElementName> & elementNames,const std::string & localeInfo,std::vector<RemoteAbilityInfo> & remoteAbilityInfos)78     virtual int32_t GetRemoteAbilityInfos(const std::vector<ElementName> &elementNames, const std::string &localeInfo,
79         std::vector<RemoteAbilityInfo> &remoteAbilityInfos)
80     {
81         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
82     }
83 
84     /**
85      * @brief get ability info
86      * @param elementName Indicates the elementName.
87      * @param remoteAbilityInfo Indicates the remote ability info.
88      * @return Returns result code when get ability info.
89      */
GetAbilityInfo(const OHOS::AppExecFwk::ElementName & elementName,RemoteAbilityInfo & remoteAbilityInfo)90     virtual int32_t GetAbilityInfo(
91         const OHOS::AppExecFwk::ElementName &elementName, RemoteAbilityInfo &remoteAbilityInfo)
92     {
93         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
94     }
95 
96     /**
97      * @brief get ability info
98      * @param elementName Indicates the elementName.
99      * @param localeInfo Indicates the localeInfo.
100      * @param remoteAbilityInfo Indicates the remote ability info.
101      * @return Returns result code when get ability info.
102      */
GetAbilityInfo(const OHOS::AppExecFwk::ElementName & elementName,const std::string & localeInfo,RemoteAbilityInfo & remoteAbilityInfo)103     virtual int32_t GetAbilityInfo(const OHOS::AppExecFwk::ElementName &elementName, const std::string &localeInfo,
104         RemoteAbilityInfo &remoteAbilityInfo)
105     {
106         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
107     }
108 
109     /**
110      * @brief get ability infos
111      * @param elementNames Indicates the elementNames.
112      * @param remoteAbilityInfos Indicates the remote ability infos.
113      * @return Returns result code when get ability infos.
114      */
GetAbilityInfos(const std::vector<ElementName> & elementNames,std::vector<RemoteAbilityInfo> & remoteAbilityInfos)115     virtual int32_t GetAbilityInfos(
116         const std::vector<ElementName> &elementNames, std::vector<RemoteAbilityInfo> &remoteAbilityInfos)
117     {
118         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
119     }
120 
121     /**
122      * @brief get ability infos
123      * @param elementNames Indicates the elementNames.
124      * @param localeInfo Indicates the localeInfo.
125      * @param remoteAbilityInfos Indicates the remote ability infos.
126      * @return Returns result code when get ability infos.
127      */
GetAbilityInfos(const std::vector<ElementName> & elementNames,const std::string & localeInfo,std::vector<RemoteAbilityInfo> & remoteAbilityInfos)128     virtual int32_t GetAbilityInfos(const std::vector<ElementName> &elementNames, const std::string &localeInfo,
129         std::vector<RemoteAbilityInfo> &remoteAbilityInfos)
130     {
131         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
132     }
133 
GetDistributedBundleInfo(const std::string & networkId,const std::string & bundleName,DistributedBundleInfo & distributedBundleInfo)134     virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
135         DistributedBundleInfo &distributedBundleInfo)
136     {
137         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
138     }
139 
140     /**
141      * @brief get distributedBundleName based on a given accessTokenId and networkId.
142      * @param networkId Indicates the networkId of remote device.
143      * @param accessTokenId AccessTokenId of the application
144      * @param bundleNames distributed bundle name.
145      * @return Returns ERR_OK on success, others on failure when get distributed bundle name.
146      */
GetDistributedBundleName(const std::string & networkId,uint32_t accessTokenId,std::string & bundleName)147     virtual int32_t GetDistributedBundleName(const std::string &networkId, uint32_t accessTokenId,
148         std::string &bundleName)
149     {
150         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
151     }
152 };
153 }  // namespace AppExecFwk
154 }  // namespace OHOS
155 #endif  // FOUNDATION_APPEXECFWK_SERVICES_DBMS_INCLUDE_DISTRIBUTED_BMS_INTERFACE_H