1c8a96e64Sopenharmony_ci/* 2c8a96e64Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 3c8a96e64Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c8a96e64Sopenharmony_ci * you may not use this file except in compliance with the License. 5c8a96e64Sopenharmony_ci * You may obtain a copy of the License at 6c8a96e64Sopenharmony_ci * 7c8a96e64Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c8a96e64Sopenharmony_ci * 9c8a96e64Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c8a96e64Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c8a96e64Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c8a96e64Sopenharmony_ci * See the License for the specific language governing permissions and 13c8a96e64Sopenharmony_ci * limitations under the License. 14c8a96e64Sopenharmony_ci */ 15c8a96e64Sopenharmony_ci 16c8a96e64Sopenharmony_ci#include "native_engine/native_engine.h" 17c8a96e64Sopenharmony_ci 18c8a96e64Sopenharmony_ci#include "napi/native_api.h" 19c8a96e64Sopenharmony_ci#include "napi/native_node_api.h" 20c8a96e64Sopenharmony_ci#include "advanced_ui_component/navpushpathhelper/include/hsp_silentinstall_napi.h" 21c8a96e64Sopenharmony_ci 22c8a96e64Sopenharmony_ciextern const char _binary_navpushpathhelper_abc_start[]; 23c8a96e64Sopenharmony_ciextern const char _binary_navpushpathhelper_abc_end[]; 24c8a96e64Sopenharmony_ci 25c8a96e64Sopenharmony_cinamespace OHOS::NavPushPathHelper { 26c8a96e64Sopenharmony_ci /* 27c8a96e64Sopenharmony_ci * function for module exports 28c8a96e64Sopenharmony_ci */ 29c8a96e64Sopenharmony_ci static napi_value Init(napi_env env, napi_value exports) 30c8a96e64Sopenharmony_ci { 31c8a96e64Sopenharmony_ci /* 32c8a96e64Sopenharmony_ci * Properties define 33c8a96e64Sopenharmony_ci */ 34c8a96e64Sopenharmony_ci napi_property_descriptor desc[] = { 35c8a96e64Sopenharmony_ci DECLARE_NAPI_FUNCTION("silentInstall", HspSilentInstallNapi::SilentInstall), 36c8a96e64Sopenharmony_ci DECLARE_NAPI_FUNCTION("isHspExist", HspSilentInstallNapi::IsHspExist), 37c8a96e64Sopenharmony_ci DECLARE_NAPI_FUNCTION("initRouteMap", HspSilentInstallNapi::InitRouteMap), 38c8a96e64Sopenharmony_ci }; 39c8a96e64Sopenharmony_ci NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); 40c8a96e64Sopenharmony_ci return exports; 41c8a96e64Sopenharmony_ci } 42c8a96e64Sopenharmony_ci 43c8a96e64Sopenharmony_ci // Napi get abc code function 44c8a96e64Sopenharmony_ci extern "C" __attribute__((visibility("default"))) 45c8a96e64Sopenharmony_ci void NAPI_atomicservice_NavPushPathHelper_GetABCCode(const char **buf, int *buflen) 46c8a96e64Sopenharmony_ci { 47c8a96e64Sopenharmony_ci if (buf != nullptr) { 48c8a96e64Sopenharmony_ci *buf = _binary_navpushpathhelper_abc_start; 49c8a96e64Sopenharmony_ci } 50c8a96e64Sopenharmony_ci if (buflen != nullptr) { 51c8a96e64Sopenharmony_ci *buflen = _binary_navpushpathhelper_abc_end - _binary_navpushpathhelper_abc_start; 52c8a96e64Sopenharmony_ci } 53c8a96e64Sopenharmony_ci } 54c8a96e64Sopenharmony_ci 55c8a96e64Sopenharmony_ci /* 56c8a96e64Sopenharmony_ci * Module define 57c8a96e64Sopenharmony_ci */ 58c8a96e64Sopenharmony_ci static napi_module NavPushPathHelperModule = { 59c8a96e64Sopenharmony_ci .nm_version = 1, 60c8a96e64Sopenharmony_ci .nm_flags = 0, 61c8a96e64Sopenharmony_ci .nm_filename = nullptr, 62c8a96e64Sopenharmony_ci .nm_register_func = Init, 63c8a96e64Sopenharmony_ci .nm_modname = "atomicservice.NavPushPathHelper", 64c8a96e64Sopenharmony_ci .nm_priv = ((void*)0), 65c8a96e64Sopenharmony_ci .reserved = { 0 }, 66c8a96e64Sopenharmony_ci }; 67c8a96e64Sopenharmony_ci 68c8a96e64Sopenharmony_ci /* 69c8a96e64Sopenharmony_ci * Module registerfunction 70c8a96e64Sopenharmony_ci */ 71c8a96e64Sopenharmony_ci extern "C" __attribute__((constructor)) void NavPushPathHelperRegisterModule(void) 72c8a96e64Sopenharmony_ci { 73c8a96e64Sopenharmony_ci napi_module_register(&NavPushPathHelperModule); 74c8a96e64Sopenharmony_ci } 75c8a96e64Sopenharmony_ci}