1 /*
2 * Copyright (C) 2022 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 "constant_definition.h"
17 #include "napi_util.h"
18 #include "location_log.h"
19 #include "location_napi_adapter.h"
20 #include "location_napi_event.h"
21 #include "location_napi_system.h"
22 #include "geofence_definition.h"
23
24 namespace OHOS {
25 namespace Location {
CoordinateSystemTypeConstructor(napi_env env)26 napi_value CoordinateSystemTypeConstructor(napi_env env)
27 {
28 napi_value coordinateSystemType;
29 NAPI_CALL(env, napi_create_object(env, &coordinateSystemType));
30 SetEnumPropertyByInteger(env, coordinateSystemType, CoordinateSystemType::WGS84, "WGS84");
31 SetEnumPropertyByInteger(env, coordinateSystemType, CoordinateSystemType::GCJ02, "GCJ02");
32 return coordinateSystemType;
33 }
34
GeofenceTransitionEventConstructor(napi_env env)35 napi_value GeofenceTransitionEventConstructor(napi_env env)
36 {
37 napi_value geofenceTransitionStatus = nullptr;
38 NAPI_CALL(env, napi_create_object(env, &geofenceTransitionStatus));
39 SetEnumPropertyByInteger(env, geofenceTransitionStatus,
40 GeofenceTransitionEvent::GEOFENCE_TRANSITION_EVENT_ENTER, "GEOFENCE_TRANSITION_EVENT_ENTER");
41 SetEnumPropertyByInteger(env, geofenceTransitionStatus,
42 GeofenceTransitionEvent::GEOFENCE_TRANSITION_EVENT_EXIT, "GEOFENCE_TRANSITION_EVENT_EXIT");
43 SetEnumPropertyByInteger(env, geofenceTransitionStatus,
44 GeofenceTransitionEvent::GEOFENCE_TRANSITION_EVENT_DWELL, "GEOFENCE_TRANSITION_EVENT_DWELL");
45 return geofenceTransitionStatus;
46 }
47
SvConstellationTypeConstructor(napi_env env)48 napi_value SvConstellationTypeConstructor(napi_env env)
49 {
50 napi_value satelliteConstellationCategory = nullptr;
51 NAPI_CALL(env, napi_create_object(env, &satelliteConstellationCategory));
52 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
53 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_UNKNOWN, "CONSTELLATION_CATEGORY_UNKNOWN");
54 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
55 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_GPS, "CONSTELLATION_CATEGORY_GPS");
56 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
57 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_SBAS, "CONSTELLATION_CATEGORY_SBAS");
58 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
59 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_GLONASS, "CONSTELLATION_CATEGORY_GLONASS");
60 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
61 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_QZSS, "CONSTELLATION_CATEGORY_QZSS");
62 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
63 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_BEIDOU, "CONSTELLATION_CATEGORY_BEIDOU");
64 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
65 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_GALILEO, "CONSTELLATION_CATEGORY_GALILEO");
66 SetEnumPropertyByInteger(env, satelliteConstellationCategory,
67 SatelliteConstellation::SV_CONSTELLATION_CATEGORY_IRNSS, "CONSTELLATION_CATEGORY_IRNSS");
68 return satelliteConstellationCategory;
69 }
70
SatelliteAdditionalInfoTypeConstructor(napi_env env)71 napi_value SatelliteAdditionalInfoTypeConstructor(napi_env env)
72 {
73 napi_value satelliteAdditionalInfo = nullptr;
74 NAPI_CALL(env, napi_create_object(env, &satelliteAdditionalInfo));
75 SetEnumPropertyByInteger(env, satelliteAdditionalInfo,
76 SatelliteAdditionalInfo::SV_ADDITIONAL_INFO_NULL, "SATELLITES_ADDITIONAL_INFO_NULL");
77 SetEnumPropertyByInteger(env, satelliteAdditionalInfo,
78 SatelliteAdditionalInfo::SV_ADDITIONAL_INFO_EPHEMERIS_DATA_EXIST,
79 "SATELLITES_ADDITIONAL_INFO_EPHEMERIS_DATA_EXIST");
80 SetEnumPropertyByInteger(env, satelliteAdditionalInfo,
81 SatelliteAdditionalInfo::SV_ADDITIONAL_INFO_ALMANAC_DATA_EXIST,
82 "SATELLITES_ADDITIONAL_INFO_ALMANAC_DATA_EXIST");
83 SetEnumPropertyByInteger(env, satelliteAdditionalInfo,
84 SatelliteAdditionalInfo::SV_ADDITIONAL_INFO_USED_IN_FIX,
85 "SATELLITES_ADDITIONAL_INFO_USED_IN_FIX");
86 SetEnumPropertyByInteger(env, satelliteAdditionalInfo,
87 SatelliteAdditionalInfo::SV_ADDITIONAL_INFO_CARRIER_FREQUENCY_EXIST,
88 "SATELLITES_ADDITIONAL_INFO_CARRIER_FREQUENCY_EXIST");
89 return satelliteAdditionalInfo;
90 }
91
LocationRequestPriorityTypeConstructor(napi_env env)92 napi_value LocationRequestPriorityTypeConstructor(napi_env env)
93 {
94 napi_value locationRequestPriority = nullptr;
95 NAPI_CALL(env, napi_create_object(env, &locationRequestPriority));
96 SetEnumPropertyByInteger(env, locationRequestPriority, PRIORITY_UNSET, "UNSET");
97 SetEnumPropertyByInteger(env, locationRequestPriority, PRIORITY_ACCURACY, "ACCURACY");
98 SetEnumPropertyByInteger(env, locationRequestPriority, PRIORITY_LOW_POWER, "LOW_POWER");
99 SetEnumPropertyByInteger(env, locationRequestPriority, PRIORITY_FAST_FIRST_FIX, "FIRST_FIX");
100 return locationRequestPriority;
101 }
102
LocationRequestScenarioTypeConstructor(napi_env env)103 napi_value LocationRequestScenarioTypeConstructor(napi_env env)
104 {
105 napi_value locationRequestScenario = nullptr;
106 NAPI_CALL(env, napi_create_object(env, &locationRequestScenario));
107 SetEnumPropertyByInteger(env, locationRequestScenario, SCENE_UNSET, "UNSET");
108 SetEnumPropertyByInteger(env, locationRequestScenario, SCENE_NAVIGATION, "NAVIGATION");
109 SetEnumPropertyByInteger(env, locationRequestScenario, SCENE_TRAJECTORY_TRACKING, "TRAJECTORY_TRACKING");
110 SetEnumPropertyByInteger(env, locationRequestScenario, SCENE_CAR_HAILING, "CAR_HAILING");
111 SetEnumPropertyByInteger(env, locationRequestScenario, SCENE_DAILY_LIFE_SERVICE, "DAILY_LIFE_SERVICE");
112 SetEnumPropertyByInteger(env, locationRequestScenario, SCENE_NO_POWER, "NO_POWER");
113 return locationRequestScenario;
114 }
115
UserActivityScenarioTypeConstructor(napi_env env)116 napi_value UserActivityScenarioTypeConstructor(napi_env env)
117 {
118 napi_value userActivityScenario = nullptr;
119 NAPI_CALL(env, napi_create_object(env, &userActivityScenario));
120 SetEnumPropertyByInteger(env, userActivityScenario, LOCATION_SCENE_NAVIGATION, "NAVIGATION");
121 SetEnumPropertyByInteger(env, userActivityScenario, LOCATION_SCENE_SPORT, "SPORT");
122 SetEnumPropertyByInteger(env, userActivityScenario, LOCATION_SCENE_TRANSPORT, "TRANSPORT");
123 SetEnumPropertyByInteger(env, userActivityScenario, LOCATION_SCENE_DAILY_LIFE_SERVICE, "DAILY_LIFE_SERVICE");
124 return userActivityScenario;
125 }
126
LocatingPriorityTypeConstructor(napi_env env)127 napi_value LocatingPriorityTypeConstructor(napi_env env)
128 {
129 napi_value locatingPriority = nullptr;
130 NAPI_CALL(env, napi_create_object(env, &locatingPriority));
131 SetEnumPropertyByInteger(env, locatingPriority, LOCATION_PRIORITY_ACCURACY, "PRIORITY_ACCURACY");
132 SetEnumPropertyByInteger(env, locatingPriority, LOCATION_PRIORITY_LOCATING_SPEED, "PRIORITY_LOCATING_SPEED");
133 return locatingPriority;
134 }
135
PowerConsumptionScenarioTypeConstructor(napi_env env)136 napi_value PowerConsumptionScenarioTypeConstructor(napi_env env)
137 {
138 napi_value powerConsumptionScenario = nullptr;
139 NAPI_CALL(env, napi_create_object(env, &powerConsumptionScenario));
140 SetEnumPropertyByInteger(env, powerConsumptionScenario,
141 LOCATION_SCENE_HIGH_POWER_CONSUMPTION, "HIGH_POWER_CONSUMPTION");
142 SetEnumPropertyByInteger(env, powerConsumptionScenario,
143 LOCATION_SCENE_LOW_POWER_CONSUMPTION, "LOW_POWER_CONSUMPTION");
144 SetEnumPropertyByInteger(env, powerConsumptionScenario,
145 LOCATION_SCENE_NO_POWER_CONSUMPTION, "NO_POWER_CONSUMPTION");
146 return powerConsumptionScenario;
147 }
148
LocationPrivacyTypeConstructor(napi_env env)149 napi_value LocationPrivacyTypeConstructor(napi_env env)
150 {
151 napi_value locationPrivacyType = nullptr;
152 NAPI_CALL(env, napi_create_object(env, &locationPrivacyType));
153 SetEnumPropertyByInteger(env, locationPrivacyType, PRIVACY_TYPE_OTHERS, "OTHERS");
154 SetEnumPropertyByInteger(env, locationPrivacyType, PRIVACY_TYPE_STARTUP, "STARTUP");
155 SetEnumPropertyByInteger(env, locationPrivacyType, PRIVACY_TYPE_CORE_LOCATION, "CORE_LOCATION");
156 return locationPrivacyType;
157 }
158
CountryCodeTypeConstructor(napi_env env)159 napi_value CountryCodeTypeConstructor(napi_env env)
160 {
161 napi_value countryCodeType = nullptr;
162 NAPI_CALL(env, napi_create_object(env, &countryCodeType));
163 SetEnumPropertyByInteger(env, countryCodeType, COUNTRY_CODE_FROM_LOCALE, "COUNTRY_CODE_FROM_LOCALE");
164 SetEnumPropertyByInteger(env, countryCodeType, COUNTRY_CODE_FROM_SIM, "COUNTRY_CODE_FROM_SIM");
165 SetEnumPropertyByInteger(env, countryCodeType, COUNTRY_CODE_FROM_LOCATION, "COUNTRY_CODE_FROM_LOCATION");
166 SetEnumPropertyByInteger(env, countryCodeType, COUNTRY_CODE_FROM_NETWORK, "COUNTRY_CODE_FROM_NETWORK");
167 return countryCodeType;
168 }
169
GeoLocationErrorCodeTypeConstructor(napi_env env)170 napi_value GeoLocationErrorCodeTypeConstructor(napi_env env)
171 {
172 napi_value geoLocationErrorCode = nullptr;
173 NAPI_CALL(env, napi_create_object(env, &geoLocationErrorCode));
174 SetEnumPropertyByInteger(env, geoLocationErrorCode, INPUT_PARAMS_ERROR, "INPUT_PARAMS_ERROR");
175 SetEnumPropertyByInteger(env, geoLocationErrorCode, REVERSE_GEOCODE_ERROR, "REVERSE_GEOCODE_ERROR");
176 SetEnumPropertyByInteger(env, geoLocationErrorCode, GEOCODE_ERROR, "GEOCODE_ERROR");
177 SetEnumPropertyByInteger(env, geoLocationErrorCode, LOCATOR_ERROR, "LOCATOR_ERROR");
178 SetEnumPropertyByInteger(env, geoLocationErrorCode, LOCATION_SWITCH_ERROR, "LOCATION_SWITCH_ERROR");
179 SetEnumPropertyByInteger(env, geoLocationErrorCode, LAST_KNOWN_LOCATION_ERROR, "LAST_KNOWN_LOCATION_ERROR");
180 SetEnumPropertyByInteger(env, geoLocationErrorCode,
181 LOCATION_REQUEST_TIMEOUT_ERROR, "LOCATION_REQUEST_TIMEOUT_ERROR");
182 return geoLocationErrorCode;
183 }
184
LocatingRequiredDataTypeConstructor(napi_env env)185 napi_value LocatingRequiredDataTypeConstructor(napi_env env)
186 {
187 napi_value locatingPriority = nullptr;
188 NAPI_CALL(env, napi_create_object(env, &locatingPriority));
189 SetEnumPropertyByInteger(env, locatingPriority, LocatingRequiredDataType::WIFI, "WIFI");
190 SetEnumPropertyByInteger(env, locatingPriority, LocatingRequiredDataType::BLUE_TOOTH, "BLUE_TOOTH");
191 return locatingPriority;
192 }
193
LocationSourceTypeConstructor(napi_env env)194 napi_value LocationSourceTypeConstructor(napi_env env)
195 {
196 napi_value locationSourceType = nullptr;
197 NAPI_CALL(env, napi_create_object(env, &locationSourceType));
198 SetEnumPropertyByInteger(env, locationSourceType, LocationSourceType::GNSS_TYPE, "GNSS");
199 SetEnumPropertyByInteger(env, locationSourceType, LocationSourceType::NETWORK_TYPE, "NETWORK");
200 SetEnumPropertyByInteger(env, locationSourceType, LocationSourceType::INDOOR_TYPE, "INDOOR");
201 SetEnumPropertyByInteger(env, locationSourceType, LocationSourceType::RTK_TYPE, "RTK");
202 return locationSourceType;
203 }
204
LocationErrorConstructor(napi_env env)205 napi_value LocationErrorConstructor(napi_env env)
206 {
207 napi_value locationError = nullptr;
208 NAPI_CALL(env, napi_create_object(env, &locationError));
209 SetEnumPropertyByInteger(env, locationError, LocationErr::LOCATING_FAILED_DEFAULT, "LOCATING_FAILED_DEFAULT");
210 SetEnumPropertyByInteger(env, locationError,
211 LocationErr::LOCATING_FAILED_LOCATION_PERMISSION_DENIED, "LOCATING_FAILED_LOCATION_PERMISSION_DENIED");
212 SetEnumPropertyByInteger(env, locationError,
213 LocationErr::LOCATING_FAILED_BACKGROUND_PERMISSION_DENIED, "LOCATING_FAILED_BACKGROUND_PERMISSION_DENIED");
214 SetEnumPropertyByInteger(env, locationError,
215 LocationErr::LOCATING_FAILED_LOCATION_SWITCH_OFF, "LOCATING_FAILED_LOCATION_SWITCH_OFF");
216 SetEnumPropertyByInteger(env, locationError,
217 LocationErr::LOCATING_FAILED_INTERNET_ACCESS_FAILURE, "LOCATING_FAILED_INTERNET_ACCESS_FAILURE");
218 return locationError;
219 }
220
221 #ifndef ENABLE_NAPI_MANAGER
222 /*
223 * Module initialization function
224 */
Init(napi_env env,napi_value exports)225 static napi_value Init(napi_env env, napi_value exports)
226 {
227 LBSLOGI(LOCATION_NAPI, "Init,location_napi_entry");
228
229 napi_property_descriptor desc[] = {
230 DECLARE_NAPI_FUNCTION("getLastLocation", GetLastLocation),
231 DECLARE_NAPI_FUNCTION("isLocationEnabled", IsLocationEnabled),
232 DECLARE_NAPI_FUNCTION("requestEnableLocation", RequestEnableLocation),
233 DECLARE_NAPI_FUNCTION("enableLocation", EnableLocation),
234 DECLARE_NAPI_FUNCTION("disableLocation", DisableLocation),
235 DECLARE_NAPI_FUNCTION("getAddressesFromLocation", GetAddressesFromLocation),
236 DECLARE_NAPI_FUNCTION("getAddressesFromLocationName", GetAddressesFromLocationName),
237 DECLARE_NAPI_FUNCTION("isGeoServiceAvailable", IsGeoServiceAvailable),
238 DECLARE_NAPI_FUNCTION("getCachedGnssLocationsSize", GetCachedGnssLocationsSize),
239 DECLARE_NAPI_FUNCTION("flushCachedGnssLocations", FlushCachedGnssLocations),
240 DECLARE_NAPI_FUNCTION("sendCommand", SendCommand),
241 DECLARE_NAPI_FUNCTION("on", On),
242 DECLARE_NAPI_FUNCTION("off", Off),
243 DECLARE_NAPI_FUNCTION("getCurrentLocation", GetCurrentLocation),
244
245 DECLARE_NAPI_FUNCTION("getLocation", GetLocation),
246 DECLARE_NAPI_FUNCTION("getLocationType", GetLocationType),
247 DECLARE_NAPI_FUNCTION("subscribe", Subscribe),
248 DECLARE_NAPI_FUNCTION("unsubscribe", Unsubscribe),
249 DECLARE_NAPI_FUNCTION("getSupportedCoordTypes", GetSupportedCoordTypes),
250
251 DECLARE_NAPI_PROPERTY("LocationRequestPriority", LocationRequestPriorityTypeConstructor(env)),
252 DECLARE_NAPI_PROPERTY("LocationRequestScenario", LocationRequestScenarioTypeConstructor(env)),
253 DECLARE_NAPI_PROPERTY("LocationPrivacyType", LocationPrivacyTypeConstructor(env)),
254 DECLARE_NAPI_PROPERTY("GeoLocationErrorCode", GeoLocationErrorCodeTypeConstructor(env)),
255 };
256
257 NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(napi_property_descriptor), desc));
258 return exports;
259 }
260
261 static napi_module g_locationModule = {
262 .nm_version = 1,
263 .nm_flags = 0,
264 .nm_filename = nullptr,
265 .nm_register_func = Init,
266 .nm_modname = "geolocation",
267 .nm_priv = ((void *)0),
268 .reserved = { 0 }
269 };
270
271 #else
272
273 /*
274 * Module initialization function
275 */
InitManager(napi_env env,napi_value exports)276 static napi_value InitManager(napi_env env, napi_value exports)
277 {
278 LBSLOGD(LOCATION_NAPI, "Init, location_napi_manager_entry");
279
280 napi_property_descriptor desc[] = {
281 DECLARE_NAPI_FUNCTION("on", On),
282 DECLARE_NAPI_FUNCTION("off", Off),
283 DECLARE_NAPI_FUNCTION("getCurrentLocation", GetCurrentLocation),
284 DECLARE_NAPI_FUNCTION("getLastLocation", GetLastLocation),
285 DECLARE_NAPI_FUNCTION("isLocationEnabled", IsLocationEnabled),
286 DECLARE_NAPI_FUNCTION("enableLocation", EnableLocation),
287 DECLARE_NAPI_FUNCTION("disableLocation", DisableLocation),
288 DECLARE_NAPI_FUNCTION("requestEnableLocation", RequestEnableLocation),
289 DECLARE_NAPI_FUNCTION("isGeocoderAvailable", IsGeoServiceAvailable),
290 DECLARE_NAPI_FUNCTION("getAddressesFromLocation", GetAddressesFromLocation),
291 DECLARE_NAPI_FUNCTION("getAddressesFromLocationName", GetAddressesFromLocationName),
292 DECLARE_NAPI_FUNCTION("isLocationPrivacyConfirmed", IsLocationPrivacyConfirmed),
293 DECLARE_NAPI_FUNCTION("setLocationPrivacyConfirmStatus", SetLocationPrivacyConfirmStatus),
294 DECLARE_NAPI_FUNCTION("getCachedGnssLocationsSize", GetCachedGnssLocationsSize),
295 DECLARE_NAPI_FUNCTION("flushCachedGnssLocations", FlushCachedGnssLocations),
296 DECLARE_NAPI_FUNCTION("sendCommand", SendCommand),
297 DECLARE_NAPI_FUNCTION("getCountryCode", GetIsoCountryCode),
298 DECLARE_NAPI_FUNCTION("enableLocationMock", EnableLocationMock),
299 DECLARE_NAPI_FUNCTION("disableLocationMock", DisableLocationMock),
300 DECLARE_NAPI_FUNCTION("setMockedLocations", SetMockedLocations),
301 DECLARE_NAPI_FUNCTION("enableReverseGeocodingMock", EnableReverseGeocodingMock),
302 DECLARE_NAPI_FUNCTION("disableReverseGeocodingMock", DisableReverseGeocodingMock),
303 DECLARE_NAPI_FUNCTION("setReverseGeocodingMockInfo", SetReverseGeocodingMockInfo),
304 DECLARE_NAPI_FUNCTION("getLocatingRequiredData", GetLocatingRequiredData),
305 DECLARE_NAPI_FUNCTION("addGnssGeofence", AddGnssGeofence),
306 DECLARE_NAPI_FUNCTION("removeGnssGeofence", RemoveGnssGeofence),
307 DECLARE_NAPI_FUNCTION("getGeofenceSupportedCoordTypes", GetGeofenceSupportedCoordTypes),
308 DECLARE_NAPI_FUNCTION("getCurrentWifiBssidForLocating", GetCurrentWifiBssidForLocating),
309
310 DECLARE_NAPI_PROPERTY("LocationRequestPriority", LocationRequestPriorityTypeConstructor(env)),
311 DECLARE_NAPI_PROPERTY("LocationRequestScenario", LocationRequestScenarioTypeConstructor(env)),
312 DECLARE_NAPI_PROPERTY("LocationPrivacyType", LocationPrivacyTypeConstructor(env)),
313 DECLARE_NAPI_PROPERTY("CountryCodeType", CountryCodeTypeConstructor(env)),
314 DECLARE_NAPI_PROPERTY("LocatingRequiredDataType", LocatingRequiredDataTypeConstructor(env)),
315 DECLARE_NAPI_PROPERTY("GeofenceTransitionEvent", GeofenceTransitionEventConstructor(env)),
316 DECLARE_NAPI_PROPERTY("CoordinateSystemType", CoordinateSystemTypeConstructor(env)),
317 DECLARE_NAPI_PROPERTY("SatelliteConstellationCategory", SvConstellationTypeConstructor(env)),
318 DECLARE_NAPI_PROPERTY("SatelliteAdditionalInfo", SatelliteAdditionalInfoTypeConstructor(env)),
319 DECLARE_NAPI_PROPERTY("UserActivityScenario", UserActivityScenarioTypeConstructor(env)),
320 DECLARE_NAPI_PROPERTY("LocatingPriority", LocatingPriorityTypeConstructor(env)),
321 DECLARE_NAPI_PROPERTY("PowerConsumptionScenario", PowerConsumptionScenarioTypeConstructor(env)),
322 DECLARE_NAPI_PROPERTY("LocationSourceType", LocationSourceTypeConstructor(env)),
323 DECLARE_NAPI_PROPERTY("LocationError", LocationErrorConstructor(env)),
324 };
325
326 NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(napi_property_descriptor), desc));
327 return exports;
328 }
329
330 static napi_module g_locationManagerModule = {
331 .nm_version = 1,
332 .nm_flags = 0,
333 .nm_filename = nullptr,
334 .nm_register_func = InitManager,
335 .nm_modname = "geoLocationManager",
336 .nm_priv = ((void *)0),
337 .reserved = { 0 }
338 };
339 #endif
340
341 #ifndef ENABLE_NAPI_MANAGER
RegisterGeolocationModule(void)342 extern "C" __attribute__((constructor)) void RegisterGeolocationModule(void)
343 {
344 napi_module_register(&g_locationModule);
345 }
346 #else
RegisterGeolocationManagerModule(void)347 extern "C" __attribute__((constructor)) void RegisterGeolocationManagerModule(void)
348 {
349 napi_module_register(&g_locationManagerModule);
350 }
351 #endif
352 } // namespace Location
353 } // namespace OHOS
354