• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 otherHarAdd2(a:number, b:number, tag: string): number {
32  console.info(tag, 'otherHarAdd2 call')
33  return testNapi.loadModule('harTwo', a, b);
34}
35
36export function otherFileHarAdd(a:number, b:number, tag: string): number {
37  console.info(tag, 'otherFileHarAdd call')
38  let harFile: ESObject = testNapi.loadModuleWithInfo('harTwo/Index', 'com.acts.arttsnapiloadtest/entry_test');
39  return harFile.add(a, b);
40}
41
42export function otherFileHarAdd2(a:number, b:number, tag: string): number {
43  console.info(tag, 'otherFileHarAdd2 call')
44  return testNapi.loadModule('harTwo/Index', a, b);
45}
46
47export function otherHspAdd(a:number, b:number, tag: string): number {
48  console.info(tag, 'otherHspAdd call')
49  let hsp: ESObject = testNapi.loadModuleWithInfo('hspTwo', 'com.acts.arttsnapiloadtest/entry_test');
50  return hsp.add(a, b);
51}
52
53export function otherHspAdd2(a:number, b:number, tag: string): number {
54  console.info(tag, 'otherHspAdd2 call')
55  return testNapi.loadModule('hspTwo', a, b);
56}
57
58export function otherHspFileAdd(a:number, b:number, tag: string): number {
59  console.info(tag, 'otherHspFileAdd call')
60  let hspFile: ESObject = testNapi.loadModuleWithInfo('hspTwo/Test', 'com.acts.arttsnapiloadtest/entry_test');
61  return hspFile.add(a, b);
62}
63
64export function otherHspFileAdd2(a:number, b:number, tag: string): number {
65  console.info(tag, 'otherHspFileAdd2 call')
66  return testNapi.loadModule('hspTwo/Test', a, b);
67}
68
69export function loadSystemModule(tag: string): boolean {
70  console.info(tag, 'otherHspFileAdd call')
71  let testHilog: ESObject = testNapi.loadModuleWithInfo('@ohos.hilog', '');
72  try {
73    testHilog.info(0x0000, 'SystemModule', tag + ' hilog print success');
74    return true;
75  } catch (err) {
76    return false;
77  }
78}
79
80export function loadSystemModule2(tag: string): boolean {
81  console.info(tag, 'otherHspFileAdd call')
82  try {
83    return testNapi.loadModuleWithLog(0x0000, 'SystemModule', tag + ' hilog print success');
84  } catch (err) {
85    return false;
86  }
87}