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 #ifndef GEOLOCATIONMANAGER_FFI_H
17 #define GEOLOCATIONMANAGER_FFI_H
18 
19 #include <functional>
20 #include <string>
21 #include <vector>
22 #include <cstdint>
23 #include "ffi_remote_data.h"
24 #include "geolocationmanager_utils.h"
25 
26 
27 namespace OHOS {
28 namespace GeoLocationManager {
29 extern "C" {
30 FFI_EXPORT CJLocation FfiOHOSGeoLocationManagerGetLastLocation(int32_t* errCode);
31 
32 FFI_EXPORT bool FfiOHOSGeoLocationManagerIsLocationEnabled(int32_t* errCode);
33 
34 FFI_EXPORT bool FfiOHOSGeoLocationManagerIsGeocoderAvailable(int32_t* errCode);
35 
36 FFI_EXPORT int32_t FfiOHOSGeoLocationManagerGetCachedGnssLocationsSize(int32_t* errCode);
37 
38 FFI_EXPORT CJLocation FfiOHOSGeoLocationManagerGetCurrentLocation(int32_t* errCode);
39 
40 FFI_EXPORT CJLocation FfiOHOSGeoLocationManagerGetCurrentLocationCurrent(CJCurrentLocationRequest request,
41     int32_t* errCode);
42 
43 FFI_EXPORT CJLocation FfiOHOSGeoLocationManagerGetCurrentLocationSingle(CJSingleLocationRequest request,
44     int32_t* errCode);
45 
46 FFI_EXPORT void FfiOHOSGeoLocationManagerFlushCachedGnssLocations(int32_t* errCode);
47 
48 FFI_EXPORT void FfiOHOSGeoLocationManagerSendCommand(CJLocationCommand command, int32_t* errCode);
49 
50 FFI_EXPORT CJCountryCode FfiOHOSGeoLocationManagerGetCountryCode(int32_t* errCode);
51 
52 FFI_EXPORT CJGeoAddressArr FfiOHOSGeoLocationManagerGetAddressesFromLocation(CJReverseGeoCodeRequest request,
53     int32_t* errCode);
54 
55 FFI_EXPORT CJGeoAddressArr FfiOHOSGeoLocationManagerGetAddressesFromLocationName(CJGeoCodeRequest request,
56     int32_t* errCode);
57 
58 FFI_EXPORT int32_t FfiGeoLocationManagerOnLocationChange(CJLocationRequest request, int64_t callbackId);
59 
60 FFI_EXPORT int32_t FfiGeoLocationManagerOnContinuousLocationRequest(CJContinuousLocationRequest request,
61     int64_t callbackId);
62 
63 FFI_EXPORT int32_t FfiGeoLocationManagerOffLocationChange(int64_t callbackId);
64 
65 FFI_EXPORT int32_t FfiGeoLocationManagerOffLocationChangeAll();
66 
67 FFI_EXPORT int32_t FfiGeoLocationManagerOnLocationError(int64_t callbackId);
68 
69 FFI_EXPORT int32_t FfiGeoLocationManagerOffLocationError(int64_t callbackId);
70 
71 FFI_EXPORT int32_t FfiGeoLocationManagerOffLocationErrorAll();
72 
73 FFI_EXPORT int32_t FfiGeoLocationManagerOnLocationEnabledChange(int64_t callbackId);
74 
75 FFI_EXPORT int32_t FfiGeoLocationManagerOffLocationEnabledChange(int64_t callbackId);
76 
77 FFI_EXPORT int32_t FfiGeoLocationManagerOffLocationEnabledChangeAll();
78 
79 FFI_EXPORT int32_t FfiGeoLocationManagerOnCachedGnssLocationsChange(CJCachedGnssLocationsRequest request,
80     int64_t callbackId);
81 
82 FFI_EXPORT int32_t FfiGeoLocationManagerOffCachedGnssLocationsChange(int64_t callbackId);
83 
84 FFI_EXPORT int32_t FfiGeoLocationManagerOffCachedGnssLocationsChangeAll();
85 
86 FFI_EXPORT int32_t FfiGeoLocationManagerOnSatelliteStatusChange(int64_t callbackId);
87 
88 FFI_EXPORT int32_t FfiGeoLocationManagerOffSatelliteStatusChange(int64_t callbackId);
89 
90 FFI_EXPORT int32_t FfiGeoLocationManagerOffSatelliteStatusChangeAll();
91 
92 FFI_EXPORT int32_t FfiGeoLocationManagerOnNmeaMessage(int64_t callbackId);
93 
94 FFI_EXPORT int32_t FfiGeoLocationManagerOffNmeaMessage(int64_t callbackId);
95 
96 FFI_EXPORT int32_t FfiGeoLocationManagerOffNmeaMessageAll();
97 
98 FFI_EXPORT int32_t FfiGeoLocationManagerOnCountryCodeChange(int64_t callbackId);
99 
100 FFI_EXPORT int32_t FfiGeoLocationManagerOffCountryCodeChange(int64_t callbackId);
101 
102 FFI_EXPORT int32_t FfiGeoLocationManagerOffCountryCodeChangeAll();
103 
104 FFI_EXPORT CArrI32 FfiGeoLocationManagerGetGeofenceSupportedCoordTypes(int32_t* errCode);
105 }
106 }
107 }
108 
109 #endif // GEOLOCATIONMANAGER_FFI_H