iOS AILinkBleSDK - 蓝牙SDK
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ViewController.m 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. #import "BroadcastScaleViewController.h"
  21. #import "EightScaleScanViewController.h"
  22. #import "ToothbrushScanViewController.h"
  23. #import "ELBfsWifiScanVC.h"
  24. #import "OximeterScanViewController.h"
  25. #import "BloodSugarScanViewController.h"
  26. #import "CoffeeScaleScanViewController.h"
  27. #import "FoodThermometerScanViewController.h"
  28. #import "BroadcastNutritionScaleViewController.h"
  29. #import "NutritionScaleScanViewController.h"
  30. #import "AiFreshNutritionScaleScanViewController.h"
  31. #import "FaceMaskScanViewController.h"
  32. #import "SkipScanViewController.h"
  33. @interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
  34. @property (nonatomic, strong) UITableView *tableView;
  35. @property (nonatomic, copy) NSArray *datas;
  36. @property (nonatomic, copy) NSArray *vcsArray;
  37. @end
  38. @implementation ViewController
  39. - (void)viewDidLoad {
  40. [super viewDidLoad];
  41. self.datas = @[
  42. @"Parse data yourself(有AILink协议自己解析数据)",
  43. @"04_Baby Scale(婴儿秤)",
  44. @"05_Sphygmomanometer(血压计)",
  45. @"06_Height Guage(身高仪)",
  46. @"07_Remote Control(遥控器)",
  47. @"08_Forehead thermometer(额温枪)",
  48. @"09_Digital thermometer(温度计)",
  49. @"10_TPMS(胎压监测)",
  50. @"11_Bluetooth BodyfatScale(体脂秤)",
  51. @"12_Bluetooth BroadcastScale(广播秤)",
  52. @"13_Eight-electrode scale(八电极体脂秤)",
  53. @"14_wifi-ble toothbrush(WiFi-ble牙刷)",
  54. @"15_wifi-ble bodyfatScale(WiFi-ble体脂秤)",
  55. @"16_Bluetooth Oximeter(血氧仪)",
  56. @"17_Bluetooth BloodGlucoseMeter(血糖仪)",
  57. @"18_CoffeeScale(咖啡秤)",
  58. @"19_FoodThermometer(食物温度计)",
  59. @"20_BrodcastNutritionScale(广播营养秤)",
  60. @"21_NutritionScale(连接营养秤)",
  61. @"22_AiFreshNutritionScale(好营养营养秤)",
  62. @"23_FaceMask(智能口罩)",
  63. @"24_Skip(跳绳)",
  64. ];
  65. self.vcsArray = @[
  66. [[InheritScanViewController alloc] init],
  67. [[BabyScaleViewController alloc] init],
  68. [[BloodScanViewController alloc] init],
  69. [[HeightGuageScanViewController alloc] init],
  70. [[RemoteControlScanViewController alloc] init],
  71. [[ForeheadScanViewController alloc] init],
  72. [[ThermometerScanViewController alloc] init],
  73. [[WheelMonitorScanViewController alloc] init],
  74. [[BodyFatScaleScanViewController alloc] init],
  75. [[BroadcastScaleViewController alloc] init],
  76. [[EightScaleScanViewController alloc] init],
  77. [[ToothbrushScanViewController alloc] init],
  78. [[ELBfsWifiScanVC alloc] init],
  79. [[OximeterScanViewController alloc] init],
  80. [[BloodSugarScanViewController alloc] init],
  81. [[CoffeeScaleScanViewController alloc] init],
  82. [[FoodThermometerScanViewController alloc] init],
  83. [[BroadcastNutritionScaleViewController alloc] init],
  84. [[NutritionScaleScanViewController alloc] init],
  85. [[AiFreshNutritionScaleScanViewController alloc] init],
  86. [[FaceMaskScanViewController alloc] init],
  87. [[SkipScanViewController alloc] init]
  88. ];
  89. [self.view addSubview:self.tableView];
  90. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  91. make.top.left.right.bottom.mas_equalTo(0);
  92. }];
  93. }
  94. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  95. return self.datas.count;
  96. }
  97. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  98. return 50;
  99. }
  100. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  101. static NSString *cellId = @"cellid";
  102. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
  103. if (!cell) {
  104. cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
  105. }
  106. cell.textLabel.text = self.datas[indexPath.row];
  107. return cell;
  108. }
  109. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  110. UIViewController *vc = self.vcsArray[indexPath.row];
  111. vc.title = self.datas[indexPath.row];
  112. [self.navigationController pushViewController:vc animated:YES];
  113. }
  114. -(UITableView *)tableView{
  115. if (_tableView == nil) {
  116. _tableView = [[UITableView alloc] init];
  117. _tableView.delegate = self;
  118. _tableView.dataSource = self;
  119. }
  120. return _tableView;
  121. }
  122. @end