1 /*
2 * Copyright (c) 2025 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 #include "embeddedComponent_option.h"
17
18 #include "node_model.h"
19
20 #include "base/error/error_code.h"
21 #include "base/utils/utils.h"
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
OH_ArkUI_EmbeddedComponentOption_Create()27 ArkUI_EmbeddedComponentOption* OH_ArkUI_EmbeddedComponentOption_Create()
28 {
29 ArkUI_EmbeddedComponentOption* option =
30 new ArkUI_EmbeddedComponentOption { nullptr, nullptr };
31 return option;
32 }
33
OH_ArkUI_EmbeddedComponentOption_Dispose(ArkUI_EmbeddedComponentOption * option)34 void OH_ArkUI_EmbeddedComponentOption_Dispose(ArkUI_EmbeddedComponentOption* option)
35 {
36 delete option;
37 }
38
OH_ArkUI_EmbeddedComponentOption_SetOnError(ArkUI_EmbeddedComponentOption * option,void (* callback)(int32_t code,const char * name,const char * message))39 void OH_ArkUI_EmbeddedComponentOption_SetOnError(
40 ArkUI_EmbeddedComponentOption* option, void (*callback)(int32_t code, const char* name, const char* message))
41 {
42 CHECK_NULL_VOID(option);
43 CHECK_NULL_VOID(callback);
44 option->onError = reinterpret_cast<void*>(callback);
45 }
46
OH_ArkUI_EmbeddedComponentOption_SetOnTerminated(ArkUI_EmbeddedComponentOption * option,void (* callback)(int32_t code,AbilityBase_Want * want))47 void OH_ArkUI_EmbeddedComponentOption_SetOnTerminated(
48 ArkUI_EmbeddedComponentOption* option, void (*callback)(int32_t code, AbilityBase_Want* want))
49 {
50 CHECK_NULL_VOID(option);
51 CHECK_NULL_VOID(callback);
52 option->onTerminated = reinterpret_cast<void*>(callback);
53 }
54
55 #ifdef __cplusplus
56 };
57 #endif
58