/**
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import testNapi from 'libhspone.so';
export { add } from './src/main/ets/utils/Calc';
export function hspSOAdd(a:number, b:number) {
return testNapi.add(a, b);
}
export function otherHarAdd(a:number, b:number, tag: string): number {
console.info(tag, 'otherHarAdd call')
let har: ESObject = testNapi.loadModuleWithInfo('harTwo', 'com.acts.arttsnapiloadtest/entry_test');
return har.add(a, b);
}
export function otherHarAdd2(a:number, b:number, tag: string): number {
console.info(tag, 'otherHarAdd2 call')
return testNapi.loadModule('harTwo', a, b);
}
export function otherFileHarAdd(a:number, b:number, tag: string): number {
console.info(tag, 'otherFileHarAdd call')
let harFile: ESObject = testNapi.loadModuleWithInfo('harTwo/Index', 'com.acts.arttsnapiloadtest/entry_test');
return harFile.add(a, b);
}
export function otherFileHarAdd2(a:number, b:number, tag: string): number {
console.info(tag, 'otherFileHarAdd2 call')
return testNapi.loadModule('harTwo/Index', a, b);
}
export function otherHspAdd(a:number, b:number, tag: string): number {
console.info(tag, 'otherHspAdd call')
let hsp: ESObject = testNapi.loadModuleWithInfo('hspTwo', 'com.acts.arttsnapiloadtest/entry_test');
return hsp.add(a, b);
}
export function otherHspAdd2(a:number, b:number, tag: string): number {
console.info(tag, 'otherHspAdd2 call')
return testNapi.loadModule('hspTwo', a, b);
}
export function otherHspFileAdd(a:number, b:number, tag: string): number {
console.info(tag, 'otherHspFileAdd call')
let hspFile: ESObject = testNapi.loadModuleWithInfo('hspTwo/Test', 'com.acts.arttsnapiloadtest/entry_test');
return hspFile.add(a, b);
}
export function otherHspFileAdd2(a:number, b:number, tag: string): number {
console.info(tag, 'otherHspFileAdd2 call')
return testNapi.loadModule('hspTwo/Test', a, b);
}
export function loadSystemModule(tag: string): boolean {
console.info(tag, 'otherHspFileAdd call')
let testHilog: ESObject = testNapi.loadModuleWithInfo('@ohos.hilog', '');
try {
testHilog.info(0x0000, 'SystemModule', tag + ' hilog print success');
return true;
} catch (err) {
return false;
}
}
export function loadSystemModule2(tag: string): boolean {
console.info(tag, 'otherHspFileAdd call')
try {
return testNapi.loadModuleWithLog(0x0000, 'SystemModule', tag + ' hilog print success');
} catch (err) {
return false;
}
}