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 #include "napi/native_api.h"
16 #include "udmf.h"
17 #include "udmf_err_code.h"
18 #include <bits/alltypes.h>
19 #include <iostream>
20 #include <string>
21 #include "udmf_meta.h"
22 #include "uds.h"
23 #include "utd.h"
24
25 #define PARAM_0 0
26 #define PARAM_1 1
27
28 // 1. PlainText=================================================
OH_UdsPlainText_Create_0100(napi_env env,napi_callback_info info)29 static napi_value OH_UdsPlainText_Create_0100(napi_env env, napi_callback_info info)
30 {
31 OH_UdsPlainText* plainText = nullptr;
32 plainText = OH_UdsPlainText_Create();
33
34 napi_value result = nullptr;
35 napi_create_int32(env, plainText != nullptr, &result);
36
37 OH_UdsPlainText_Destroy(plainText);
38 return result;
39 }
40
OH_UdsPlainText_Destroy_0100(napi_env env,napi_callback_info info)41 static napi_value OH_UdsPlainText_Destroy_0100(napi_env env, napi_callback_info info)
42 {
43 OH_UdsPlainText* plainText = nullptr;
44 plainText = OH_UdsPlainText_Create();
45 OH_UdsPlainText_Destroy(plainText);
46
47 napi_value result = nullptr;
48 napi_create_int32(env, plainText != nullptr, &result);
49 return result;
50 }
51
OH_UdsPlainText_GetType_0100(napi_env env,napi_callback_info info)52 static napi_value OH_UdsPlainText_GetType_0100(napi_env env, napi_callback_info info)
53 {
54 OH_UdsPlainText* plainText = nullptr;
55 plainText = OH_UdsPlainText_Create();
56 const char *pt = OH_UdsPlainText_GetType(plainText);
57
58 napi_value result = nullptr;
59 napi_create_int32(env, strcmp(pt, UDMF_META_PLAIN_TEXT) == PARAM_0, &result);
60
61 OH_UdsPlainText_Destroy(plainText);
62 return result;
63 }
64
OH_UdsPlainText_SetContent_001(napi_env env,napi_callback_info info)65 static napi_value OH_UdsPlainText_SetContent_001(napi_env env, napi_callback_info info)
66 {
67 OH_UdsPlainText* plainText = nullptr;
68 plainText = OH_UdsPlainText_Create();
69 int ret = OH_UdsPlainText_SetContent(plainText, "doing something");
70
71 napi_value result = nullptr;
72 napi_create_int32(env, ret == UDMF_E_OK, &result);
73 OH_UdsPlainText_Destroy(plainText);
74 return result;
75 }
76
OH_UdsPlainText_GetContent_001(napi_env env,napi_callback_info info)77 static napi_value OH_UdsPlainText_GetContent_001(napi_env env, napi_callback_info info)
78 {
79 OH_UdsPlainText* plainText = nullptr;
80 plainText = OH_UdsPlainText_Create();
81 OH_UdsPlainText_SetContent(plainText, "doing something");
82 const char *pContent = OH_UdsPlainText_GetContent(plainText);
83
84 napi_value result = nullptr;
85 napi_create_int32(env, strcmp(pContent, "doing something") == PARAM_0, &result);
86 OH_UdsPlainText_Destroy(plainText);
87 return result;
88 }
89
OH_UdsPlainText_SetAbstract_001(napi_env env,napi_callback_info info)90 static napi_value OH_UdsPlainText_SetAbstract_001(napi_env env, napi_callback_info info)
91 {
92 OH_UdsPlainText* plainText = nullptr;
93 plainText = OH_UdsPlainText_Create();
94 int ret = OH_UdsPlainText_SetAbstract(plainText, "doing something");
95
96 napi_value result = nullptr;
97 napi_create_int32(env, ret == UDMF_E_OK, &result);
98 OH_UdsPlainText_Destroy(plainText);
99 return result;
100 }
101
OH_UdsPlainText_GetAbstract_001(napi_env env,napi_callback_info info)102 static napi_value OH_UdsPlainText_GetAbstract_001(napi_env env, napi_callback_info info)
103 {
104 OH_UdsPlainText* plainText = nullptr;
105 plainText = OH_UdsPlainText_Create();
106 OH_UdsPlainText_SetAbstract(plainText, "doing something");
107
108 const char *pt = OH_UdsPlainText_GetAbstract(plainText);
109
110 napi_value result = nullptr;
111 napi_create_int32(env, strcmp(pt, "doing something") == PARAM_0, &result);
112 OH_UdsPlainText_Destroy(plainText);
113 return result;
114 }
115
116 // 2. Hyperlink ========================================================
OH_UdsHyperlink_Create_001(napi_env env,napi_callback_info info)117 static napi_value OH_UdsHyperlink_Create_001(napi_env env, napi_callback_info info)
118 {
119 OH_UdsHyperlink* pHyperlink = nullptr;
120 pHyperlink = OH_UdsHyperlink_Create();
121
122 napi_value result = nullptr;
123 napi_create_int32(env, pHyperlink != nullptr, &result);
124 OH_UdsHyperlink_Destroy(pHyperlink);
125 return result;
126 }
127
OH_UdsHyperlink_Destroy_001(napi_env env,napi_callback_info info)128 static napi_value OH_UdsHyperlink_Destroy_001(napi_env env, napi_callback_info info)
129 {
130 OH_UdsHyperlink* pHyperlink = nullptr;
131 pHyperlink = OH_UdsHyperlink_Create();
132 OH_UdsHyperlink_Destroy(pHyperlink);
133
134 napi_value result = nullptr;
135 napi_create_int32(env, pHyperlink != nullptr, &result);
136
137 return result;
138 }
OH_UdsHyperlink_GetType_001(napi_env env,napi_callback_info info)139 static napi_value OH_UdsHyperlink_GetType_001(napi_env env, napi_callback_info info)
140 {
141 OH_UdsHyperlink* pHyperlink = nullptr;
142 pHyperlink = OH_UdsHyperlink_Create();
143 const char *pt = OH_UdsHyperlink_GetType(pHyperlink);
144
145 napi_value result = nullptr;
146 napi_create_int32(env, strcmp(pt, UDMF_META_HYPERLINK) == PARAM_0, &result);
147 OH_UdsHyperlink_Destroy(pHyperlink);
148 return result;
149 }
150
OH_UdsHyperlink_SetUrl_001(napi_env env,napi_callback_info info)151 static napi_value OH_UdsHyperlink_SetUrl_001(napi_env env, napi_callback_info info)
152 {
153 OH_UdsHyperlink* pHyperlink = nullptr;
154 pHyperlink = OH_UdsHyperlink_Create();
155 int ret = OH_UdsHyperlink_SetUrl(pHyperlink, "www.xxx.com");
156
157 napi_value result = nullptr;
158 napi_create_int32(env, ret == UDMF_E_OK, &result);
159 OH_UdsHyperlink_Destroy(pHyperlink);
160 return result;
161 }
162
OH_UdsHyperlink_GetUrl_001(napi_env env,napi_callback_info info)163 static napi_value OH_UdsHyperlink_GetUrl_001(napi_env env, napi_callback_info info)
164 {
165 OH_UdsHyperlink* pHyperlink = nullptr;
166 pHyperlink = OH_UdsHyperlink_Create();
167 OH_UdsHyperlink_SetUrl(pHyperlink, "www.xxx.com");
168 const char *ph = OH_UdsHyperlink_GetUrl(pHyperlink);
169
170 napi_value result = nullptr;
171 napi_create_int32(env, strcmp(ph, "www.xxx.com") == PARAM_0, &result);
172 OH_UdsHyperlink_Destroy(pHyperlink);
173 return result;
174 }
175
OH_UdsHyperlink_SetDescription_001(napi_env env,napi_callback_info info)176 static napi_value OH_UdsHyperlink_SetDescription_001(napi_env env, napi_callback_info info)
177 {
178 OH_UdsHyperlink* pHyperlink = nullptr;
179 pHyperlink = OH_UdsHyperlink_Create();
180 int ret = OH_UdsHyperlink_SetDescription(pHyperlink, "doing something");
181
182 napi_value result = nullptr;
183 napi_create_int32(env, ret == UDMF_E_OK, &result);
184 OH_UdsHyperlink_Destroy(pHyperlink);
185 return result;
186 }
187
OH_UdsHyperlink_GetDescription_001(napi_env env,napi_callback_info info)188 static napi_value OH_UdsHyperlink_GetDescription_001(napi_env env, napi_callback_info info)
189 {
190 OH_UdsHyperlink* pHyperlink = nullptr;
191 pHyperlink = OH_UdsHyperlink_Create();
192 OH_UdsHyperlink_SetDescription(pHyperlink, "doing something");
193 const char *ph = OH_UdsHyperlink_GetDescription(pHyperlink);
194
195 napi_value result = nullptr;
196 napi_create_int32(env, strcmp(ph, "doing something") == PARAM_0, &result);
197 OH_UdsHyperlink_Destroy(pHyperlink);
198 return result;
199 }
200
201 // 3.html ========================================================
OH_UdsHtml_Create_001(napi_env env,napi_callback_info info)202 static napi_value OH_UdsHtml_Create_001(napi_env env, napi_callback_info info)
203 {
204 OH_UdsHtml* html = nullptr;
205 html = OH_UdsHtml_Create();
206
207 napi_value result = nullptr;
208 napi_create_int32(env, html != nullptr, &result);
209 OH_UdsHtml_Destroy(html);
210 return result;
211 }
212
OH_UdsHtml_Destroy_001(napi_env env,napi_callback_info info)213 static napi_value OH_UdsHtml_Destroy_001(napi_env env, napi_callback_info info)
214 {
215 OH_UdsHtml* html = nullptr;
216 html = OH_UdsHtml_Create();
217 OH_UdsHtml_Destroy(html);
218
219 napi_value result = nullptr;
220 napi_create_int32(env, html != nullptr, &result);
221
222 return result;
223 }
224
OH_UdsHtml_GetType_001(napi_env env,napi_callback_info info)225 static napi_value OH_UdsHtml_GetType_001(napi_env env, napi_callback_info info)
226 {
227 OH_UdsHtml* html = nullptr;
228 html = OH_UdsHtml_Create();
229 const char *pt = OH_UdsHtml_GetType(html);
230
231 napi_value result = nullptr;
232 napi_create_int32(env, strcmp(pt, UDMF_META_HTML) == PARAM_0, &result);
233 OH_UdsHtml_Destroy(html);
234 return result;
235 }
236
OH_UdsHtml_SetContent_001(napi_env env,napi_callback_info info)237 static napi_value OH_UdsHtml_SetContent_001(napi_env env, napi_callback_info info)
238 {
239 OH_UdsHtml* html = nullptr;
240 html = OH_UdsHtml_Create();
241 int ret = OH_UdsHtml_SetContent(html, "htmlxxx");
242 napi_value result = nullptr;
243 napi_create_int32(env, ret == UDMF_E_OK, &result);
244 OH_UdsHtml_Destroy(html);
245 return result;
246 }
247
OH_UdsHtml_GetContent_001(napi_env env,napi_callback_info info)248 static napi_value OH_UdsHtml_GetContent_001(napi_env env, napi_callback_info info)
249 {
250 OH_UdsHtml* html = nullptr;
251 html = OH_UdsHtml_Create();
252 OH_UdsHtml_SetContent(html, "htmlxxx");
253 const char *pt = OH_UdsHtml_GetContent(html);
254
255 napi_value result = nullptr;
256 napi_create_int32(env, strcmp(pt, "htmlxxx") == PARAM_0, &result);
257 OH_UdsHtml_Destroy(html);
258 return result;
259 }
260
OH_UdsHtml_SetPlainContent_001(napi_env env,napi_callback_info info)261 static napi_value OH_UdsHtml_SetPlainContent_001(napi_env env, napi_callback_info info)
262 {
263 OH_UdsHtml* html = nullptr;
264 html = OH_UdsHtml_Create();
265 int ret = OH_UdsHtml_SetPlainContent(html, "doing something");
266
267 napi_value result = nullptr;
268 napi_create_int32(env, ret == UDMF_E_OK, &result);
269 OH_UdsHtml_Destroy(html);
270 return result;
271 }
272
OH_UdsHtml_GetPlainContent_001(napi_env env,napi_callback_info info)273 static napi_value OH_UdsHtml_GetPlainContent_001(napi_env env, napi_callback_info info)
274 {
275 OH_UdsHtml* html = nullptr;
276 html = OH_UdsHtml_Create();
277 OH_UdsHtml_SetPlainContent(html, "doing something");
278 const char *pt = OH_UdsHtml_GetPlainContent(html);
279
280 napi_value result = nullptr;
281 napi_create_int32(env, strcmp(pt, "doing something") == PARAM_0, &result);
282 OH_UdsHtml_Destroy(html);
283 return result;
284 }
285
286 // 4. AppItem ========================================================
OH_UdsAppItem_Create_001(napi_env env,napi_callback_info info)287 static napi_value OH_UdsAppItem_Create_001(napi_env env, napi_callback_info info)
288 {
289 OH_UdsAppItem* appItem = nullptr;
290 appItem = OH_UdsAppItem_Create();
291
292 napi_value result = nullptr;
293 napi_create_int32(env, appItem != nullptr, &result);
294 OH_UdsAppItem_Destroy(appItem);
295 return result;
296 }
297
OH_UdsAppItem_Destroy_001(napi_env env,napi_callback_info info)298 static napi_value OH_UdsAppItem_Destroy_001(napi_env env, napi_callback_info info)
299 {
300 OH_UdsAppItem* appItem = nullptr;
301 appItem = OH_UdsAppItem_Create();
302 OH_UdsAppItem_Destroy(appItem);
303 napi_value result = nullptr;
304 napi_create_int32(env, appItem != nullptr, &result);
305 return result;
306 }
307
OH_UdsAppItem_GetType_001(napi_env env,napi_callback_info info)308 static napi_value OH_UdsAppItem_GetType_001(napi_env env, napi_callback_info info)
309 {
310 OH_UdsAppItem* appItem = nullptr;
311 appItem = OH_UdsAppItem_Create();
312 const char *pt = OH_UdsAppItem_GetType(appItem);
313
314 napi_value result = nullptr;
315 napi_create_int32(env, strcmp(pt, UDMF_META_OPENHARMONY_APP_ITEM) == PARAM_0, &result);
316 OH_UdsAppItem_Destroy(appItem);
317 return result;
318 }
319
OH_UdsAppItem_SetId_001(napi_env env,napi_callback_info info)320 static napi_value OH_UdsAppItem_SetId_001(napi_env env, napi_callback_info info)
321 {
322 OH_UdsAppItem* appItem = nullptr;
323 appItem = OH_UdsAppItem_Create();
324 int ret = OH_UdsAppItem_SetId(appItem, "com.xxx");
325
326 napi_value result = nullptr;
327 napi_create_int32(env, ret == UDMF_E_OK, &result);
328 OH_UdsAppItem_Destroy(appItem);
329 return result;
330 }
331
OH_UdsAppItem_GetId_001(napi_env env,napi_callback_info info)332 static napi_value OH_UdsAppItem_GetId_001(napi_env env, napi_callback_info info)
333 {
334 OH_UdsAppItem* appItem = nullptr;
335 appItem = OH_UdsAppItem_Create();
336 OH_UdsAppItem_SetId(appItem, "com.xxx");
337 const char *pu = OH_UdsAppItem_GetId(appItem);
338
339 napi_value result = nullptr;
340 napi_create_int32(env, strcmp(pu, "com.xxx") == PARAM_0, &result);
341 OH_UdsAppItem_Destroy(appItem);
342 return result;
343 }
344
OH_UdsAppItem_SetName_001(napi_env env,napi_callback_info info)345 static napi_value OH_UdsAppItem_SetName_001(napi_env env, napi_callback_info info)
346 {
347 OH_UdsAppItem* appItem = nullptr;
348 appItem = OH_UdsAppItem_Create();
349 int ret = OH_UdsAppItem_SetName(appItem, "OH");
350
351 napi_value result = nullptr;
352 napi_create_int32(env, ret == UDMF_E_OK, &result);
353 OH_UdsAppItem_Destroy(appItem);
354 return result;
355 }
356
OH_UdsAppItem_GetName_001(napi_env env,napi_callback_info info)357 static napi_value OH_UdsAppItem_GetName_001(napi_env env, napi_callback_info info)
358 {
359 OH_UdsAppItem* appItem = nullptr;
360 appItem = OH_UdsAppItem_Create();
361 OH_UdsAppItem_SetName(appItem, "OH");
362 const char *pu = OH_UdsAppItem_GetName(appItem);
363
364 napi_value result = nullptr;
365 napi_create_int32(env, strcmp(pu, "OH") == PARAM_0, &result);
366 OH_UdsAppItem_Destroy(appItem);
367 return result;
368 }
369
OH_UdsAppItem_SetIconId_001(napi_env env,napi_callback_info info)370 static napi_value OH_UdsAppItem_SetIconId_001(napi_env env, napi_callback_info info)
371 {
372 OH_UdsAppItem* appItem = nullptr;
373 appItem = OH_UdsAppItem_Create();
374 int ret = OH_UdsAppItem_SetIconId(appItem, "icon");
375
376 napi_value result = nullptr;
377 napi_create_int32(env, ret == UDMF_E_OK, &result);
378 OH_UdsAppItem_Destroy(appItem);
379 return result;
380 }
381
382
OH_UdsAppItem_GetIconId_001(napi_env env,napi_callback_info info)383 static napi_value OH_UdsAppItem_GetIconId_001(napi_env env, napi_callback_info info)
384 {
385 OH_UdsAppItem* appItem = nullptr;
386 appItem = OH_UdsAppItem_Create();
387 OH_UdsAppItem_SetIconId(appItem, "icon");
388 const char *pu = OH_UdsAppItem_GetIconId(appItem);
389
390 napi_value result = nullptr;
391 napi_create_int32(env, strcmp(pu, "icon") == PARAM_0, &result);
392 OH_UdsAppItem_Destroy(appItem);
393 return result;
394 }
395
OH_UdsAppItem_SetLabelId_001(napi_env env,napi_callback_info info)396 static napi_value OH_UdsAppItem_SetLabelId_001(napi_env env, napi_callback_info info)
397 {
398 OH_UdsAppItem* appItem = nullptr;
399 appItem = OH_UdsAppItem_Create();
400 int ret = OH_UdsAppItem_SetLabelId(appItem, "label");
401
402 napi_value result = nullptr;
403 napi_create_int32(env, ret == UDMF_E_OK, &result);
404 OH_UdsAppItem_Destroy(appItem);
405 return result;
406 }
407
408
OH_UdsAppItem_GetLabelId_001(napi_env env,napi_callback_info info)409 static napi_value OH_UdsAppItem_GetLabelId_001(napi_env env, napi_callback_info info)
410 {
411 OH_UdsAppItem* appItem = nullptr;
412 appItem = OH_UdsAppItem_Create();
413 OH_UdsAppItem_SetLabelId(appItem, "label");
414 const char *pu = OH_UdsAppItem_GetLabelId(appItem);
415
416 napi_value result = nullptr;
417 napi_create_int32(env, strcmp(pu, "label") == PARAM_0, &result);
418 OH_UdsAppItem_Destroy(appItem);
419 return result;
420 }
421
422
OH_UdsAppItem_SetBundleName_001(napi_env env,napi_callback_info info)423 static napi_value OH_UdsAppItem_SetBundleName_001(napi_env env, napi_callback_info info)
424 {
425 OH_UdsAppItem* appItem = nullptr;
426 appItem = OH_UdsAppItem_Create();
427 int ret = OH_UdsAppItem_SetBundleName(appItem, "bundle");
428
429 napi_value result = nullptr;
430 napi_create_int32(env, ret == UDMF_E_OK, &result);
431 OH_UdsAppItem_Destroy(appItem);
432 return result;
433 }
434
435
OH_UdsAppItem_GetBundleName_001(napi_env env,napi_callback_info info)436 static napi_value OH_UdsAppItem_GetBundleName_001(napi_env env, napi_callback_info info)
437 {
438 OH_UdsAppItem* appItem = nullptr;
439 appItem = OH_UdsAppItem_Create();
440 OH_UdsAppItem_SetBundleName(appItem, "bundle");
441 const char *pu = OH_UdsAppItem_GetBundleName(appItem);
442
443 napi_value result = nullptr;
444 napi_create_int32(env, strcmp(pu, "bundle") == PARAM_0, &result);
445 OH_UdsAppItem_Destroy(appItem);
446 return result;
447 }
448
OH_UdsAppItem_SetAbilityName_001(napi_env env,napi_callback_info info)449 static napi_value OH_UdsAppItem_SetAbilityName_001(napi_env env, napi_callback_info info)
450 {
451 OH_UdsAppItem* appItem = nullptr;
452 appItem = OH_UdsAppItem_Create();
453 int ret = OH_UdsAppItem_SetAbilityName(appItem, "ability");
454
455 napi_value result = nullptr;
456 napi_create_int32(env, ret == UDMF_E_OK, &result);
457 OH_UdsAppItem_Destroy(appItem);
458 return result;
459 }
460
OH_UdsAppItem_GetAbilityName_001(napi_env env,napi_callback_info info)461 static napi_value OH_UdsAppItem_GetAbilityName_001(napi_env env, napi_callback_info info)
462 {
463 OH_UdsAppItem* appItem = nullptr;
464 appItem = OH_UdsAppItem_Create();
465 OH_UdsAppItem_SetAbilityName(appItem, "ability");
466 const char *pu = OH_UdsAppItem_GetAbilityName(appItem);
467
468 napi_value result = nullptr;
469 napi_create_int32(env, strcmp(pu, "ability") == PARAM_0, &result);
470 OH_UdsAppItem_Destroy(appItem);
471 return result;
472 }
473
Init(napi_env env,napi_value exports)474 EXTERN_C_START static napi_value Init(napi_env env, napi_value exports)
475 {
476 napi_property_descriptor desc[] = {
477 {"OH_UdsPlainText_Create_0100", nullptr, OH_UdsPlainText_Create_0100, nullptr, nullptr, nullptr, napi_default, nullptr},
478 {"OH_UdsPlainText_Destroy_0100", nullptr, OH_UdsPlainText_Destroy_0100, nullptr, nullptr, nullptr, napi_default, nullptr},
479 {"OH_UdsPlainText_GetType_0100", nullptr, OH_UdsPlainText_GetType_0100, nullptr, nullptr, nullptr, napi_default, nullptr},
480 {"OH_UdsPlainText_SetContent_001", nullptr, OH_UdsPlainText_SetContent_001, nullptr, nullptr, nullptr, napi_default, nullptr},
481 {"OH_UdsPlainText_GetContent_001", nullptr, OH_UdsPlainText_GetContent_001, nullptr, nullptr, nullptr, napi_default, nullptr},
482 {"OH_UdsPlainText_SetAbstract_001", nullptr, OH_UdsPlainText_SetAbstract_001, nullptr, nullptr, nullptr, napi_default, nullptr},
483 {"OH_UdsPlainText_GetAbstract_001", nullptr, OH_UdsPlainText_GetAbstract_001, nullptr, nullptr, nullptr, napi_default, nullptr},
484 {"OH_UdsHyperlink_Create_001", nullptr, OH_UdsHyperlink_Create_001, nullptr, nullptr, nullptr, napi_default, nullptr},
485 {"OH_UdsHyperlink_Destroy_001", nullptr, OH_UdsHyperlink_Destroy_001, nullptr, nullptr, nullptr, napi_default, nullptr},
486 {"OH_UdsHyperlink_GetType_001", nullptr, OH_UdsHyperlink_GetType_001, nullptr, nullptr, nullptr, napi_default, nullptr},
487 {"OH_UdsHyperlink_SetUrl_001", nullptr, OH_UdsHyperlink_SetUrl_001, nullptr, nullptr, nullptr, napi_default, nullptr},
488 {"OH_UdsHyperlink_GetUrl_001", nullptr, OH_UdsHyperlink_GetUrl_001, nullptr, nullptr, nullptr, napi_default, nullptr},
489 {"OH_UdsHyperlink_SetDescription_001", nullptr, OH_UdsHyperlink_SetDescription_001, nullptr, nullptr, nullptr, napi_default, nullptr},
490 {"OH_UdsHyperlink_GetDescription_001", nullptr, OH_UdsHyperlink_GetDescription_001, nullptr, nullptr, nullptr, napi_default, nullptr},
491 {"OH_UdsHtml_Create_001", nullptr, OH_UdsHtml_Create_001, nullptr, nullptr, nullptr, napi_default, nullptr},
492 {"OH_UdsHtml_Destroy_001", nullptr, OH_UdsHtml_Destroy_001, nullptr, nullptr, nullptr, napi_default, nullptr},
493 {"OH_UdsHtml_GetType_001", nullptr, OH_UdsHtml_GetType_001, nullptr, nullptr, nullptr, napi_default, nullptr},
494 {"OH_UdsHtml_SetContent_001", nullptr, OH_UdsHtml_SetContent_001, nullptr, nullptr, nullptr, napi_default, nullptr},
495 {"OH_UdsHtml_GetContent_001", nullptr, OH_UdsHtml_GetContent_001, nullptr, nullptr, nullptr, napi_default, nullptr},
496 {"OH_UdsHtml_SetPlainContent_001", nullptr, OH_UdsHtml_SetPlainContent_001, nullptr, nullptr, nullptr, napi_default, nullptr},
497 {"OH_UdsHtml_GetPlainContent_001", nullptr, OH_UdsHtml_GetPlainContent_001, nullptr, nullptr, nullptr, napi_default, nullptr},
498 {"OH_UdsAppItem_Create_001", nullptr, OH_UdsAppItem_Create_001, nullptr, nullptr, nullptr, napi_default, nullptr},
499 {"OH_UdsAppItem_Destroy_001", nullptr, OH_UdsAppItem_Destroy_001, nullptr, nullptr, nullptr, napi_default, nullptr},
500 {"OH_UdsAppItem_GetType_001", nullptr, OH_UdsAppItem_GetType_001, nullptr, nullptr, nullptr, napi_default, nullptr},
501 {"OH_UdsAppItem_SetId_001", nullptr, OH_UdsAppItem_SetId_001, nullptr, nullptr, nullptr, napi_default, nullptr},
502 {"OH_UdsAppItem_GetId_001", nullptr, OH_UdsAppItem_GetId_001, nullptr, nullptr, nullptr, napi_default, nullptr},
503 {"OH_UdsAppItem_SetName_001", nullptr, OH_UdsAppItem_SetName_001, nullptr, nullptr, nullptr, napi_default, nullptr},
504 {"OH_UdsAppItem_GetName_001", nullptr, OH_UdsAppItem_GetName_001, nullptr, nullptr, nullptr, napi_default, nullptr},
505 {"OH_UdsAppItem_SetIconId_001", nullptr, OH_UdsAppItem_SetIconId_001, nullptr, nullptr, nullptr, napi_default, nullptr},
506 {"OH_UdsAppItem_GetIconId_001", nullptr, OH_UdsAppItem_GetIconId_001, nullptr, nullptr, nullptr, napi_default, nullptr},
507 {"OH_UdsAppItem_SetLabelId_001", nullptr, OH_UdsAppItem_SetLabelId_001, nullptr, nullptr, nullptr, napi_default, nullptr},
508 {"OH_UdsAppItem_GetLabelId_001", nullptr, OH_UdsAppItem_GetLabelId_001, nullptr, nullptr, nullptr, napi_default, nullptr},
509 {"OH_UdsAppItem_SetBundleName_001", nullptr, OH_UdsAppItem_SetBundleName_001, nullptr, nullptr, nullptr, napi_default, nullptr},
510 {"OH_UdsAppItem_GetBundleName_001", nullptr, OH_UdsAppItem_GetBundleName_001, nullptr, nullptr, nullptr, napi_default, nullptr},
511 {"OH_UdsAppItem_SetAbilityName_001", nullptr, OH_UdsAppItem_SetAbilityName_001, nullptr, nullptr, nullptr, napi_default, nullptr},
512 {"OH_UdsAppItem_GetAbilityName_001", nullptr, OH_UdsAppItem_GetAbilityName_001, nullptr, nullptr, nullptr, napi_default, nullptr}
513
514 };
515 napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
516 return exports;
517 }
518 EXTERN_C_END
519
520 static napi_module demoModule = {
521 .nm_version = 1,
522 .nm_flags = 0,
523 .nm_filename = nullptr,
524 .nm_register_func = Init,
525 .nm_modname = "UdsNdk",
526 .nm_priv = ((void *)0),
527 .reserved = {0},
528 };
529
RegisterEntryModule(void)530 extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { napi_module_register(&demoModule); }
531