介绍
Aerobic(S02) 的 BLE SDK。
SDK 提供以下主要功能:
- 扫描并连接 Aerobic Core。
- 查询 Aerobic 信息,例如电池/名称/SN 码/固件版本/硬件版本等。
- 重命名 Core。
- 开始/停止在线监测心率 breathing rate。
- 开始/停止/同步离线监测心率 breathing rate。
- 固件升级。
- 加载器升级。
- 自动重连 Aerobic Core。
Cocoa Pods
在 Podfile 中添加代码
pod 'BPBLESDK-S02-iOS'
或者
pod 'BPBLESDK-S02-iOS', :git => 'https://github.com/BodyPlusTechnology/BPBLESDK-S02-iOS.git'
发布说明
API 预览
在 BPBLEManagerS02.h
中
/**
Scan All S02 devices.
@param interval The time interval(Second) between twice updateHandler, recommend 2.0.
@param sortByRSSI If sort discovered devices by RSSI in updateHandler
@param updateHandler the callback block, contains all discovered deivces.
*/
- (void)scanAllDeviceS02WithUpdateInterval:(NSTimeInterval)interval
sortByRSSI:(BOOL)sortByRSSI
updateHandler:(void (^)(NSArray <BPBLEBaseDevice *> *devices))updateHandler;
/**
Scan and connect device with the SN.
@param deviceSN deviceSN
@param timeout timeout(Seconds), recommend 15.0
@param successHandler Connect successful will trigger this callback
@param failureHandler Timeout in this process will trigger this callback
*/
- (void)scanAndConnectDeviceS02WithSN:(NSString *)deviceSN
timeout:(NSTimeInterval)timeout
successHandler:(BPBLECommonSuccessHandler)successHandler
failureHandler:(BPBLECommonFailureHandler)failureHandler;
/**
During scan and connect process, using this method to cancel reconnect.
*/
- (void)cancelReconnecting;
/**
Connect device, it will trigger the delegate method.
@param device The device discover in scan callback handler.
*/
- (void)connectDevice:(BPBLEBaseDevice *)device
withTimeout:(NSTimeInterval)timeout
successHandler:(BPBLECommonSuccessHandler)successHandler
failureHandler:(BPBLECommonFailureHandler)failureHandler;
/**
Stop scanning devices.
*/
- (void)stopScanning;
/**
Disconnect current connected devices.
*/
- (void)disconnectCurrentDevice;
/*===============================================================
Device Firmware Upgrade - DFU
===============================================================*/
- (void)scanAndConnectDFUDeviceWithSN:(NSString *)deviceSN
timeout:(NSTimeInterval)timeout
callBackHandler:(BPBLEConnectDFUDeviceSuccessHandler)callBackHandler;
/**
Auto upgrade device boostloader and firmware, all of the params must be nonull.
@param device A device type of BPBaseDevice.
@param config Can use [BPS02DFUConfig defaultConfig].
@param stateChangedHandler The state in upgrade processing flow.
@param progressHandler progress callback.
@param successHandler Upgrade finish callback.
@param failureHandler ErrorCode, 1-device or config is nil/2-pacakge not found/3-unzip error/4-package content missing
*/
- (void)startUpgradeWithDevice:(BPBLEDeviceS02 *)device
config:(BPS02DFUConfig *)config
stateChangedHandler:(void(^)(UpgradeState state))stateChangedHandler
progressHandler:(void(^)(CGFloat progress))progressHandler
successHandler:(void(^)(BPBLEDeviceS02 *reconnectedDevice))successHandler
failureHandler:(void(^)(NSInteger errorCode, NSString *msg))failureHandler;
在 BPBLEDeviceS02.h
中
/**
Start monitoring
*/
- (void)startMonitorHRBR;
/**
Stop monitoring
*/
- (void)stopMonitorHRBR;
- (void)queryHardwareVersionWithCompletion:(void (^)(BOOL bSuccess, NSInteger version))completion;
- (void)queryFirmwareVersionWithCompletion:(void (^)(BOOL bSuccess, NSInteger version))completion;
- (void)queryBoostloaderVersionWithCompletion:(void (^)(BOOL bSuccess, NSInteger version))completion;
/**
Get core's current mode, in the callback block can read property isMonitoringHRBR/isOfflineMode.
@param completion callback block
*/
- (void)queryCoreModeWithCompletion:(void (^)(BOOL bSuccess, CoreS02MonitorMode mode))completion;
/**
* Sync core's time with your phone.
*/
- (void)syncTimeWithCompletion:(void (^)(BOOL bSuccess))completion;
- (void)renameWithName:(NSString *)name completion:(void (^)(BOOL bSuccess))completion;
/**
Start offline monitoring
*/
- (void)startOfflineMonitoring;
/**
Stop offline monitoring
*/
- (void)stopOfflineMonitoring;
/**
Query Offline Datas Num.
@param completion callback block
*/
- (void)queryOfflineDataNumWithCompletion:(void (^)(NSInteger totalLength, NSInteger dataNum))completion;
/**
* Query if has offline datas, respond timestamp/length
*/
- (void)queryOfflineDataInfoWithCompletion:(void (^)(NSInteger timestamp, NSInteger length))completion;
/**
Sync offline datas, when finish synchronizing process, core won't delete the datas, you should call <eraseAllOfflineDataWithCompletion:> after sync offline datas to erase.
*/
- (void)syncOfflineDataWithProgressHandler:(void (^)(CGFloat progress))progressHandler
finishHandler:(void (^)(NSInteger timestamp, NSArray <NSNumber *> *hrDatas, NSArray <NSNumber *> *brDatas))finishHandler;
/**
* Erase all offline Data. Before do this, pls make sure your datas have been archiving successful.
*/
- (void)eraseAllOfflineDataWithCompletion:(void (^)(BOOL bSuccess))completion;
如何使用
查看演示中的详细信息。
快照