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