BBASMPlugin+location.h 2.82 KB
//
//  BBASMPlugin+location.h
//  SWAN
//
//  Created by baidu on 06/12/2017.
//  Copyright © 2017 baidu. All rights reserved.
//

#import "BBASMPlugin.h"

#define BBASMLocationModule @"mnp_location"

UIKIT_EXTERN NSString *const BBASMEventLocationChange;                // 定位回调数据事件名

@interface BBASMPlugin (location)

/**
 * 描  述: 获取地理位置
 * 示  例: baiduboxapp://swanAPI/getLocation?params={"type":"wgs84","altitude":true,"cb":"_bdbox_pjs_577"}&callback=_bdbox_js_620&upgrade=0&oauthType=swan
 * 文  档: http://ft.baidu.com/#/scheme/swan_getlocation
 * 备  注:
 * ********** description ************
 * @name:      getLocation
 * @authority: swanAPI
 * @path:      /getLocation
 * @args:      [{"name": "type", "value": "string="}, {"name": "altitude", "value": "boolean="}, {"name": "cb", "value": "string"}, {"name": "needFullAccuracy", "value": "boolean="}]
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "webdegrade": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.url", "method": "_naSwan.bridge.postMessage"}}}
 */
- (void)getLocation:(BBASchemeDispatcher *)dispatcher;

/**
 * 描  述: 开启连续定位
 * 示  例: baiduboxapp://swanAPI/startLocationUpdate?params={"cb":"_bdbox_pjs_577"}
 * 文  档: http://es.baidu-int.com/#/apidetail/995
 * 备  注:
 * ********** description ************
 * @name:      startLocationUpdate
 * @authority: swanAPI
 * @path:      /startLocationUpdate
 * @args:      [{"name": "cb", "value": "string"}, {"name": "needFullAccuracy", "value": "boolean="}]
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "webdegrade": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.json", "method": "_naSwan.bridge.location.startLocationUpdate"}}}
 */
- (void)startLocationUpdate:(BBASchemeDispatcher *)dispatcher;

/**
 * 描  述:  关闭连续定位
 * 示  例: baiduboxapp://swanAPI/stopLocationUpdate?params={}
 * 文  档: http://es.baidu-int.com/#/apidetail/993
 * 备  注:
 * ********** description ************
 * @name:      stopLocationUpdate
 * @authority: swanAPI
 * @path:      /stopLocationUpdate
 * @args:      []
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "webdegrade": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.json", "method": "_naSwan.bridge.location.stopLocationUpdate"}}}
 */
- (void)stopLocationUpdate:(BBASchemeDispatcher *)dispatcher;

#pragma mark - JSBinding methods
+ (NSDictionary *)startLocationUpdateWithAppID:(NSString *)appID params:(NSDictionary *)params completion:(void (^)(NSDictionary *completionData))completion;
+ (NSDictionary *)stopLocationUpdateWithAppID:(NSString *)appID completion:(void (^)(NSDictionary *completionData))completion;

@end