harmony 鸿蒙oh_location_type.h

  • 2025-06-12
  • 浏览 (4)

oh_location_type.h

Overview

Defines common attributes of the location service.

\@kit LocationKit

Library: libohlocation.so

System capability: SystemCapability.Location.Location.Core

Since: 13

Related module: Location

Summary

Structs

Name Description
struct  Location_BasicInfo Defines the struct for the basic location information.

Types

Name Description
typedef enum Location_ResultCode Location_ResultCode Enumerates error codes of the location service.
typedef enum Location_UseScene Location_UseScene Enumerates use scenes in a location request.
typedef enum Location_PowerConsumptionScene Location_PowerConsumptionScene Enumerates power consumption scenarios in a location request.
typedef enum Location_SourceType Location_SourceType Defines the source of location information.
typedef struct Location_BasicInfo Location_BasicInfo Defines the struct for the basic location information.
typedef struct Location_Info Location_Info Defines the struct for the location information.
typedef void(* Location_InfoCallback) (Location_Info *location, void *userData) Defines the callback for receiving reported location information.
typedef struct Location_RequestConfig Location_RequestConfig Defines the struct for the location request configuration.

Enums

Name Description
Location_ResultCode {
LOCATION_SUCCESS = 0, LOCATION_PERMISSION_DENIED = 201, LOCATION_INVALID_PARAM = 401, LOCATION_NOT_SUPPORTED = 801,
LOCATION_SERVICE_UNAVAILABLE = 3301000, LOCATION_SWITCH_OFF = 3301100
}
Enumerates error codes of the location service.
Location_UseScene { LOCATION_USE_SCENE_NAVIGATION = 0x0401, LOCATION_USE_SCENE_SPORT = 0x0402, LOCATION_USE_SCENE_TRANSPORT = 0x0403, LOCATION_USE_SCENE_DAILY_LIFE_SERVICE = 0x0404 } Enumerates use scenes in a location request.
Location_PowerConsumptionScene { LOCATION_HIGH_POWER_CONSUMPTION = 0x0601, LOCATION_LOW_POWER_CONSUMPTION = 0x0602, LOCATION_NO_POWER_CONSUMPTION = 0x0603 } Enumerates power consumption scenarios in a location request.
Location_SourceType { LOCATION_SOURCE_TYPE_GNSS = 1, LOCATION_SOURCE_TYPE_NETWORK = 2, LOCATION_SOURCE_TYPE_INDOOR = 3, LOCATION_SOURCE_TYPE_RTK = 4 } Defines the source of location information.

Functions

Name Description
Location_BasicInfo OH_LocationInfo_GetBasicInfo (Location_Info *location) Obtains basic location information.
Location_ResultCode OH_LocationInfo_GetAdditionalInfo (Location_Info *location, char *additionalInfo, uint32_t length) Obtains the additional information in the location information.
Location_RequestConfig * OH_Location_CreateRequestConfig (void) Creates a Location_RequestConfig instance.
void OH_Location_DestroyRequestConfig (Location_RequestConfig *requestConfig) Destroys the Location_RequestConfig instance and reclaims the memory.
void OH_LocationRequestConfig_SetUseScene (Location_RequestConfig *requestConfig, Location_UseScene useScene) Sets the use scene in the location request configuration.
useScene takes precedence over powerConsumptionScene in Location_RequestConfig.
If useScene is set, powerConsumptionScene is invalid.
Otherwise, powerConsumptionScene takes effect.
If neither of the two parameters is set, useScene is set to LOCATION_USE_SCENE_DAILY_LIFE_SERVICE by default,
and powerConsumptionScene is invalid.
void OH_LocationRequestConfig_SetPowerConsumptionScene (Location_RequestConfig *requestConfig, Location_PowerConsumptionScene powerConsumptionScene) Sets the power consumption scene in the location request configuration.
void OH_LocationRequestConfig_SetInterval (Location_RequestConfig *requestConfig, int interval) Sets the location reporting interval in the location request configuration.
void OH_LocationRequestConfig_SetCallback (Location_RequestConfig *requestConfig, Location_InfoCallback callback, void *userData) Sets the callback function.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Location Kit

harmony 鸿蒙Location

harmony 鸿蒙Location_BasicInfo

harmony 鸿蒙Location Kit Error Codes

harmony 鸿蒙@ohos.app.ability.FenceExtensionAbility (FenceExtensionAbility)

harmony 鸿蒙@ohos.app.ability.FenceExtensionContext (FenceExtensionContext) (System API)

harmony 鸿蒙@ohos.app.ability.FenceExtensionContext (FenceExtensionContext)

harmony 鸿蒙@ohos.geoLocationManager (Geolocation Manager) (System API)

harmony 鸿蒙@ohos.geoLocationManager (Geolocation Manager)

harmony 鸿蒙@ohos.geolocation (Geolocation)

0  赞