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_IMPL_H
17 #define GEOLOCATIONMANAGER_IMPL_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <string>
22 #include <vector>
23 #include "locator.h"
24 #include "location_napi_event.h"
25 #include "geolocationmanager_utils.h"
26 
27 namespace OHOS {
28 namespace GeoLocationManager {
29 CJLocation GetLastLocation(int32_t& errCode);
30 
31 bool IsLocationEnabled(int32_t& errCode);
32 
33 bool IsGeocoderAvailable(int32_t& errCode);
34 
35 int32_t GetCachedGnssLocationsSize(int32_t& errCode);
36 
37 CJLocation GetCurrentLocation(int32_t& errCode);
38 
39 CJLocation GetCurrentLocationCurrent(CJCurrentLocationRequest request, int32_t& errCode);
40 
41 CJLocation GetCurrentLocationSingle(CJSingleLocationRequest request, int32_t& errCode);
42 
43 CJLocation GetCurrentLocation(std::unique_ptr<Location::RequestConfig>& requestConfig, int32_t& errCode);
44 
45 void FlushCachedGnssLocations(int32_t& errCode);
46 
47 void SendCommand(CJLocationCommand command, int32_t& errCode);
48 
49 CJCountryCode GetCountryCode(int32_t& errCode);
50 
51 CJGeoAddressArr GetAddressesFromLocation(CJReverseGeoCodeRequest request, int32_t& errCode);
52 
53 CJGeoAddressArr GetAddressesFromLocationName(CJGeoCodeRequest request, int32_t& errCode);
54 
55 int32_t OnLocationRequest(CJLocationRequest request, int64_t callbackId);
56 
57 int32_t OnContinuousLocationRequest(CJContinuousLocationRequest request, int64_t callbackId);
58 
59 int32_t OffLocationChange(int64_t callbackId);
60 
61 int32_t OffLocationChangeAll();
62 
63 int32_t OnLocationError(int64_t callbackId);
64 
65 int32_t OffLocationError(int64_t callbackId);
66 
67 int32_t OffLocationErrorAll();
68 
69 int32_t OnLocationEnabledChange(int64_t callbackId);
70 
71 int32_t OffLocationEnabledChange(int64_t callbackId);
72 
73 int32_t OffLocationEnabledChangeAll();
74 
75 int32_t OnCachedGnssLocationsChange(CJCachedGnssLocationsRequest request,
76     int64_t callbackId);
77 
78 int32_t OffCachedGnssLocationsChange(int64_t callbackId);
79 
80 int32_t OffCachedGnssLocationsChangeAll();
81 
82 int32_t OnSatelliteStatusChange(int64_t callbackId);
83 
84 int32_t OffSatelliteStatusChange(int64_t callbackId);
85 
86 int32_t OffSatelliteStatusChangeAll();
87 
88 int32_t OnNmeaMessage(int64_t callbackId);
89 
90 int32_t OffNmeaMessage(int64_t callbackId);
91 
92 int32_t OffNmeaMessageAll();
93 
94 int32_t OnCountryCodeChange(int64_t callbackId);
95 
96 int32_t OffCountryCodeChange(int64_t callbackId);
97 
98 int32_t OffCountryCodeChangeAll();
99 
100 CArrI32 GetGeofenceSupportedCoordTypes(int32_t& errCode);
101 }
102 }
103 
104 #endif // GEOLOCATIONMANAGER_IMPL_H