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 LOCATOR_C_IMPL_H 17 #define LOCATOR_C_IMPL_H 18 19 #include "oh_location_type.h" 20 #include "location_info_callback_host.h" 21 #include "constant_definition.h" 22 23 const int ADDITIONS_MAX_LEN = 512; 24 25 struct Location_RequestConfig { 26 int32_t scenario_ = OHOS::Location::SCENE_UNSET; 27 int32_t timeInterval_ = 1; // no time interval limit for reporting location 28 void* userData_ = nullptr; 29 Location_InfoCallback callback_; 30 }; 31 32 typedef struct Location_Info { 33 double latitude = 0.0; 34 double longitude = 0.0; 35 double altitude = 0.0; 36 double accuracy = 0.0; 37 double speed = 0.0; 38 double direction = 0.0; 39 int64_t timeForFix = 0; 40 int64_t timeSinceBoot = 0; 41 char additions[ADDITIONS_MAX_LEN]; 42 double altitudeAccuracy = 0.0; 43 double speedAccuracy = 0.0; 44 double directionAccuracy = 0.0; 45 int64_t uncertaintyOfTimeSinceBoot = 0; 46 Location_SourceType locationSourceType; 47 } Location_Info; 48 49 void AddLocationCallBack(OHOS::sptr<OHOS::Location::LocationInfoCallbackHost>& callback); 50 void RemoveLocationCallBack(const Location_RequestConfig* requestConfig); 51 OHOS::sptr<OHOS::Location::LocationInfoCallbackHost> GetLocationCallBack(const Location_RequestConfig* requestConfig); 52 Location_ResultCode LocationErrCodeToLocationResultCode(OHOS::Location::LocationErrCode errCode); 53 54 #endif // LOCATOR_C_IMPL_H