AILinkBleSDK使用说明

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

AILinkBleSDK使⽤说明

更新说明

版本号 更新时间 作者 更新信息

v1.0_20210126 2021-01-26 wz initial version

v1.0_20210201 2021-02-01 wz unit change

使⽤条件
1.iOS 9.0及以上版本; 2.蓝⽛4.0及以上版本。

使⽤前准备
1.下载AILinkBleSDK并解压;下载地址: 2.将AILinkBleSDK.framework⽂件导⼊项⽬; 3.在info.plist⽂件中加
⼊“Privacy - Bluetooth Always Usage Description”;

开始使⽤

⼀、公共部分

SDK的ELBluetoothManager是SDK的⽗类,它分为以下⼏个公共部分:

1.公共属性
@property (nonatomic, assign, readonly) BOOL isOn;
//Bluetooth status(蓝⽛状态)
@property (nonatomic, assign, readonly) ELBluetoothState state;
//version number(版本号)
@property (nonatomic, copy, readonly) NSString *bmVersion;
/**
Save the model corresponding to the currently connected device
保存当前连接的设备对应的模型
*/
@property (nonatomic, strong, readonly) ELPeripheralModel *peripheralModel;
//Bluetooth proxy(蓝⽛代理)
@property (nonatomic, weak) id<ELBluetoothManagerDelegate> delegate;
//Bluetooth wifi proxy(蓝⽛wifi代理)
@property (nonatomic, weak) id<ElBleWifiDelegate> bleWifiDelegate;

2.公共⽅法

//
+(__kindof ELBluetoothManager * _Nonnull)shareManager;
/**
Get the SDK version number
获取SDK版本号
*/
-(NSString *)sdkVersion;

//Start scanning(开始扫描)
-(void)startScan;
//Stop scanning(停⽌扫描)
-(void)stopScan;
//Connecting device(连接设备)
-(void)connectPeripheral:(ELPeripheralModel *)peripheralModel;
//Disconnect device(断开设备)
-(void)disconnectPeripheral;

集成⼴播秤

1.导⼊头⽂件并遵守协议

#import <AILinkBleSDK/ELBroadcastScaleBleManager.h>

2.设置代理、开始扫描
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[ELBroadcastScaleBleManager shareManager].broadcastScaleBleDelegate = self;
[[ELBroadcastScaleBleManager shareManager] startScan];
[self setupUI];
}

3.接收数据、处理数据、交互
-(void)broadcastScaleBleDataModel:(ELBroadcastScaleDataModel *)model{
switch (model.testStatus) {
case BroadcastScaleTestStatusWeightTesting:
{
self.statusLbl.text = @"Weight testing";
}
break;
case BroadcastScaleTestStatusADCTesting: {
self.statusLbl.text = @"Impedance testing";
break;
}
case BroadcastScaleTestStatusADCTestSuccess: {
self.statusLbl.text = @"Impedance test success";
break;
}
case BroadcastScaleTestStatusADCTestFailed: {
self.statusLbl.text = @"Impedance test failed";
break;
}
case BroadcastScaleTestStatusTestEnd: {
self.statusLbl.text = @"Test end";

break;
}
}

NSString *testData = [NSString stringWithFormat:@"MAC:%@\ncid = %d--vid=%d--pid=%d\nW


[self addLog:testData];
}

-(void)broadcastScaleBleUpdateState:(ELBluetoothState)state{
if (state == ELBluetoothStateAvailable) {
self.statusLbl.text = @"Connecting";
}else if (state == ELBluetoothStateUnavailable){
self.statusLbl.text = @"Bluetooth is disconnected";
}

4.算法调⽤

AlgorithmModel *alg = [AlgorithmSDK getBodyfatWithWeight:50.5 adc:560 sex:(AlgUser


Sex_Male) age:25 height:175 algNum:1];
BfsCalculateItem *item = [BfsCalculateSDK getBodyfatItemWithSex:(BfsUserSex_Male)
height:175 weight:50.5 bfr:alg.bfr rom:alg.rom pp:alg.pp];
FAQ

技术⽀持
深圳市易连物联⽹有限公司

电话:0755-81773367

官⽹:www.elinkthings.com

邮箱:app@elinkthings.com

You might also like