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 APPEXECFWK_STANDARD_KITS_APPKIT_NAPI_DISTRIBUTEBUNDLEMGR_DISTRIBUTED_BUNDLE_MGR_H
17 #define APPEXECFWK_STANDARD_KITS_APPKIT_NAPI_DISTRIBUTEBUNDLEMGR_DISTRIBUTED_BUNDLE_MGR_H
18 #include <vector>
19 
20 #include "napi/native_api.h"
21 #include "napi/native_common.h"
22 #include "napi/native_node_api.h"
23 #include "application_info.h"
24 #include "element_name.h"
25 #include "remote_ability_info.h"
26 
27 namespace OHOS {
28 namespace AppExecFwk {
29 struct AsyncWorkData {
30     explicit AsyncWorkData(napi_env napiEnv);
31     virtual ~AsyncWorkData();
32     napi_env env;
33     napi_async_work asyncWork = nullptr;
34     napi_deferred deferred = nullptr;
35     napi_ref callbackRef = nullptr;
36 };
37 
38 struct ElementNameInfo : public AsyncWorkData {
ElementNameInfoElementNameInfo39     explicit ElementNameInfo(napi_env env) : AsyncWorkData(env) {}
40     OHOS::AppExecFwk::ElementName elementName;
41     std::string locale;
42     OHOS::AppExecFwk::RemoteAbilityInfo remoteAbilityInfo;
43     int32_t errCode = 0;
44     bool result = false;
45     std::string errMssage;
46 };
47 
48 struct ElementNameInfos: public AsyncWorkData {
ElementNameInfosElementNameInfos49     explicit ElementNameInfos(napi_env env) : AsyncWorkData(env) {}
50     std::vector<ElementName> elementNames;
51     std::string locale;
52     std::vector<RemoteAbilityInfo> remoteAbilityInfos;
53     int32_t errCode = 0;
54     bool result = false;
55     std::string errMssage;
56 };
57 
58 napi_value GetRemoteAbilityInfo(napi_env env, napi_callback_info info);
59 napi_value GetRemoteAbilityInfos(napi_env env, napi_callback_info info);
60 }  // namespace AppExecFwk
61 }  // namespace OHOS
62 #endif /* APPEXECFWK_STANDARD_KITS_APPKIT_NAPI_DISTRIBUTEBUNDLEMGR_DISTRIBUTED_BUNDLE_MGR_H */