BBASMPlugin+Motion.h 5.1 KB
//
//  BBASMPlugin+Motion.h
//  SWAN
//
//  Created by baidu on 2018/4/23.
//  Copyright © 2018年 baidu. All rights reserved.
//

#import "BBASMPlugin.h"

@interface BBASMPlugin (Motion)

/**
 * 描  述: 小程序框架开始监听加速度数据
 * 示  例: baiduboxapp://swanAPI/startAccelerometer?params={"cb":"cb"}&callback=_bdbox_js_186&upgrade=0
 * 文  档: http://ft.baidu.com/#/scheme/swan_startaccelerometer
 * 备  注:
 * ********** description ************
 * @name:      startAccelerometer
 * @authority: swanAPI
 * @path:      /startAccelerometer
 * @args:      [{"name": "interval", "value": "string="}, {"name": "cb", "value": "string"}, {"name": "useEvent", "value": "boolean="}]
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.json", "method": "_naSwan.bridge.deviceBridge.startAccelerometer"}}}
 */
- (void)startAccelerometer:(BBASchemeDispatcher *)dispatcher;

/**
 * 描  述: 停止监听加速度数据
 * 示  例: baiduboxapp://swanAPI/stopAccelerometer?callback=_bdbox_js_186&upgrade=0
 * 文  档: http://ft.baidu.com/#/scheme/swan_stopaccelerometer
 * 备  注:
 * ********** description ************
 * @name:      stopAccelerometer
 * @authority: swanAPI
 * @path:      /stopAccelerometer
 * @args:      []
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.json", "method": "_naSwan.bridge.deviceBridge.stopAccelerometer"}}}
 */
- (void)stopAccelerometer:(BBASchemeDispatcher *)dispatcher;

/**
 * 描  述: 开始监听设备方向数据
 * 示  例: baiduboxapp://swanAPI/startDeviceMotion?params={"cb":"cb","interval":"normal"}&callback=_bdbox_js_186&upgrade=0
 * 文  档: http://ft.baidu.com/#/scheme/swan_startdevicemotion
 * 备  注:
 * ********** description ************
 * @name:      startDeviceMotionListening
 * @authority: swanAPI
 * @path:      /startDeviceMotion
 * @args:      [{"name": "interval", "value": "string="}, {"name": "cb", "value": "string"}, {"name": "useEvent", "value": "boolean="}]
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.url", "method": "_naSwan.bridge.postMessage"}}}
 */
- (void)startDeviceMotion:(BBASchemeDispatcher *)dispatcher;

/**
 * 描  述: 停止监听设备方向数据
 * 示  例: baiduboxapp://swanAPI/stopDeviceMotion?callback=_bdbox_js_186&upgrade=0
 * 文  档: http://ft.baidu.com/#/scheme/swan_stopdevicemotion
 * 备  注:
 * ********** description ************
 * @name:      stopDeviceMotionListening
 * @authority: swanAPI
 * @path:      /stopDeviceMotion
 * @args:      []
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.url", "method": "_naSwan.bridge.postMessage"}}}
 */
- (void)stopDeviceMotion:(BBASchemeDispatcher *)dispatcher;

/**
 * 描  述: 开启监听键盘高度变化
 * 示  例: baiduboxapp://swanAPI/startKeyboardHeightChange?callback=_bdbox_js_186&upgrade=0
 * 文  档: http://es.baidu-int.com/index#/apidetail/1298
 * 备  注:
 * ********** description ************
 * @name:      startKeyboardHeightChange
 * @authority: swanAPI
 * @path:      /startKeyboardHeightChange
 * @args:      []
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.json", "method": "_naSwan.bridge.deviceBridge.startKeyboardHeightChange"}}}
 */
- (void)startKeyboardHeightChange:(BBASchemeDispatcher *)dispatcher;

/**
 * 描  述: 取消监听键盘高度变化
 * 示  例: baiduboxapp://swanAPI/stopKeyboardHeightChange?callback=_bdbox_js_186&upgrade=0
 * 文  档: http://es.baidu-int.com/index#/apidetail/1301
 * 备  注:
 * ********** description ************
 * @name:      stopKeyboardHeightChange
 * @authority: swanAPI
 * @path:      /stopKeyboardHeightChange
 * @args:      []
 * @config:    {"swan": {"web": {"invoke": "swan.message.url", "handler": "bridge"}, "jsc": {"invoke": "swan.method.json", "method": "_naSwan.bridge.deviceBridge.stopKeyboardHeightChange"}}}
 */
- (void)stopKeyboardHeightChange:(BBASchemeDispatcher *)dispatcher;

/**
 * @brief 监听加速度数据
 * @param params 端能力参数
 * @param appId 调起的appId
 * @param action 端能力名称
 * @param completion 调能力调用block
 * @return NSDictionary 端能力调用结果
 */
+ (NSDictionary *)startAccelerometerWithParams:(NSDictionary *)params
                                         appId:(NSString *)appId
                                        action:(NSString *)action
                                    completion:(void (^)(NSDictionary *status))completion;

/**
 * @brief 停止监听加速度数据
 * @param action 端能力名称
 * @param appId 调起的appId
 * @return NSDictionary 端能力调用结果
 */
+ (NSDictionary *)stopAccelerometerWithAction:(NSString *)action appId:(NSString *)appId;


/// 开启监听键盘高度变化
/// @param appId appId
+ (NSDictionary *)startKeyboardHeightChangeWithAppId:(NSString *)appId;

/// 取消监听键盘高度变化
/// @param appId appId
+ (NSDictionary *)stopKeyboardHeightChangeWithAppId:(NSString *)appId;

@end