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