1 /* 2 * Copyright (c) 2024 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_ABILITY_RUNTIME_NAPI_COMMON_ABILITY_IMPL_H 17 #define OHOS_ABILITY_RUNTIME_NAPI_COMMON_ABILITY_IMPL_H 18 19 #include <map> 20 21 #include "ability_manager_client.h" 22 #include "js_napi_common_ability.h" 23 #include "js_runtime_utils.h" 24 #include "napi_common_error.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 29 /** 30 * @brief GetAppType processing function. 31 * 32 * @param env The environment that the Node-API call is invoked under. 33 * @param appTypeCB Process data asynchronously. 34 * 35 * @return Return JS data successfully, otherwise return nullptr. 36 */ 37 napi_value GetAppTypeWrap(napi_env env, napi_callback_info info, AppTypeCB *appTypeCB); 38 39 /** 40 * @brief GetAbilityInfo processing function. 41 * 42 * @param env The environment that the Node-API call is invoked under. 43 * @param abilityInfoCB Process data asynchronously. 44 * 45 * @return Return JS data successfully, otherwise return nullptr. 46 */ 47 napi_value GetAbilityInfoWrap(napi_env env, napi_callback_info info, AbilityInfoCB *abilityInfoCB); 48 49 napi_value GetHapModuleInfoWrap(napi_env env, napi_callback_info info, HapModuleInfoCB *hapModuleInfoCB); 50 51 napi_value GetAppVersionInfoWrap(napi_env env, napi_callback_info info, AppVersionInfoCB *appVersionInfoCB); 52 53 /** 54 * @brief GetWantWrap processing function. 55 * 56 * @param env The environment that the Node-API call is invoked under. 57 * @param asyncCallbackInfo Process data asynchronously. 58 * 59 * @return Return JS data successfully, otherwise return nullptr. 60 */ 61 napi_value GetWantWrap(napi_env env, napi_callback_info info, AsyncCallbackInfo *asyncCallbackInfo); 62 63 /** 64 * @brief GetAbilityName processing function. 65 * 66 * @param env The environment that the Node-API call is invoked under. 67 * @param abilityNameCB Process data asynchronously. 68 * 69 * @return Return JS data successfully, otherwise return nullptr. 70 */ 71 napi_value GetAbilityNameWrap(napi_env env, napi_callback_info info, AbilityNameCB *abilityNameCB); 72 napi_value StopAbilityWrap(napi_env env, napi_callback_info info, AsyncJSCallbackInfo *asyncCallbackInfo); 73 napi_value StartBackgroundRunningWrap(napi_env &env, napi_callback_info &info, AsyncCallbackInfo *asyncCallbackInfo); 74 napi_value CancelBackgroundRunningWrap(napi_env &env, napi_callback_info &info, AsyncCallbackInfo *asyncCallbackInfo); 75 } // namespace AppExecFwk 76 } // namespace OHOS 77 #endif // OHOS_ABILITY_RUNTIME_NAPI_COMMON_ABILITY_IMPL_H