1/* 2 * Copyright (c) 2022 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 16import { AsyncCallback, Callback } from './@ohos.base'; 17import { WantAgent } from './@ohos.wantAgent'; 18 19/** 20 * Provides interfaces for initiating location requests, ending the location service, 21 * and obtaining the location result cached by the system. 22 * 23 * @namespace geolocation 24 * @permission ohos.permission.LOCATION 25 * @syscap SystemCapability.Location.Location.Core 26 * @since 7 27 * @deprecated since 9 28 */ 29declare namespace geolocation { 30 /** 31 * Subscribe location changed 32 * 33 * @permission ohos.permission.LOCATION 34 * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. 35 * @param { LocationRequest } request - Indicates the location request parameters. 36 * @param { Callback<Location> } callback - Indicates the callback for reporting the location result. 37 * @syscap SystemCapability.Location.Location.Core 38 * @since 7 39 * @deprecated since 9 40 * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationChange 41 */ 42 function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void; 43 44 /** 45 * Unsubscribe location changed 46 * 47 * @permission ohos.permission.LOCATION 48 * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. 49 * @param { Callback<Location> } [callback] - Indicates the callback for reporting the location result. 50 * @syscap SystemCapability.Location.Location.Core 51 * @since 7 52 * @deprecated since 9 53 * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationChange 54 */ 55 function off(type: 'locationChange', callback?: Callback<Location>): void; 56 57 /** 58 * Subscribe location switch changed 59 * 60 * @permission ohos.permission.LOCATION 61 * @param { 'locationServiceState' } type - Indicates the location service event to be subscribed to. 62 * @param { Callback<boolean> } callback - Indicates the callback for reporting the location result. 63 * @syscap SystemCapability.Location.Location.Core 64 * @since 7 65 * @deprecated since 9 66 * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationEnabledChange 67 */ 68 function on(type: 'locationServiceState', callback: Callback<boolean>): void; 69 70 /** 71 * Unsubscribe location switch changed 72 * 73 * @permission ohos.permission.LOCATION 74 * @param { 'locationServiceState' } type - Indicates the location service event to be subscribed to. 75 * @param { Callback<boolean> } [callback] - Indicates the callback for reporting the location result. 76 * @syscap SystemCapability.Location.Location.Core 77 * @since 7 78 * @deprecated since 9 79 * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationEnabledChange 80 */ 81 function off(type: 'locationServiceState', callback?: Callback<boolean>): void; 82 83 /** 84 * Subscribe to cache GNSS locations update messages 85 * 86 * @permission ohos.permission.LOCATION 87 * @param { 'cachedGnssLocationsReporting' } type - Indicates the location service event to be subscribed to. 88 * @param { CachedGnssLocationsRequest } request - Indicates the cached GNSS locations request parameters. 89 * @param { Callback<Array<Location>> } callback - Indicates the callback for reporting the cached GNSS locations. 90 * @syscap SystemCapability.Location.Location.Gnss 91 * @since 8 92 * @deprecated since 9 93 * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:cachedGnssLocationsChange 94 */ 95 function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void; 96 97 /** 98 * Unsubscribe to cache GNSS locations update messages 99 * 100 * @permission ohos.permission.LOCATION 101 * @param { 'cachedGnssLocationsReporting' } type - Indicates the location service event to be subscribed to. 102 * @param { Callback<Array<Location>> } [callback] - Indicates the callback for reporting the cached gnss locations. 103 * @syscap SystemCapability.Location.Location.Gnss 104 * @since 8 105 * @deprecated since 9 106 * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:cachedGnssLocationsChange 107 */ 108 function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void; 109 110 /** 111 * Subscribe gnss status changed 112 * 113 * @permission ohos.permission.LOCATION 114 * @param { 'gnssStatusChange' } type - Indicates the location service event to be subscribed to. 115 * @param { Callback<SatelliteStatusInfo> } callback - Indicates the callback for reporting the gnss status change. 116 * @syscap SystemCapability.Location.Location.Gnss 117 * @since 8 118 * @deprecated since 9 119 * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:satelliteStatusChange 120 */ 121 function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void; 122 123 /** 124 * Unsubscribe gnss status changed 125 * 126 * @permission ohos.permission.LOCATION 127 * @param { 'gnssStatusChange' } type - Indicates the location service event to be subscribed to. 128 * @param { Callback<SatelliteStatusInfo> } [callback] - Indicates the callback for reporting the gnss status change. 129 * @syscap SystemCapability.Location.Location.Gnss 130 * @since 8 131 * @deprecated since 9 132 * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:satelliteStatusChange 133 */ 134 function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void; 135 136 /** 137 * Subscribe nmea message changed 138 * 139 * @permission ohos.permission.LOCATION 140 * @param { 'nmeaMessageChange' } type - Indicates the location service event to be subscribed to. 141 * @param { Callback<string> } callback - Indicates the callback for reporting the nmea message. 142 * @syscap SystemCapability.Location.Location.Gnss 143 * @since 8 144 * @deprecated since 9 145 * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:nmeaMessage 146 */ 147 function on(type: 'nmeaMessageChange', callback: Callback<string>): void; 148 149 /** 150 * Unsubscribe nmea message changed 151 * 152 * @permission ohos.permission.LOCATION 153 * @param { 'nmeaMessageChange' } type - Indicates the location service event to be subscribed to. 154 * @param { Callback<string> } [callback] - Indicates the callback for reporting the nmea message. 155 * @syscap SystemCapability.Location.Location.Gnss 156 * @since 8 157 * @deprecated since 9 158 * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:nmeaMessage 159 */ 160 function off(type: 'nmeaMessageChange', callback?: Callback<string>): void; 161 162 /** 163 * Add a geofence and subscribe geo fence status changed 164 * 165 * @permission ohos.permission.LOCATION 166 * @param { 'fenceStatusChange' } type - Indicates the location service event to be subscribed to. 167 * @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters. 168 * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. 169 * @syscap SystemCapability.Location.Location.Geofence 170 * @since 8 171 * @deprecated since 9 172 * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:gnssFenceStatusChange 173 */ 174 function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; 175 176 /** 177 * Remove a geofence and unsubscribe geo fence status changed 178 * 179 * @permission ohos.permission.LOCATION 180 * @param { 'fenceStatusChange' } type - Indicates the location service event to be subscribed to. 181 * @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters. 182 * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. 183 * @syscap SystemCapability.Location.Location.Geofence 184 * @since 8 185 * @deprecated since 9 186 * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:gnssFenceStatusChange 187 */ 188 function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; 189 190 /** 191 * Obtain current location 192 * 193 * @permission ohos.permission.LOCATION 194 * @param { CurrentLocationRequest } request - Indicates the location request parameters. 195 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 196 * @syscap SystemCapability.Location.Location.Core 197 * @since 7 198 * @deprecated since 9 199 * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation 200 */ 201 function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void; 202 203 /** 204 * Obtain current location 205 * 206 * @permission ohos.permission.LOCATION 207 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 208 * @syscap SystemCapability.Location.Location.Core 209 * @since 7 210 * @deprecated since 9 211 * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation 212 */ 213 function getCurrentLocation(callback: AsyncCallback<Location>): void; 214 215 /** 216 * Obtain current location 217 * 218 * @permission ohos.permission.LOCATION 219 * @param { CurrentLocationRequest } [request] - Indicates the location request parameters. 220 * @returns { Promise<Location> } The promise returned by the function. 221 * @syscap SystemCapability.Location.Location.Core 222 * @since 7 223 * @deprecated since 9 224 * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation 225 */ 226 function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>; 227 228 /** 229 * Obtain last known location 230 * 231 * @permission ohos.permission.LOCATION 232 * @param { AsyncCallback<Location> } callback - Indicates the callback for reporting the location result. 233 * @syscap SystemCapability.Location.Location.Core 234 * @since 7 235 * @deprecated since 9 236 * @useinstead ohos.geoLocationManager/geoLocationManager.getLastLocation 237 */ 238 function getLastLocation(callback: AsyncCallback<Location>): void; 239 240 /** 241 * Obtain last known location 242 * 243 * @permission ohos.permission.LOCATION 244 * @returns { Promise<Location> } The promise returned by the function. 245 * @syscap SystemCapability.Location.Location.Core 246 * @since 7 247 * @deprecated since 9 248 * @useinstead ohos.geoLocationManager/geoLocationManager.getLastLocation 249 */ 250 function getLastLocation(): Promise<Location>; 251 252 /** 253 * Obtain current location switch status 254 * 255 * @permission ohos.permission.LOCATION 256 * @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the location switch result. 257 * @syscap SystemCapability.Location.Location.Core 258 * @since 7 259 * @deprecated since 9 260 * @useinstead ohos.geoLocationManager/geoLocationManager.isLocationEnabled 261 */ 262 function isLocationEnabled(callback: AsyncCallback<boolean>): void; 263 264 /** 265 * Obtain current location switch status 266 * 267 * @permission ohos.permission.LOCATION 268 * @returns { Promise<boolean> } The promise returned by the function. 269 * @syscap SystemCapability.Location.Location.Core 270 * @since 7 271 * @deprecated since 9 272 * @useinstead ohos.geoLocationManager/geoLocationManager.isLocationEnabled 273 */ 274 function isLocationEnabled(): Promise<boolean>; 275 276 /** 277 * Request enable location 278 * 279 * @permission ohos.permission.LOCATION 280 * @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the location switch status. 281 * @syscap SystemCapability.Location.Location.Core 282 * @since 7 283 * @deprecated since 9 284 */ 285 function requestEnableLocation(callback: AsyncCallback<boolean>): void; 286 287 /** 288 * Request enable location 289 * 290 * @permission ohos.permission.LOCATION 291 * @returns { Promise<boolean> } The promise returned by the function. 292 * @syscap SystemCapability.Location.Location.Core 293 * @since 7 294 * @deprecated since 9 295 */ 296 function requestEnableLocation(): Promise<boolean>; 297 298 /** 299 * Obtain address info from location 300 * 301 * @permission ohos.permission.LOCATION 302 * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. 303 * @param { AsyncCallback<Array<GeoAddress>> } callback - Indicates the callback for reporting the address info. 304 * @syscap SystemCapability.Location.Location.Geocoder 305 * @since 7 306 * @deprecated since 9 307 * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation 308 */ 309 function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; 310 311 /** 312 * Obtain address info from location 313 * 314 * @permission ohos.permission.LOCATION 315 * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. 316 * @returns { Promise<Array<GeoAddress>> } The promise returned by the function. 317 * @syscap SystemCapability.Location.Location.Geocoder 318 * @since 7 319 * @deprecated since 9 320 * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation 321 */ 322 function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; 323 324 /** 325 * Obtain latitude and longitude info from location address 326 * 327 * @permission ohos.permission.LOCATION 328 * @param { GeoCodeRequest } request - Indicates the geocode query parameters. 329 * @param { AsyncCallback<Array<GeoAddress>> } callback - Indicates the callback for reporting the latitude and longitude result. 330 * @syscap SystemCapability.Location.Location.Geocoder 331 * @since 7 332 * @deprecated since 9 333 * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName 334 */ 335 function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; 336 337 /** 338 * Obtain latitude and longitude info from location address 339 * 340 * @permission ohos.permission.LOCATION 341 * @param { GeoCodeRequest } request - Indicates the geocode query parameters. 342 * @returns { Promise<Array<GeoAddress>> } The promise returned by the function. 343 * @syscap SystemCapability.Location.Location.Geocoder 344 * @since 7 345 * @deprecated since 9 346 * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName 347 */ 348 function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; 349 350 /** 351 * Obtain geocode service status 352 * 353 * @permission ohos.permission.LOCATION 354 * @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the geocode service status. 355 * @syscap SystemCapability.Location.Location.Geocoder 356 * @since 7 357 * @deprecated since 9 358 * @useinstead ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable 359 */ 360 function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void; 361 362 /** 363 * Obtain geocode service status 364 * 365 * @permission ohos.permission.LOCATION 366 * @returns { Promise<boolean> } The promise returned by the function. 367 * @syscap SystemCapability.Location.Location.Geocoder 368 * @since 7 369 * @deprecated since 9 370 * @useinstead ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable 371 */ 372 function isGeoServiceAvailable(): Promise<boolean>; 373 374 /** 375 * Obtain the number of cached GNSS locations reported at a time 376 * 377 * @permission ohos.permission.LOCATION 378 * @param { AsyncCallback<number> } callback - Indicates the callback for reporting the cached GNSS locations size. 379 * @syscap SystemCapability.Location.Location.Gnss 380 * @since 8 381 * @deprecated since 9 382 * @useinstead ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize 383 */ 384 function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; 385 386 /** 387 * Obtain the number of cached GNSS locations reported at a time 388 * 389 * @permission ohos.permission.LOCATION 390 * @returns { Promise<number> } The promise returned by the function. 391 * @syscap SystemCapability.Location.Location.Gnss 392 * @since 8 393 * @deprecated since 9 394 * @useinstead ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize 395 */ 396 function getCachedGnssLocationsSize(): Promise<number>; 397 398 /** 399 * All prepared GNSS locations are returned to the application through the callback function, 400 * and the bottom-layer buffer is cleared. 401 * 402 * @permission ohos.permission.LOCATION 403 * @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the result. 404 * @syscap SystemCapability.Location.Location.Gnss 405 * @since 8 406 * @deprecated since 9 407 * @useinstead ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations 408 */ 409 function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void; 410 411 /** 412 * All prepared GNSS locations are returned to the application through the callback function, 413 * and the bottom-layer buffer is cleared. 414 * 415 * @permission ohos.permission.LOCATION 416 * @returns { Promise<boolean> } The promise returned by the function. 417 * @syscap SystemCapability.Location.Location.Gnss 418 * @since 8 419 * @deprecated since 9 420 * @useinstead ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations 421 */ 422 function flushCachedGnssLocations(): Promise<boolean>; 423 424 /** 425 * Send extended commands to location subsystem. 426 * 427 * @permission ohos.permission.LOCATION 428 * @param { LocationCommand } command - Indicates the extended Command Message Body. 429 * @param { AsyncCallback<boolean> } callback - Indicates the callback for reporting the send command result. 430 * @syscap SystemCapability.Location.Location.Core 431 * @since 8 432 * @deprecated since 9 433 * @useinstead ohos.geoLocationManager/geoLocationManager.sendCommand 434 */ 435 function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void; 436 437 /** 438 * Send extended commands to location subsystem. 439 * 440 * @permission ohos.permission.LOCATION 441 * @param { LocationCommand } command - Indicates the extended Command Message Body. 442 * @returns { Promise<boolean> } The promise returned by the function. 443 * @syscap SystemCapability.Location.Location.Core 444 * @since 8 445 * @deprecated since 9 446 * @useinstead ohos.geoLocationManager/geoLocationManager.sendCommand 447 */ 448 function sendCommand(command: LocationCommand): Promise<boolean>; 449 450 /** 451 * Satellite status information 452 * 453 * @interface SatelliteStatusInfo 454 * @permission ohos.permission.LOCATION 455 * @syscap SystemCapability.Location.Location.Gnss 456 * @since 8 457 * @deprecated since 9 458 * @useinstead ohos.geoLocationManager/geoLocationManager.SatelliteStatusInfo 459 */ 460 export interface SatelliteStatusInfo { 461 satellitesNumber: number; 462 satelliteIds: Array<number>; 463 carrierToNoiseDensitys: Array<number>; 464 altitudes: Array<number>; 465 azimuths: Array<number>; 466 carrierFrequencies: Array<number>; 467 } 468 469 /** 470 * Parameters for requesting to report cache location information 471 * 472 * @interface CachedGnssLocationsRequest 473 * @permission ohos.permission.LOCATION 474 * @syscap SystemCapability.Location.Location.Gnss 475 * @since 8 476 * @deprecated since 9 477 * @useinstead ohos.geoLocationManager/geoLocationManager.CachedGnssLocationsRequest 478 */ 479 export interface CachedGnssLocationsRequest { 480 reportingPeriodSec: number; 481 wakeUpCacheQueueFull: boolean; 482 } 483 484 /** 485 * Configuring parameters in geo fence requests 486 * 487 * @interface GeofenceRequest 488 * @permission ohos.permission.LOCATION 489 * @syscap SystemCapability.Location.Location.Geofence 490 * @since 8 491 * @deprecated since 9 492 * @useinstead ohos.geoLocationManager/geoLocationManager.GeofenceRequest 493 */ 494 export interface GeofenceRequest { 495 priority: LocationRequestPriority; 496 scenario: LocationRequestScenario; 497 geofence: Geofence; 498 } 499 500 /** 501 * Configuring parameters in geo fence requests 502 * 503 * @interface Geofence 504 * @permission ohos.permission.LOCATION 505 * @syscap SystemCapability.Location.Location.Geofence 506 * @since 8 507 * @deprecated since 9 508 * @useinstead ohos.geoLocationManager/geoLocationManager.Geofence 509 */ 510 export interface Geofence { 511 latitude: number; 512 longitude: number; 513 radius: number; 514 expiration: number; 515 } 516 517 /** 518 * Configuring parameters in reverse geocode requests 519 * 520 * @interface ReverseGeoCodeRequest 521 * @permission ohos.permission.LOCATION 522 * @syscap SystemCapability.Location.Location.Geocoder 523 * @since 7 524 * @deprecated since 9 525 * @useinstead ohos.geoLocationManager/geoLocationManager.ReverseGeoCodeRequest 526 */ 527 export interface ReverseGeoCodeRequest { 528 locale?: string; 529 latitude: number; 530 longitude: number; 531 maxItems?: number; 532 } 533 534 /** 535 * Configuring parameters in geocode requests 536 * 537 * @interface GeoCodeRequest 538 * @permission ohos.permission.LOCATION 539 * @syscap SystemCapability.Location.Location.Geocoder 540 * @since 7 541 * @deprecated since 9 542 * @useinstead ohos.geoLocationManager/geoLocationManager.GeoCodeRequest 543 */ 544 export interface GeoCodeRequest { 545 locale?: string; 546 description: string; 547 maxItems?: number; 548 minLatitude?: number; 549 minLongitude?: number; 550 maxLatitude?: number; 551 maxLongitude?: number; 552 } 553 554 /** 555 * Data struct describes geographic locations. 556 * 557 * @interface GeoAddress 558 * @permission ohos.permission.LOCATION 559 * @syscap SystemCapability.Location.Location.Geocoder 560 * @since 7 561 * @deprecated since 9 562 * @useinstead ohos.geoLocationManager/geoLocationManager.GeoAddress 563 */ 564 export interface GeoAddress { 565 /** 566 * Indicates latitude information. 567 * A positive value indicates north latitude, 568 * and a negative value indicates south latitude. 569 * 570 * @permission ohos.permission.LOCATION 571 * @syscap SystemCapability.Location.Location.Geocoder 572 * @since 7 573 * @deprecated since 9 574 */ 575 latitude?: number; 576 577 /** 578 * Indicates longitude information. 579 * A positive value indicates east longitude , 580 * and a negative value indicates west longitude . 581 * 582 * @permission ohos.permission.LOCATION 583 * @syscap SystemCapability.Location.Location.Geocoder 584 * @since 7 585 * @deprecated since 9 586 */ 587 longitude?: number; 588 589 /** 590 * Indicates language used for the location description. 591 * zh indicates Chinese, and en indicates English. 592 * 593 * @permission ohos.permission.LOCATION 594 * @syscap SystemCapability.Location.Location.Geocoder 595 * @since 7 596 * @deprecated since 9 597 */ 598 locale?: string; 599 600 /** 601 * Indicates landmark of the location. 602 * 603 * @permission ohos.permission.LOCATION 604 * @syscap SystemCapability.Location.Location.Geocoder 605 * @since 7 606 * @deprecated since 9 607 */ 608 placeName?: string; 609 610 /** 611 * Indicates country code. 612 * 613 * @permission ohos.permission.LOCATION 614 * @syscap SystemCapability.Location.Location.Geocoder 615 * @since 7 616 * @deprecated since 9 617 */ 618 countryCode?: string; 619 620 /** 621 * Indicates country name. 622 * 623 * @permission ohos.permission.LOCATION 624 * @syscap SystemCapability.Location.Location.Geocoder 625 * @since 7 626 * @deprecated since 9 627 */ 628 countryName?: string; 629 630 /** 631 * Indicates administrative region name. 632 * 633 * @permission ohos.permission.LOCATION 634 * @syscap SystemCapability.Location.Location.Geocoder 635 * @since 7 636 * @deprecated since 9 637 */ 638 administrativeArea?: string; 639 640 /** 641 * Indicates sub-administrative region name. 642 * 643 * @permission ohos.permission.LOCATION 644 * @syscap SystemCapability.Location.Location.Geocoder 645 * @since 7 646 * @deprecated since 9 647 */ 648 subAdministrativeArea?: string; 649 650 /** 651 * Indicates locality information. 652 * 653 * @permission ohos.permission.LOCATION 654 * @syscap SystemCapability.Location.Location.Geocoder 655 * @since 7 656 * @deprecated since 9 657 */ 658 locality?: string; 659 660 /** 661 * Indicates sub-locality information. 662 * 663 * @permission ohos.permission.LOCATION 664 * @syscap SystemCapability.Location.Location.Geocoder 665 * @since 7 666 * @deprecated since 9 667 */ 668 subLocality?: string; 669 670 /** 671 * Indicates road name. 672 * 673 * @permission ohos.permission.LOCATION 674 * @syscap SystemCapability.Location.Location.Geocoder 675 * @since 7 676 * @deprecated since 9 677 */ 678 roadName?: string; 679 680 /** 681 * Indicates auxiliary road information. 682 * 683 * @permission ohos.permission.LOCATION 684 * @syscap SystemCapability.Location.Location.Geocoder 685 * @since 7 686 * @deprecated since 9 687 */ 688 subRoadName?: string; 689 690 /** 691 * Indicates house information. 692 * 693 * @permission ohos.permission.LOCATION 694 * @syscap SystemCapability.Location.Location.Geocoder 695 * @since 7 696 * @deprecated since 9 697 */ 698 premises?: string; 699 700 /** 701 * Indicates postal code. 702 * 703 * @permission ohos.permission.LOCATION 704 * @syscap SystemCapability.Location.Location.Geocoder 705 * @since 7 706 * @deprecated since 9 707 */ 708 postalCode?: string; 709 710 /** 711 * Indicates phone number. 712 * 713 * @permission ohos.permission.LOCATION 714 * @syscap SystemCapability.Location.Location.Geocoder 715 * @since 7 716 * @deprecated since 9 717 */ 718 phoneNumber?: string; 719 720 /** 721 * Indicates website URL. 722 * 723 * @permission ohos.permission.LOCATION 724 * @syscap SystemCapability.Location.Location.Geocoder 725 * @since 7 726 * @deprecated since 9 727 */ 728 addressUrl?: string; 729 730 /** 731 * Indicates additional information. 732 * 733 * @permission ohos.permission.LOCATION 734 * @syscap SystemCapability.Location.Location.Geocoder 735 * @since 7 736 * @deprecated since 9 737 */ 738 descriptions?: Array<string>; 739 740 /** 741 * Indicates the amount of additional descriptive information. 742 * 743 * @permission ohos.permission.LOCATION 744 * @syscap SystemCapability.Location.Location.Geocoder 745 * @since 7 746 * @deprecated since 9 747 */ 748 descriptionsSize?: number; 749 } 750 751 /** 752 * Configuring parameters in location requests 753 * 754 * @interface LocationRequest 755 * @permission ohos.permission.LOCATION 756 * @syscap SystemCapability.Location.Location.Core 757 * @since 7 758 * @deprecated since 9 759 * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequest 760 */ 761 export interface LocationRequest { 762 priority?: LocationRequestPriority; 763 scenario?: LocationRequestScenario; 764 timeInterval?: number; 765 distanceInterval?: number; 766 maxAccuracy?: number; 767 } 768 769 /** 770 * Configuring parameters in current location requests 771 * 772 * @interface CurrentLocationRequest 773 * @permission ohos.permission.LOCATION 774 * @syscap SystemCapability.Location.Location.Core 775 * @since 7 776 * @deprecated since 9 777 * @useinstead ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest 778 */ 779 export interface CurrentLocationRequest { 780 priority?: LocationRequestPriority; 781 scenario?: LocationRequestScenario; 782 maxAccuracy?: number; 783 timeoutMs?: number; 784 } 785 786 /** 787 * Provides information about geographic locations 788 * 789 * @interface Location 790 * @permission ohos.permission.LOCATION 791 * @syscap SystemCapability.Location.Location.Core 792 * @since 7 793 * @deprecated since 9 794 * @useinstead ohos.geoLocationManager/geoLocationManager.Location 795 */ 796 export interface Location { 797 /** 798 * Indicates latitude information. 799 * A positive value indicates north latitude, 800 * and a negative value indicates south latitude. 801 * 802 * @permission ohos.permission.LOCATION 803 * @syscap SystemCapability.Location.Location.Core 804 * @since 7 805 * @deprecated since 9 806 */ 807 latitude: number; 808 809 /** 810 * Indicates Longitude information. 811 * A positive value indicates east longitude , 812 * and a negative value indicates west longitude . 813 * 814 * @permission ohos.permission.LOCATION 815 * @syscap SystemCapability.Location.Location.Core 816 * @since 7 817 * @deprecated since 9 818 */ 819 longitude: number; 820 821 /** 822 * Indicates location altitude, in meters. 823 * 824 * @permission ohos.permission.LOCATION 825 * @syscap SystemCapability.Location.Location.Core 826 * @since 7 827 * @deprecated since 9 828 */ 829 altitude: number; 830 831 /** 832 * Indicates location accuracy, in meters. 833 * 834 * @permission ohos.permission.LOCATION 835 * @syscap SystemCapability.Location.Location.Core 836 * @since 7 837 * @deprecated since 9 838 */ 839 accuracy: number; 840 841 /** 842 * Indicates speed, in m/s. 843 * 844 * @permission ohos.permission.LOCATION 845 * @syscap SystemCapability.Location.Location.Core 846 * @since 7 847 * @deprecated since 9 848 */ 849 speed: number; 850 851 /** 852 * Indicates location timestamp in the UTC format. 853 * 854 * @permission ohos.permission.LOCATION 855 * @syscap SystemCapability.Location.Location.Core 856 * @since 7 857 * @deprecated since 9 858 */ 859 timeStamp: number; 860 861 /** 862 * Indicates direction information. 863 * 864 * @permission ohos.permission.LOCATION 865 * @syscap SystemCapability.Location.Location.Core 866 * @since 7 867 * @deprecated since 9 868 */ 869 direction: number; 870 871 /** 872 * Indicates location timestamp since boot. 873 * 874 * @permission ohos.permission.LOCATION 875 * @syscap SystemCapability.Location.Location.Core 876 * @since 7 877 * @deprecated since 9 878 */ 879 timeSinceBoot: number; 880 881 /** 882 * Indicates additional information. 883 * 884 * @permission ohos.permission.LOCATION 885 * @syscap SystemCapability.Location.Location.Core 886 * @since 7 887 * @deprecated since 9 888 */ 889 additions?: Array<string>; 890 891 /** 892 * Indicates the amount of additional descriptive information. 893 * 894 * @permission ohos.permission.LOCATION 895 * @syscap SystemCapability.Location.Location.Core 896 * @since 7 897 * @deprecated since 9 898 */ 899 additionSize?: number; 900 } 901 902 /** 903 * Enum for location priority 904 * 905 * @permission ohos.permission.LOCATION 906 * @enum { number } 907 * @syscap SystemCapability.Location.Location.Core 908 * @since 7 909 * @deprecated since 9 910 * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestPriority 911 */ 912 export enum LocationRequestPriority { 913 UNSET = 0x200, 914 ACCURACY, 915 LOW_POWER, 916 FIRST_FIX 917 } 918 919 /** 920 * Enum for location scenario 921 * 922 * @permission ohos.permission.LOCATION 923 * @enum { number } 924 * @syscap SystemCapability.Location.Location.Core 925 * @since 7 926 * @deprecated since 9 927 * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestScenario 928 */ 929 export enum LocationRequestScenario { 930 UNSET = 0x300, 931 NAVIGATION, 932 TRAJECTORY_TRACKING, 933 CAR_HAILING, 934 DAILY_LIFE_SERVICE, 935 NO_POWER 936 } 937 938 /** 939 * Enum for error code 940 * 941 * @permission ohos.permission.LOCATION 942 * @enum { number } 943 * @syscap SystemCapability.Location.Location.Core 944 * @since 7 945 * @deprecated since 9 946 */ 947 export enum GeoLocationErrorCode { 948 /** 949 * Indicates input parameter error. 950 * 951 * @permission ohos.permission.LOCATION 952 * @syscap SystemCapability.Location.Location.Core 953 * @since 7 954 * @deprecated since 9 955 */ 956 INPUT_PARAMS_ERROR, 957 958 /** 959 * Indicates reverse geocode query failed. 960 * 961 * @permission ohos.permission.LOCATION 962 * @syscap SystemCapability.Location.Location.Core 963 * @since 7 964 * @deprecated since 9 965 */ 966 REVERSE_GEOCODE_ERROR, 967 968 /** 969 * Indicates geocode query failed. 970 * 971 * @permission ohos.permission.LOCATION 972 * @syscap SystemCapability.Location.Location.Core 973 * @since 7 974 * @deprecated since 9 975 */ 976 GEOCODE_ERROR, 977 978 /** 979 * Indicates positioning failed. 980 * 981 * @permission ohos.permission.LOCATION 982 * @syscap SystemCapability.Location.Location.Core 983 * @since 7 984 * @deprecated since 9 985 */ 986 LOCATOR_ERROR, 987 988 /** 989 * Indicates operation failure caused by abnormal location switch. 990 * 991 * @permission ohos.permission.LOCATION 992 * @syscap SystemCapability.Location.Location.Core 993 * @since 7 994 * @deprecated since 9 995 */ 996 LOCATION_SWITCH_ERROR, 997 998 /** 999 * Indicates failed to get the last known location. 1000 * 1001 * @permission ohos.permission.LOCATION 1002 * @syscap SystemCapability.Location.Location.Core 1003 * @since 7 1004 * @deprecated since 9 1005 */ 1006 LAST_KNOWN_LOCATION_ERROR, 1007 1008 /** 1009 * Indicates location request timeout. 1010 * 1011 * @permission ohos.permission.LOCATION 1012 * @syscap SystemCapability.Location.Location.Core 1013 * @since 7 1014 * @deprecated since 9 1015 */ 1016 LOCATION_REQUEST_TIMEOUT_ERROR 1017 } 1018 1019 /** 1020 * Enum for location privacy type 1021 * 1022 * @permission ohos.permission.LOCATION 1023 * @enum { number } 1024 * @syscap SystemCapability.Location.Location.Core 1025 * @since 8 1026 * @deprecated since 9 1027 * @useinstead ohos.geoLocationManager/geoLocationManager.LocationPrivacyType 1028 */ 1029 export enum LocationPrivacyType { 1030 OTHERS = 0, 1031 STARTUP, 1032 CORE_LOCATION 1033 } 1034 1035 /** 1036 * Location subsystem command structure 1037 * 1038 * @interface LocationCommand 1039 * @permission ohos.permission.LOCATION 1040 * @syscap SystemCapability.Location.Location.Core 1041 * @since 8 1042 * @deprecated since 9 1043 * @useinstead ohos.geoLocationManager/geoLocationManager.LocationCommand 1044 */ 1045 export interface LocationCommand { 1046 scenario: LocationRequestScenario; 1047 command: string; 1048 } 1049} 1050 1051export default geolocation; 1052