idlize

Форк
0
/
NativeModule_template.ets 
119 строк · 4.8 Кб
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
 
16
let theModule: NativeModule
17

18
export function nativeModule(): NativeModule {
19
    if (theModule) return theModule
20
      
21
    theModule = new NativeModule()
22
    return theModule
23
}
24

25
export class NativeModule {
26
  static {
27
    loadLibrary("NativeBridgeArk")
28
    NativeModule.init()
29
  }
30
  // TODO: shall be done in static initializer instead
31
  static native init(): void;
32

33
%GENERATED_METHODS%
34

35
  static native _StringLength(arg1: long): int;
36
  static native _StringData(arg1: long, arg2: byte[], arg3: int): void;
37
  static native _StringMake(arg1: String): long;
38
  static native _ManagedStringWrite(value: String, arg1: byte[], arg2: int): int;
39
  static native _GetStringFinalizer(): long;
40
  static native _InvokeFinalizer(arg1: long, arg2: long): void;
41
  static native _GetNodeFinalizer(): long;
42
  static native _GetPtrVectorSize(arg1: long): int;
43
  static native _GetPtrVectorElement(arg1: long, arg2: int): long;
44
  static native _GetGroupedLog(arg1: int): long;
45
  static native _StartGroupedLog(arg1: int): void;
46
  static native _StopGroupedLog(arg1: int): void;
47
  static native _TestPerfNumber(arg1: int): int;
48
  static native _TestPerfNumberWithArray(arg1: byte[], arg2: int): void;
49
  static native _Test_TextPicker_OnAccept(valueArray: byte[], valueSerializerLength: int): void;
50
  static native _StartPerf(traceName: String): void;
51
  static native _EndPerf(traceName: String): void;
52
  static native _DumpPerf(options: int): long;
53
  static native _Test_SetEventsApi(): void;
54
  static native _Test_List_OnScrollVisibleContentChange(valueArray: byte[], valueSerializerLength: int): void;
55
  static native _Test_Common_OnChildTouchTest(valueArray: byte[], valueSerializerLength: int): void;
56
  static native _GetNodeByViewStack(): long;
57

58
  // BasicNodeAPI
59
  static native _CreateNode(type: int, id: int, flags: int): long
60
  static native _DisposeNode(ptr: long): void
61
  static native _ApplyModifierFinish(ptr: long): void
62
  static native _Dump(nodePtr: long): void
63
  static native _AddChild(parent: long, child: long): int
64
  static native _RemoveChild(parent: long, child: long): void
65
  static native _InsertChildAfter(parent: long, child: long, sibling: long): int
66
  static native _InsertChildBefore(parent: long, child: long, sibling: long): int
67
  static native _InsertChildAt(parent: long, child: long, position: int): int
68
  static native _UnRegisterNodeAsyncEvent(nodePtr: long , kind: int ): void
69
  static native _RegisterNodeAsyncEventReceiver(eventReceiver: long ): void
70
  static native _UnRegisterNodeAsyncEventReceiver(): void
71
  static native _MarkDirty( nodePtr:long,  dirtyFlag:int): void
72
  static native _IsBuilderNode( nodePtr:long): boolean
73
  static native _ConvertLengthMetricsUnit(value: float, originUnit: int, targetUnit: int): float
74

75
  // ExtendedNodeAPI
76
  static native _SetCustomCallback(node: long, callbackId: int): void
77
  static native _MeasureLayoutAndDraw(root: long): void
78
  static native _MeasureNode(root: long, data: float[]): int
79
  static native _LayoutNode(root: long, data: float[]): int
80
  static native _DrawNode(root: long, data: float[]): int
81

82
  // setAttachNodePtr
83
  // getAttachNodePtr
84

85
  static native _SetMeasureWidth(root: long, value: int): void
86
  static native _GetMeasureWidth(root: long): int
87
  static native _SetMeasureHeight(root: long, value: int): void
88
  static native _GetMeasureHeight(root: long): int
89
  static native _SetX(root: long, value: int): void
90
  static native _GetX(root: long): int
91
  static native _SetY(root: long, value: int): void
92
  static native _GetY(root: long): int
93

94
  // getLayoutConstraint
95

96
  static native _SetAlignment(root: long, value: int): void
97
  static native _GetAlignment(root: long): int
98

99
  static native _IndexerChecker(node: long): int
100

101
  static native _SetRangeUpdater(node: long, updaterId: int): void
102
  static native _SetLazyItemIndexer(node: long, indexerId: int): int
103

104
  static native _SetVsyncCallback(long: long, callbackId: int): int
105
  static native _UnblockVsyncWait(long: long): int
106

107

108
  // _CheckArkoalaEvents -> checkEvent
109
  static native _CheckEvents(result: int[], count: int): int
110
  // _SendArkoalaEvent -> sedEvent
111
  static native _SendEvent(event: int[], count: int): void
112

113
  static native _SetChildTotalCount(ptr: long, value: int): void
114

115
  // _Dump
116
  static native _ShowCrash(messagePtr: String): void
117

118
  static native _GetPipelineContext(nodePtr: long): long
119
}

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.