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 GEO_REQUEST_MESSAGE_H 17#define GEO_REQUEST_MESSAGE_H 18#ifdef FEATURE_GEOCODE_SUPPORT 19 20#include <mutex> 21#include <singleton.h> 22#include <string> 23#include <vector> 24 25#include "iremote_object.h" 26#include "message_parcel.h" 27#include "message_option.h" 28#include "common_utils.h" 29 30namespace OHOS { 31namespace Location { 32enum class GeoCodeType { 33 REQUEST_GEOCODE = 1, 34 REQUEST_REVERSE_GEOCODE, 35}; 36 37class GeoConvertRequest { 38public: 39 GeoConvertRequest(); 40 ~GeoConvertRequest(); 41 std::string GetLocale(); 42 void SetLocale(std::string locale); 43 double GetLatitude(); 44 void SetLatitude(double latitude); 45 double GetLongitude(); 46 void SetLongitude(double longitude); 47 int32_t GetMaxItems(); 48 void SetMaxItems(int32_t maxItems); 49 std::string GetDescription(); 50 void SetDescription(std::string description); 51 double GetMaxLatitude(); 52 void SetMaxLatitude(double maxLatitude); 53 double GetMaxLongitude(); 54 void SetMaxLongitude(double maxLongitude); 55 double GetMinLatitude(); 56 void SetMinLatitude(double minLatitude); 57 double GetMinLongitude(); 58 void SetMinLongitude(double minLongitude); 59 std::string GetBundleName(); 60 void SetBundleName(std::string bundleName); 61 sptr<IRemoteObject> GetCallback(); 62 void SetCallback(sptr<IRemoteObject> callback); 63 std::string GetTransId(); 64 void SetTransId(std::string transId); 65 std::string GetCountry(); 66 void SetCountry(std::string country); 67 GeoCodeType GetRequestType(); 68 void SetRequestType(GeoCodeType requestType); 69 bool Marshalling(MessageParcel& parcel) const; 70 static std::unique_ptr<GeoConvertRequest> Unmarshalling(MessageParcel& parcel, GeoCodeType requestType); 71 static void OrderParcel(MessageParcel& in, MessageParcel& out, GeoCodeType requestType, std::string bundleName); 72 void ReadFromParcel(MessageParcel& parcel); 73private: 74 std::string locale_; 75 double latitude_; 76 double longitude_; 77 int64_t maxItems_; 78 std::string description_; 79 double maxLatitude_; 80 double maxLongitude_; 81 double minLatitude_; 82 double minLongitude_; 83 std::string bundleName_; 84 sptr<IRemoteObject> callback_; 85 std::string transId_; 86 std::string country_; 87 GeoCodeType requestType_; 88}; 89} // namespace OHOS 90} // namespace Location 91#endif // FEATURE_GEOCODE_SUPPORT 92#endif // GEO_REQUEST_MESSAGE_H 93