15c735df2Sopenharmony_ci/* 25c735df2Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 35c735df2Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 45c735df2Sopenharmony_ci * you may not use this file except in compliance with the License. 55c735df2Sopenharmony_ci * You may obtain a copy of the License at 65c735df2Sopenharmony_ci * 75c735df2Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 85c735df2Sopenharmony_ci * 95c735df2Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 105c735df2Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 115c735df2Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125c735df2Sopenharmony_ci * See the License for the specific language governing permissions and 135c735df2Sopenharmony_ci * limitations under the License. 145c735df2Sopenharmony_ci */ 155c735df2Sopenharmony_ci 165c735df2Sopenharmony_ci#ifndef GEO_CONVERT_SKELETON_H 175c735df2Sopenharmony_ci#define GEO_CONVERT_SKELETON_H 185c735df2Sopenharmony_ci#ifdef FEATURE_GEOCODE_SUPPORT 195c735df2Sopenharmony_ci 205c735df2Sopenharmony_ci#include <vector> 215c735df2Sopenharmony_ci 225c735df2Sopenharmony_ci#include "iremote_broker.h" 235c735df2Sopenharmony_ci#include "iremote_stub.h" 245c735df2Sopenharmony_ci#include "message_parcel.h" 255c735df2Sopenharmony_ci#include "string_ex.h" 265c735df2Sopenharmony_ci 275c735df2Sopenharmony_ci#include "app_identity.h" 285c735df2Sopenharmony_ci#include "geo_coding_mock_info.h" 295c735df2Sopenharmony_ci 305c735df2Sopenharmony_cinamespace OHOS { 315c735df2Sopenharmony_cinamespace Location { 325c735df2Sopenharmony_ciclass IGeoConvert : public IRemoteBroker { 335c735df2Sopenharmony_cipublic: 345c735df2Sopenharmony_ci DECLARE_INTERFACE_DESCRIPTOR(u"location.IGeoConvert"); 355c735df2Sopenharmony_ci virtual int IsGeoConvertAvailable(MessageParcel &rep) = 0; 365c735df2Sopenharmony_ci virtual int GetAddressByCoordinate(MessageParcel &data, MessageParcel &rep) = 0; 375c735df2Sopenharmony_ci virtual int GetAddressByLocationName(MessageParcel &data, MessageParcel &rep) = 0; 385c735df2Sopenharmony_ci virtual bool EnableReverseGeocodingMock() = 0; 395c735df2Sopenharmony_ci virtual bool DisableReverseGeocodingMock() = 0; 405c735df2Sopenharmony_ci virtual LocationErrCode SetReverseGeocodingMockInfo(std::vector<std::shared_ptr<GeocodingMockInfo>>& mockInfo) = 0; 415c735df2Sopenharmony_ci}; 425c735df2Sopenharmony_ci 435c735df2Sopenharmony_ciclass GeoConvertServiceStub : public IRemoteStub<IGeoConvert> { 445c735df2Sopenharmony_cipublic: 455c735df2Sopenharmony_ci using GeoConvertMsgHandle = std::function<int(MessageParcel &, MessageParcel &, AppIdentity &)>; 465c735df2Sopenharmony_ci using GeoConvertMsgHandleMap = std::map<int, GeoConvertMsgHandle>; 475c735df2Sopenharmony_ci GeoConvertServiceStub(); 485c735df2Sopenharmony_ci virtual ~GeoConvertServiceStub() = default; 495c735df2Sopenharmony_ci void InitGeoConvertHandleMap(); 505c735df2Sopenharmony_ci int32_t OnRemoteRequest(uint32_t code, 515c735df2Sopenharmony_ci MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 525c735df2Sopenharmony_ci virtual bool CancelIdleState() = 0; 535c735df2Sopenharmony_ci virtual void UnloadGeoConvertSystemAbility() = 0; 545c735df2Sopenharmony_ciprivate: 555c735df2Sopenharmony_ci int IsGeoConvertAvailableInner(MessageParcel &data, MessageParcel &reply, AppIdentity &identity); 565c735df2Sopenharmony_ci int GetAddressByCoordinateInner(MessageParcel &data, MessageParcel &reply, AppIdentity &identity); 575c735df2Sopenharmony_ci int GetAddressByLocationNameInner(MessageParcel &data, MessageParcel &reply, AppIdentity &identity); 585c735df2Sopenharmony_ci int EnableReverseGeocodingMockInner(MessageParcel &data, MessageParcel &reply, AppIdentity &identity); 595c735df2Sopenharmony_ci int DisableReverseGeocodingMockInner(MessageParcel &data, MessageParcel &reply, AppIdentity &identity); 605c735df2Sopenharmony_ci int SetGeocodingMockInfoInner(MessageParcel &data, MessageParcel &reply, AppIdentity &identity); 615c735df2Sopenharmony_ciprivate: 625c735df2Sopenharmony_ci GeoConvertMsgHandleMap geoConvertMsgHandleMap_; 635c735df2Sopenharmony_ci std::vector<std::shared_ptr<GeocodingMockInfo>> ParseGeocodingMockInfos(MessageParcel &data); 645c735df2Sopenharmony_ci}; 655c735df2Sopenharmony_ci} // namespace OHOS 665c735df2Sopenharmony_ci} // namespace Location 675c735df2Sopenharmony_ci#endif // FEATURE_GEOCODE_SUPPORT 685c735df2Sopenharmony_ci#endif // GEO_CONVERT_SKELETON_H 69