1 /*
2  * Copyright (c) 2020-2021 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 #ifndef OHOS_ACELITE_OHOS_MODULE_CONFIG_H
17 #define OHOS_ACELITE_OHOS_MODULE_CONFIG_H
18 
19 #include "acelite_config.h"
20 #include "jsi_types.h"
21 
22 namespace OHOS {
23 namespace ACELite {
24 #if (ENABLE_MODULE_REQUIRE_TEST == 1)
25 extern void InitSampleModule(JSIValue exports);
26 #endif
27 extern void InitRouterModule(JSIValue exports);
28 extern void InitAppModule(JSIValue exports);
29 #if (FEATURE_SUPPORT_HTTP == 1)
30 extern void InitFetchModule(JSIValue exports);
31 #endif // FEATURE_SUPPORT_HTTP
32 #if (FEATURE_MODULE_AUDIO == 1)
33 extern void InitAudioModule(JSIValue exports);
34 #endif // FEATURE_MODULE_AUDIO
35 #if (FEATURE_ACELITE_DFX_MODULE == 1)
36 extern void InitDfxModule(JSIValue exports);
37 #endif // FEATURE_ACELITE_DFX_MODULE
38 #if (ENABLE_MODULE_CIPHER == 1)
39 extern void InitCipherModule(JSIValue exports);
40 #endif
41 #if (FEATURE_MODULE_DIALOG == 1)
42 extern void InitDialogModule(JSIValue exports);
43 #endif // FEATURE_MODULE_DIALOG
44 
45 #if (FEATURE_MODULE_STORAGE == 1)
46 extern void InitNativeApiFs(JSIValue exports);
47 extern void InitNativeApiKv(JSIValue exports);
48 #endif
49 
50 #if (FEATURE_MODULE_DEVICE == 1)
51 extern void InitDeviceModule(JSIValue exports);
52 extern void InitDeviceInfoModule(JSIValue exports);
53 #endif
54 
55 #if (FEATURE_MODULE_GEO == 1)
56 extern void InitLocationModule(JSIValue exports);
57 #endif
58 
59 #if (FEATURE_MODULE_SENSOR == 1)
60 extern void InitVibratorModule(JSIValue exports);
61 extern void InitSensorModule(JSIValue exports);
62 #endif
63 
64 #if (FEATURE_MODULE_BRIGHTNESS == 1)
65 extern void InitBrightnessModule(JSIValue exports);
66 #endif
67 
68 #if (FEATURE_MODULE_BATTERY == 1)
69 extern void InitBatteryModule(JSIValue exports);
70 #endif
71 
72 #if (FEATURE_MODULE_CONFIGURATION == 1)
73 extern void InitLocaleModule(JSIValue exports);
74 #endif
75 
76 #if (FEATURE_ACELITE_SYSTEM_CAPABILITY == 1)
77 extern void InitCapabilityModule(JSIValue exports);
78 #endif
79 
80 #if (ENABLE_MODULE_DM_LITE == 1)
81 extern void InitDeviceManagerModule(JSIValue exports);
82 #endif
83 
84 #if (FEATURE_MODULE_OHOS_HILOG == 1)
85 extern void InitHilogModule(JSIValue exports);
86 #endif
87 
88 #if (FEATURE_COMPONENT_DEVICE_ATTEST == 1)
89 extern void InitDeviceAttestModule(JSIValue exports);
90 #endif
91 
92 #if (FEATURE_ACELITE_HUKS == 1)
93 extern void InitHuksModule(JSIValue exports);
94 #endif
95 
96 // Config information for built-in JS modules of OHOS platform
97 const Module OHOS_MODULES[] = {
98 #if (ENABLE_MODULE_REQUIRE_TEST == 1)
99     {"sample", InitSampleModule},
100 #endif
101     {"app", InitAppModule},
102 #if (FEATURE_SUPPORT_HTTP == 1)
103     {"fetch", InitFetchModule},
104 #endif // FEATURE_SUPPORT_HTTP
105 #if (FEATURE_MODULE_AUDIO == 1)
106     {"audio", InitAudioModule},
107 #endif // FEATURE_MODULE_AUDIO
108 #if (FEATURE_ACELITE_DFX_MODULE == 1)
109     {"dfx", InitDfxModule},
110 #endif // FEATURE_ACELITE_DFX_MODULE
111     {"router", InitRouterModule},
112 #if (ENABLE_MODULE_CIPHER == 1)
113     {"cipher", InitCipherModule},
114 #endif
115 #if (FEATURE_MODULE_DIALOG == 1)
116     {"prompt", InitDialogModule},
117 #endif // FEATURE_MODULE_DIALOG
118 
119 #if (FEATURE_MODULE_STORAGE == 1)
120     {"file", InitNativeApiFs},
121     {"storage", InitNativeApiKv},
122 #endif
123 #if (FEATURE_MODULE_DEVICE == 1)
124     {"device", InitDeviceModule},
125     {"deviceInfo", InitDeviceInfoModule},
126 #endif
127 #if (FEATURE_MODULE_GEO == 1)
128     {"geolocation", InitLocationModule},
129 #endif
130 #if (FEATURE_MODULE_SENSOR == 1)
131     {"vibrator", InitVibratorModule},
132     {"sensor", InitSensorModule},
133 #endif
134 #if (FEATURE_MODULE_BRIGHTNESS == 1)
135     {"brightness", InitBrightnessModule},
136 #endif
137 #if (FEATURE_MODULE_BATTERY == 1)
138     {"battery", InitBatteryModule},
139 #endif
140 #if (FEATURE_MODULE_CONFIGURATION == 1)
141     {"configuration", InitLocaleModule},
142 #endif
143 #if (FEATURE_ACELITE_SYSTEM_CAPABILITY == 1)
144     {"capability", InitCapabilityModule},
145 #endif
146 #if (ENABLE_MODULE_DM_LITE == 1)
147     {"devicemanager", InitDeviceManagerModule},
148 #endif
149 #if (FEATURE_MODULE_OHOS_HILOG == 1)
150     {"hilog", InitHilogModule},
151 #endif
152 #if (FEATURE_COMPONENT_DEVICE_ATTEST == 1)
153     {"deviceAttest", InitDeviceAttestModule},
154 #endif
155 #if (FEATURE_ACELITE_HUKS == 1)
156     {"security.huks", InitHuksModule},
157 #endif
158 };
159 } // namespace ACELite
160 } // namespace OHOS
161 
162 #endif // OHOS_ACELITE_OHOS_MODULE_CONFIG_H
163