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 16import testNapi from 'libharone.so'; 17 18export { MainPage } from './src/main/ets/components/mainpage/MainPage' 19 20export function harSOAdd(a:number, b:number, tag: string): number { 21 console.info(tag, 'harSOAdd call') 22 return testNapi.add(a, b); 23} 24 25export function otherHarAdd(a:number, b:number, tag: string): number { 26 console.info(tag, 'otherHarAdd call') 27 let har: ESObject = testNapi.loadModuleWithInfo('harTwo', 'com.acts.arttsnapiloadtest/entry_test'); 28 return har.add(a, b); 29} 30 31export function otherFileHarAdd(a:number, b:number, tag: string): number { 32 console.info(tag, 'otherFileHarAdd call') 33 let harFile: ESObject = testNapi.loadModuleWithInfo('harTwo/Index', 'com.acts.arttsnapiloadtest/entry_test'); 34 return harFile.add(a, b); 35} 36 37export function otherHspAdd(a:number, b:number, tag: string): number { 38 console.info(tag, 'otherHspAdd call') 39 let hsp: ESObject = testNapi.loadModuleWithInfo('hspTwo', 'com.acts.arttsnapiloadtest/entry_test'); 40 return hsp.add(a, b); 41} 42 43export function otherHspFileAdd(a:number, b:number, tag: string): number { 44 console.info(tag, 'otherHspFileAdd call') 45 let hspFile: ESObject = testNapi.loadModuleWithInfo('hspTwo/Test', 'com.acts.arttsnapiloadtest/entry_test'); 46 return hspFile.add(a, b); 47} 48 49export function loadSystemModule(tag: string): boolean { 50 console.info(tag, 'otherHspFileAdd call') 51 let testHilog: ESObject = testNapi.loadModuleWithInfo('@ohos.hilog', ''); 52 try { 53 testHilog.info(0x0000, 'SystemModule', tag + ' hilog print success'); 54 return true; 55 } catch (err) { 56 return false; 57 } 58} 59