161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit LocationKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci/** 2261847f8eSopenharmony_ci * @syscap SystemCapability.Location.Location.Lite 2361847f8eSopenharmony_ci * @deprecated since 9 2461847f8eSopenharmony_ci * @useinstead ohos.geoLocationManager/geoLocationManager.Location 2561847f8eSopenharmony_ci */ 2661847f8eSopenharmony_ciexport interface GeolocationResponse { 2761847f8eSopenharmony_ci /** 2861847f8eSopenharmony_ci * Longitude. 2961847f8eSopenharmony_ci * @since 3 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_ci longitude: number; 3261847f8eSopenharmony_ci 3361847f8eSopenharmony_ci /** 3461847f8eSopenharmony_ci * Latitude. 3561847f8eSopenharmony_ci * @since 3 3661847f8eSopenharmony_ci */ 3761847f8eSopenharmony_ci latitude: number; 3861847f8eSopenharmony_ci 3961847f8eSopenharmony_ci /** 4061847f8eSopenharmony_ci * Altitude. 4161847f8eSopenharmony_ci * @since 3 4261847f8eSopenharmony_ci */ 4361847f8eSopenharmony_ci altitude: number; 4461847f8eSopenharmony_ci 4561847f8eSopenharmony_ci /** 4661847f8eSopenharmony_ci * Location accuracy. 4761847f8eSopenharmony_ci * @since 3 4861847f8eSopenharmony_ci */ 4961847f8eSopenharmony_ci accuracy: number; 5061847f8eSopenharmony_ci 5161847f8eSopenharmony_ci /** 5261847f8eSopenharmony_ci * Time when the location is obtained. 5361847f8eSopenharmony_ci * @since 3 5461847f8eSopenharmony_ci */ 5561847f8eSopenharmony_ci time: number; 5661847f8eSopenharmony_ci} 5761847f8eSopenharmony_ci 5861847f8eSopenharmony_ci/** 5961847f8eSopenharmony_ci * @syscap SystemCapability.Location.Location.Lite 6061847f8eSopenharmony_ci * @permission ohos.permission.LOCATION 6161847f8eSopenharmony_ci * @deprecated since 9 6261847f8eSopenharmony_ci * @useinstead ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest 6361847f8eSopenharmony_ci */ 6461847f8eSopenharmony_ciexport interface GetLocationOption { 6561847f8eSopenharmony_ci /** 6661847f8eSopenharmony_ci * Timeout duration, in milliseconds. 6761847f8eSopenharmony_ci * For the rich device, the default value is 30000. 6861847f8eSopenharmony_ci * For the lite wearable device, the default value is 180000. 6961847f8eSopenharmony_ci * The timeout duration is necessary in case no result is returned if the request to obtain the geographic location is rejected for the lack of the required permission, weak positioning signal, or incorrect location settings. After the timeout duration expires, the fail function will be called. 7061847f8eSopenharmony_ci * The value is a 32-digit positive integer. 7161847f8eSopenharmony_ci * If the value set is less than or equal to 0, the default value will be used. 7261847f8eSopenharmony_ci * @since 3 7361847f8eSopenharmony_ci */ 7461847f8eSopenharmony_ci timeout?: number; 7561847f8eSopenharmony_ci 7661847f8eSopenharmony_ci /** 7761847f8eSopenharmony_ci * Coordinate system type. Available types can be obtained using getSupportedCoordTypes. 7861847f8eSopenharmony_ci * The default type is wgs84. 7961847f8eSopenharmony_ci * @since 3 8061847f8eSopenharmony_ci */ 8161847f8eSopenharmony_ci coordType?: string; 8261847f8eSopenharmony_ci 8361847f8eSopenharmony_ci /** 8461847f8eSopenharmony_ci * Called when the geographic location is obtained. 8561847f8eSopenharmony_ci * @since 3 8661847f8eSopenharmony_ci */ 8761847f8eSopenharmony_ci success?: (data: GeolocationResponse) => void; 8861847f8eSopenharmony_ci 8961847f8eSopenharmony_ci /** 9061847f8eSopenharmony_ci * Called when the location types fail to be obtained 9161847f8eSopenharmony_ci * @since 3 9261847f8eSopenharmony_ci */ 9361847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 9461847f8eSopenharmony_ci 9561847f8eSopenharmony_ci /** 9661847f8eSopenharmony_ci * Called when the execution is completed. 9761847f8eSopenharmony_ci * @since 3 9861847f8eSopenharmony_ci */ 9961847f8eSopenharmony_ci complete?: () => void; 10061847f8eSopenharmony_ci} 10161847f8eSopenharmony_ci 10261847f8eSopenharmony_ci/** 10361847f8eSopenharmony_ci * @syscap SystemCapability.Location.Location.Lite 10461847f8eSopenharmony_ci * @deprecated since 9 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ciexport interface GetLocationTypeResponse { 10761847f8eSopenharmony_ci /** 10861847f8eSopenharmony_ci * @since 3 10961847f8eSopenharmony_ci */ 11061847f8eSopenharmony_ci types: Array<string>; 11161847f8eSopenharmony_ci} 11261847f8eSopenharmony_ci 11361847f8eSopenharmony_ci/** 11461847f8eSopenharmony_ci * @syscap SystemCapability.Location.Location.Lite 11561847f8eSopenharmony_ci * @deprecated since 9 11661847f8eSopenharmony_ci */ 11761847f8eSopenharmony_ciexport interface GetLocationTypeOption { 11861847f8eSopenharmony_ci /** 11961847f8eSopenharmony_ci * Called when the location types are obtained. 12061847f8eSopenharmony_ci * @since 3 12161847f8eSopenharmony_ci */ 12261847f8eSopenharmony_ci success?: (data: GetLocationTypeResponse) => void; 12361847f8eSopenharmony_ci 12461847f8eSopenharmony_ci /** 12561847f8eSopenharmony_ci * Called when the location types fail to be obtained. 12661847f8eSopenharmony_ci * @since 3 12761847f8eSopenharmony_ci */ 12861847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 12961847f8eSopenharmony_ci 13061847f8eSopenharmony_ci /** 13161847f8eSopenharmony_ci * Called when the execution is completed. 13261847f8eSopenharmony_ci * @since 3 13361847f8eSopenharmony_ci */ 13461847f8eSopenharmony_ci complete?: () => void; 13561847f8eSopenharmony_ci} 13661847f8eSopenharmony_ci 13761847f8eSopenharmony_ci/** 13861847f8eSopenharmony_ci * @syscap SystemCapability.Location.Location.Lite 13961847f8eSopenharmony_ci * @permission ohos.permission.LOCATION 14061847f8eSopenharmony_ci * @deprecated since 9 14161847f8eSopenharmony_ci * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequest 14261847f8eSopenharmony_ci */ 14361847f8eSopenharmony_ciexport interface SubscribeLocationOption { 14461847f8eSopenharmony_ci /** 14561847f8eSopenharmony_ci * Coordinate system type. Available types can be obtained using getSupportedCoordTypes. 14661847f8eSopenharmony_ci * The default type is wgs84. 14761847f8eSopenharmony_ci * @since 3 14861847f8eSopenharmony_ci */ 14961847f8eSopenharmony_ci coordType?: string; 15061847f8eSopenharmony_ci 15161847f8eSopenharmony_ci /** 15261847f8eSopenharmony_ci * Called whenever the geographical location changes. 15361847f8eSopenharmony_ci * @since 3 15461847f8eSopenharmony_ci */ 15561847f8eSopenharmony_ci success: (data: GeolocationResponse) => void; 15661847f8eSopenharmony_ci 15761847f8eSopenharmony_ci /** 15861847f8eSopenharmony_ci * Called when the listening fails. 15961847f8eSopenharmony_ci * @since 3 16061847f8eSopenharmony_ci */ 16161847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 16261847f8eSopenharmony_ci} 16361847f8eSopenharmony_ci 16461847f8eSopenharmony_ci/** 16561847f8eSopenharmony_ci * @syscap SystemCapability.Location.Location.Lite 16661847f8eSopenharmony_ci * @deprecated since 9 16761847f8eSopenharmony_ci * @useinstead ohos.geoLocationManager/geoLocationManager 16861847f8eSopenharmony_ci */ 16961847f8eSopenharmony_ciexport default class Geolocation { 17061847f8eSopenharmony_ci /** 17161847f8eSopenharmony_ci * Obtains the geographic location. 17261847f8eSopenharmony_ci * @permission ohos.permission.LOCATION 17361847f8eSopenharmony_ci * @param options Options. 17461847f8eSopenharmony_ci * @deprecated since 9 17561847f8eSopenharmony_ci * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation 17661847f8eSopenharmony_ci */ 17761847f8eSopenharmony_ci static getLocation(options?: GetLocationOption): void; 17861847f8eSopenharmony_ci 17961847f8eSopenharmony_ci /** 18061847f8eSopenharmony_ci * Obtains the location types supported by the system. 18161847f8eSopenharmony_ci * @param options Options. 18261847f8eSopenharmony_ci * @deprecated since 9 18361847f8eSopenharmony_ci */ 18461847f8eSopenharmony_ci static getLocationType(options?: GetLocationTypeOption): void; 18561847f8eSopenharmony_ci 18661847f8eSopenharmony_ci /** 18761847f8eSopenharmony_ci * Listens to the geographical location. If this method is called multiple times, the last call takes effect. 18861847f8eSopenharmony_ci * @permission ohos.permission.LOCATION 18961847f8eSopenharmony_ci * @param options Options. 19061847f8eSopenharmony_ci * @deprecated since 9 19161847f8eSopenharmony_ci * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationChange 19261847f8eSopenharmony_ci */ 19361847f8eSopenharmony_ci static subscribe(options: SubscribeLocationOption): void; 19461847f8eSopenharmony_ci 19561847f8eSopenharmony_ci /** 19661847f8eSopenharmony_ci * Cancels listening to the geographical location. 19761847f8eSopenharmony_ci * @permission ohos.permission.LOCATION 19861847f8eSopenharmony_ci * @deprecated since 9 19961847f8eSopenharmony_ci * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationChange 20061847f8eSopenharmony_ci */ 20161847f8eSopenharmony_ci static unsubscribe(): void; 20261847f8eSopenharmony_ci 20361847f8eSopenharmony_ci /** 20461847f8eSopenharmony_ci * Obtains the supported coordinate system types. 20561847f8eSopenharmony_ci * @returns A string array of the supported coordinate system types, for example, ['wgs84']. 20661847f8eSopenharmony_ci * @deprecated since 9 20761847f8eSopenharmony_ci */ 20861847f8eSopenharmony_ci static getSupportedCoordTypes(): Array<string>; 20961847f8eSopenharmony_ci} 210