iOS AILinkBleSDK - 蓝牙SDK
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ViewController.m 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // ViewController.m
  3. // AILinkBleSDKSourceCode
  4. //
  5. // Created by iot_user on 2020/4/7.
  6. // Copyright © 2020 IOT. All rights reserved.
  7. //
  8. #import "ViewController.h"
  9. #import "Masonry.h"
  10. #import "AiLinkSuperViewController.h"
  11. #import "InheritScanViewController.h"
  12. #import "BabyScaleViewController.h"
  13. #import "BloodScanViewController.h"
  14. #import "HeightGuageScanViewController.h"
  15. #import "RemoteControlScanViewController.h"
  16. #import "ForeheadScanViewController.h"
  17. #import "ThermometerScanViewController.h"
  18. #import "WheelMonitorScanViewController.h"
  19. #import "BodyFatScaleScanViewController.h"
  20. @interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
  21. @property (nonatomic, strong) UITableView *tableView;
  22. @property (nonatomic, copy) NSArray *datas;
  23. @end
  24. @implementation ViewController
  25. - (void)viewDidLoad {
  26. [super viewDidLoad];
  27. self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤"];
  28. [self.view addSubview:self.tableView];
  29. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.top.left.right.bottom.mas_equalTo(0);
  31. }];
  32. }
  33. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  34. return self.datas.count;
  35. }
  36. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  37. return 50;
  38. }
  39. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  40. static NSString *cellId = @"cellid";
  41. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
  42. if (!cell) {
  43. cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
  44. }
  45. cell.textLabel.text = self.datas[indexPath.row];
  46. return cell;
  47. }
  48. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  49. if (indexPath.row == 0) {
  50. AiLinkSuperViewController *vc = [[AiLinkSuperViewController alloc] init];
  51. vc.title = self.datas[indexPath.row];
  52. [self.navigationController pushViewController:vc animated:YES];
  53. }else if (indexPath.row == 1){
  54. InheritScanViewController *vc = [[InheritScanViewController alloc] init];
  55. vc.title = self.datas[indexPath.row];
  56. [self.navigationController pushViewController:vc animated:YES];
  57. }else if (indexPath.row == 2){
  58. BabyScaleViewController *vc = [[BabyScaleViewController alloc] init];
  59. vc.title = self.datas[indexPath.row];
  60. [self.navigationController pushViewController:vc animated:YES];
  61. }else if (indexPath.row == 3){
  62. BloodScanViewController *vc = [[BloodScanViewController alloc] init];
  63. vc.title = self.datas[indexPath.row];
  64. [self.navigationController pushViewController:vc animated:YES];
  65. }else if(indexPath.row == 4){
  66. HeightGuageScanViewController *vc = [[HeightGuageScanViewController alloc] init];
  67. vc.title = self.datas[indexPath.row];
  68. [self.navigationController pushViewController:vc animated:YES];
  69. }else if(indexPath.row == 5){
  70. RemoteControlScanViewController *vc = [[RemoteControlScanViewController alloc] init];
  71. vc.title = self.datas[indexPath.row];
  72. [self.navigationController pushViewController:vc animated:YES];
  73. }else if(indexPath.row == 6){
  74. ForeheadScanViewController *vc = [[ForeheadScanViewController alloc] init];
  75. vc.title = self.datas[indexPath.row];
  76. [self.navigationController pushViewController:vc animated:YES];
  77. }else if(indexPath.row == 7){
  78. ThermometerScanViewController *vc = [[ThermometerScanViewController alloc] init];
  79. vc.title = self.datas[indexPath.row];
  80. [self.navigationController pushViewController:vc animated:YES];
  81. }else if(indexPath.row == 8){
  82. WheelMonitorScanViewController *vc = [[WheelMonitorScanViewController alloc] init];
  83. vc.title = self.datas[indexPath.row];
  84. [self.navigationController pushViewController:vc animated:YES];
  85. }else if(indexPath.row == 9){
  86. BodyFatScaleScanViewController *vc = [[BodyFatScaleScanViewController alloc] init];
  87. vc.title = self.datas[indexPath.row];
  88. [self.navigationController pushViewController:vc animated:YES];
  89. }
  90. }
  91. -(UITableView *)tableView{
  92. if (_tableView == nil) {
  93. _tableView = [[UITableView alloc] init];
  94. _tableView.delegate = self;
  95. _tableView.dataSource = self;
  96. }
  97. return _tableView;
  98. }
  99. @end