Browse Source

update

tags/v1.4.5_20211215
elinkthings 4 years ago
parent
commit
ea9e2e8311
1 changed files with 40 additions and 56 deletions
  1. 40
    56
      AILinkBleSDKDemo/ViewController.m

+ 40
- 56
AILinkBleSDKDemo/ViewController.m View File

@@ -27,6 +27,7 @@
@property (nonatomic, strong) UITableView *tableView;

@property (nonatomic, copy) NSArray *datas;
@property (nonatomic, copy) NSArray *vcsArray;

@end

@@ -34,18 +35,50 @@

- (void)viewDidLoad {
[super viewDidLoad];
self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤",@"集成广播秤",@"八电极体脂秤",@"蓝牙WiFi牙刷"];
self.datas = @[
@"Parse data yourself(有AILink协议自己解析数据)",
@"Baby Scale(婴儿秤)",
@"Sphygmomanometer(血压计)",
@"Height Guage(身高仪)",
@"Remote Control(遥控器)",
@"Forehead thermometer(额温枪)",
@"Digital thermometer(温度计)",
@"TPMS(胎压监测)",
@"Bluetooth BodyfatScale(体脂秤)",
@"Bluetooth BroadcastScale(广播秤)",
@"Eight-electrode scale(八电极体脂秤)",
@"wifi-ble toothbrush(蓝牙WiFi牙刷)"
];
self.vcsArray = @[
[[InheritScanViewController alloc] init],
[[BabyScaleViewController alloc] init],
[[BloodScanViewController alloc] init],
[[HeightGuageScanViewController alloc] init],
[[RemoteControlScanViewController alloc] init],
[[ForeheadScanViewController alloc] init],
[[ThermometerScanViewController alloc] init],
[[WheelMonitorScanViewController alloc] init],
[[BodyFatScaleScanViewController alloc] init],
[[BroadcastScaleViewController alloc] init],
[[EightScaleScanViewController alloc] init],
[[ToothbrushScanViewController alloc] init]
];
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.bottom.mas_equalTo(0);
}];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.datas.count;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 50;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellId = @"cellid";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
@@ -54,64 +87,15 @@
}
cell.textLabel.text = self.datas[indexPath.row];
return cell;

}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
AiLinkSuperViewController *vc = [[AiLinkSuperViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if (indexPath.row == 1){
InheritScanViewController *vc = [[InheritScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if (indexPath.row == 2){
BabyScaleViewController *vc = [[BabyScaleViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if (indexPath.row == 3){
BloodScanViewController *vc = [[BloodScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 4){
HeightGuageScanViewController *vc = [[HeightGuageScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 5){
RemoteControlScanViewController *vc = [[RemoteControlScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 6){
ForeheadScanViewController *vc = [[ForeheadScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 7){
ThermometerScanViewController *vc = [[ThermometerScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 8){
WheelMonitorScanViewController *vc = [[WheelMonitorScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 9){
BodyFatScaleScanViewController *vc = [[BodyFatScaleScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 10){
BroadcastScaleViewController *vc = [[BroadcastScaleViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if (indexPath.row == 11){
EightScaleScanViewController *vc = [[EightScaleScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if (indexPath.row == 12){
ToothbrushScanViewController *vc = [[ToothbrushScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UIViewController *vc = self.vcsArray[indexPath.row];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}


-(UITableView *)tableView{
if (_tableView == nil) {
_tableView = [[UITableView alloc] init];

Loading…
Cancel
Save