BMKRadarManager.h 2.87 KB
Newer Older
曹云霄's avatar
曹云霄 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
//
//  BMKRadarManager.h
//  RadarComponent
//
//  Created by wzy on 15/4/22.
//  Copyright (c) 2015年 baidu. All rights reserved.
//

#ifndef RadarComponent_BMKRadarManager_h
#define RadarComponent_BMKRadarManager_h

#import "BMKRadarOption.h"
#import "BMKRadarResult.h"

///雷达delegate
@protocol BMKRadarManagerDelegate <NSObject>

@optional
/*
 *开启自动上传,需实现该回调
 */
- (BMKRadarUploadInfo*)getRadarAutoUploadInfo;

/**
 *返回雷达 上传结果
 *@param error 错误号,@see BMKRadarErrorCode
 */
- (void)onGetRadarUploadResult:(BMKRadarErrorCode) error;

/**
 *返回雷达 清除我的信息结果
 *@param error 错误号,@see BMKRadarErrorCode
 */
- (void)onGetRadarClearMyInfoResult:(BMKRadarErrorCode) error;

/**
 *返回雷达 查询周边的用户信息结果
 *@param result 结果,类型为@see BMKRadarNearbyResult
 *@param error 错误号,@see BMKRadarErrorCode
 */
- (void)onGetRadarNearbySearchResult:(BMKRadarNearbyResult*) result error:(BMKRadarErrorCode) error;

@end


///周边雷达管理类
@interface BMKRadarManager : NSObject

/// 上传时用,上传前需设置,不设置自动生成userId;切换用户时,需手动清除原先用户的位置信息
@property (nonatomic, strong) NSString* userId;

/**
 *获取周边雷达实例,使用引用计数管理该实例内存
 */
+ (BMKRadarManager*)getRadarManagerInstance;
/**
 *release周边雷达实例,使用引用计数管理该实例内存
 */
+ (void)releaseRadarManagerInstance;

/**
 *添加周边雷达delegate,用于结果回调
 *不需要时,需要使用removeRadarManagerDelegate:移除,否则影响内存释放
 *@param delegate,  添加的id<BMKRadarManagerDelegate>对象
 */
- (void)addRadarManagerDelegate:(id<BMKRadarManagerDelegate>) delegate;

/**
 *移除周边雷达delegate,取消结果回调
 *@param delegate,  需要移除的id<BMKRadarManagerDelegate>对象
 */
- (void)removeRadarManagerDelegate:(id<BMKRadarManagerDelegate>) delegate;

/**
 *启动自动上传用户位置信息
 *必须实现回调方法@see getRadarAutoUploadInfo,获取@see BMKRadarUploadInfo
 *@param interval 时间间隔,不小于5s(小于强制设为5s)
 */
- (void)startAutoUpload:(NSTimeInterval) interval;

/**
 *停止自动上传用户位置信息
 */
- (void)stopAutoUpload;

/**
 *单次上传用户位置信息
 *上传时间间隔不小于5s,否则return NO
 *返回结果回调:@see onGetRadarUploadResult:
 *@param info 位置信息
 */
- (BOOL)uploadInfoRequest:(BMKRadarUploadInfo*) info;

/**
 *清除我的位置信息
 *返回结果回调:@see onGetRadarClearMyInfoResult:
 */
- (BOOL)clearMyInfoRequest;

/**
 *查询周边的用户信息
 *返回结果回调:@see onGetRadarNearbySearchResult:error:
 *@param option 查询参数: 类型为@see BMKRadarNearbySearchOption
 */
- (BOOL)getRadarNearbySearchRequest:(BMKRadarNearbySearchOption*) option;


@end


#endif