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