Professional Documents
Culture Documents
AILinkBleSDK使用说明
AILinkBleSDK使用说明
AILinkBleSDK使用说明
更新说明
使⽤条件
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;
}
}
-(void)broadcastScaleBleUpdateState:(ELBluetoothState)state{
if (state == ELBluetoothStateAvailable) {
self.statusLbl.text = @"Connecting";
}else if (state == ELBluetoothStateUnavailable){
self.statusLbl.text = @"Bluetooth is disconnected";
}
4.算法调⽤
技术⽀持
深圳市易连物联⽹有限公司
电话:0755-81773367
官⽹:www.elinkthings.com
邮箱:app@elinkthings.com