Files
tianrunCRM/Assets/3rd/LBSBaidu/Plugins/iOS/BMKLocationKit.framework/Headers/BMKLocationManager.h

254 lines
11 KiB
C
Raw Normal View History

2020-07-04 14:41:25 +08:00
//
// BMKLocationManager.h
// BMKLocationKit
//
// Created by baidu on 2017/3/2.
// Copyright © 2017年 baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "BMKLocationReGeocode.h"
#import "BMKLocation.h"
/** BMKLocationCoordinateType 枚举坐标系类型
*
*/
typedef NS_ENUM(NSUInteger, BMKLocationCoordinateType)
{
BMKLocationCoordinateTypeBMK09LL = 0, ///<BMK09LL
BMKLocationCoordinateTypeBMK09MC, ///<BMK09MC
BMKLocationCoordinateTypeWGS84, ///<WGS84
BMKLocationCoordinateTypeGCJ02 ///<GCJ02
};
/** BMKLocationNetworkState 枚举识别网络状态类型
*
*/
typedef NS_ENUM(int, BMKLocationNetworkState) {
BMKLocationNetworkStateUnknown = 0, ///<网络状态未知
BMKLocationNetworkStateWifi, ///<网络状态wifi
BMKLocationNetworkStateWifiHotSpot, ///<网络状态连接WIFI移动热点
BMKLocationNetworkStateMobile2G, ///<网络状态移动2G
BMKLocationNetworkStateMobile3G, ///<网络状态移动3G
BMKLocationNetworkStateMobile4G ///<网络状态移动4G
};
///BMKLocation errorDomain
FOUNDATION_EXPORT NSErrorDomain const _Nonnull BMKLocationErrorDomain;
///BMKLocation errorCode
typedef NS_ENUM(NSInteger, BMKLocationErrorCode)
{
BMKLocationErrorUnKnown = 0, ///<未知异常
BMKLocationErrorLocFailed = 1, ///<位置未知,持续定位中
BMKLocationErrorDenied = 2, ///<手机不允许定位,请确认用户授予定位权限或者手机是否打开定位开关
BMKLocationErrorNetWork = 3, ///<因为网络原因导致系统定位失败
BMKLocationErrorHeadingFailed = 4, ///<获取手机方向信息失败
BMKLocationErrorGetExtraNetworkFailed = 5, ///<网络原因导致获取额外信息(地址、网络状态等信息)失败
BMKLocationErrorGetExtraParseFailed = 6, ///<网络返回数据解析失败导致获取额外信息(地址、网络状态等信息)失败
BMKLocationErrorFailureAuth = 7, ///<鉴权失败导致无法返回定位、地址等信息
};
/**
* @brief Block
* @param location CLLocation BMKLocationReGeocode BMKLocation
* @param state
* @param error BMKLocationErrorCode
*/
typedef void (^BMKLocatingCompletionBlock)(BMKLocation * _Nullable location, BMKLocationNetworkState state , NSError * _Nullable error);
@protocol BMKLocationManagerDelegate;
#pragma mark - BMKLocationManager
///BMKLocationManager类。初始化之前请设置 BMKLocationAuth 中的APIKey否则将无法正常使用服务.
@interface BMKLocationManager : NSObject
///实现了 BMKLocationManagerDelegate 协议的类指针。
@property (nonatomic, weak, nullable) id<BMKLocationManagerDelegate> delegate;
///设定定位的最小更新距离。默认为 kCLDistanceFilterNone。
@property(nonatomic, assign) CLLocationDistance distanceFilter;
///设定定位精度。默认为 kCLLocationAccuracyBest。
@property(nonatomic, assign) CLLocationAccuracy desiredAccuracy;
///设定定位类型。默认为 CLActivityTypeAutomotiveNavigation。
@property(nonatomic, assign) CLActivityType activityType;
///设定定位坐标系类型。默认为 BMKLocationCoordinateTypeGCJ02。
@property(nonatomic, assign) BMKLocationCoordinateType coordinateType;
///指定定位是否会被系统自动暂停。默认为NO。
@property(nonatomic, assign) BOOL pausesLocationUpdatesAutomatically;
///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态否则会抛出异常。由于iOS系统限制需要在定位未开始之前或定位停止之后修改该属性的值才会有效果。
@property(nonatomic, assign) BOOL allowsBackgroundLocationUpdates;
///指定单次定位超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。注意: 单次定位超时时间从确定了定位权限(非kCLAuthorizationStatusNotDetermined状态)后开始计算。
@property(nonatomic, assign) NSInteger locationTimeout;
///指定单次定位逆地理超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。
@property(nonatomic, assign) NSInteger reGeocodeTimeout;
///连续定位是否返回逆地理信息默认YES。
@property (nonatomic, assign) BOOL locatingWithReGeocode;
///定位sdk-v1.3之后开发者可以选择是否需要最新版本rgc数据默认是不需要NOYES的情况下定位sdk会实时返回最新的rgc数据如城市变更等数据都会实时更新
@property (nonatomic, assign) BOOL isNeedNewVersionReGeocode;
///开发者可以指定该用户的id用于后续统一识别用户便于查找问题
@property(nonatomic, copy, nullable) NSString * userID;
/**
* @brief NO\n该方法将会根据设定的 desiredAccuracy desiredAccuracy completionBlock返回精度最高的定位信息\n可以通过 stopUpdatingLocation
* @param withReGeocode ()
* @param withNetWorkState ()
* @param completionBlock Block
* @return Request
*/
- (BOOL)requestLocationWithReGeocode:(BOOL)withReGeocode withNetworkState:(BOOL)withNetWorkState completionBlock:(BMKLocatingCompletionBlock _Nonnull)completionBlock;
/**
* @brief cancel掉所有的单次定位请求
*/
- (void)startUpdatingLocation;
/**
* @brief cancel掉所有的单次定位请求
*/
- (void)stopUpdatingLocation;
/**
* @brief
*/
- (void)requestNetworkState;
/**
* @brief
* @return
*/
+ (BOOL)headingAvailable;
/**
* @brief BMKLocationManager开始设备朝向事件回调
*/
- (void)startUpdatingHeading;
/**
* @brief BMKLocationManager停止设备朝向事件回调
*/
- (void)stopUpdatingHeading;
/**
* @brief BMKLocationManager尝试使用高精度室内定位
*/
- (void)tryIndoorLocation;
/**
* @brief BMKLocationManager会关闭高精度室内定位
*/
- (void)stopIndoorLocation;
/**
* @brief
* @param coordinate
* @param srctype
* @param destype bd09ll,bd09mc
* @return
*/
+ (CLLocationCoordinate2D) BMKLocationCoordinateConvert:(CLLocationCoordinate2D) coordinate SrcType:(BMKLocationCoordinateType)srctype DesType:(BMKLocationCoordinateType)destype;
/**
* @brief
* @param coordinate
* @param coortype
* @return
*/
+ (BOOL) BMKLocationDataAvailableForCoordinate:(CLLocationCoordinate2D)coordinate withCoorType:(BMKLocationCoordinateType)coortype;
@end
#pragma mark - BMKLocationManagerDelegate
///BMKLocationManagerDelegate 协议定义了发生错误时的错误回调方法,连续定位的回调方法等。
@protocol BMKLocationManagerDelegate <NSObject>
@optional
/**
* @brief app store关于新的后台定位的审核机制app store要求如果开发者只配置了使用期间定位plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription时delegate中调用后台定位api[locationManager requestAlwaysAuthorization]NSLocationWhenInUseUsageDescription使delegate中实现逻辑
* @param manager BMKLocationManager
* @param locationManager CLLocationManager
* @since 1.6.0
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager;
/**
* @brief
* @param manager BMKLocationManager
* @param error CLError
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didFailWithError:(NSError * _Nullable)error;
/**
* @brief
* @param manager BMKLocationManager
* @param location BMKLocation
* @param error
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didUpdateLocation:(BMKLocation * _Nullable)location orError:(NSError * _Nullable)error;
/**
* @brief
* @param manager BMKLocationManager
* @param status
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
/**
* @brief BMKLocationManager提示需要设备校正回调方法
* @param manager BMKLocationManager类的实例
*/
- (BOOL)BMKLocationManagerShouldDisplayHeadingCalibration:(BMKLocationManager * _Nonnull)manager;
/**
* @brief BMKLocationManager提供设备朝向的回调方法
* @param manager BMKLocationManager类的实例
* @param heading
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager
didUpdateHeading:(CLHeading * _Nullable)heading;
/**
* @brief BMKLocationManager所在App系统网络状态改变的回调事件
* @param manager BMKLocationManager类的实例
* @param state
* @param error
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager
didUpdateNetworkState:(BMKLocationNetworkState)state orError:(NSError * _Nullable)error;
@end