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 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. @interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
  25. @property (nonatomic, strong) UITableView *tableView;
  26. @property (nonatomic, copy) NSArray *datas;
  27. @property (nonatomic, copy) NSArray *vcsArray;
  28. @end
  29. @implementation ViewController
  30. - (void)viewDidLoad {
  31. [super viewDidLoad];
  32. self.datas = @[
  33. @"Parse data yourself(有AILink协议自己解析数据)",
  34. @"Baby Scale(婴儿秤)",
  35. @"Sphygmomanometer(血压计)",
  36. @"Height Guage(身高仪)",
  37. @"Remote Control(遥控器)",
  38. @"Forehead thermometer(额温枪)",
  39. @"Digital thermometer(温度计)",
  40. @"TPMS(胎压监测)",
  41. @"Bluetooth BodyfatScale(体脂秤)",
  42. @"Bluetooth BroadcastScale(广播秤)",
  43. @"Eight-electrode scale(八电极体脂秤)",
  44. @"wifi-ble toothbrush(WiFi-ble牙刷)",
  45. @"wifi-ble bodyfatScale(WiFi-ble体脂秤)",
  46. ];
  47. self.vcsArray = @[
  48. [[InheritScanViewController alloc] init],
  49. [[BabyScaleViewController alloc] init],
  50. [[BloodScanViewController alloc] init],
  51. [[HeightGuageScanViewController alloc] init],
  52. [[RemoteControlScanViewController alloc] init],
  53. [[ForeheadScanViewController alloc] init],
  54. [[ThermometerScanViewController alloc] init],
  55. [[WheelMonitorScanViewController alloc] init],
  56. [[BodyFatScaleScanViewController alloc] init],
  57. [[BroadcastScaleViewController alloc] init],
  58. [[EightScaleScanViewController alloc] init],
  59. [[ToothbrushScanViewController alloc] init],
  60. [[ELBfsWifiScanVC alloc] init],
  61. ];
  62. [self.view addSubview:self.tableView];
  63. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.top.left.right.bottom.mas_equalTo(0);
  65. }];
  66. }
  67. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  68. return self.datas.count;
  69. }
  70. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  71. return 50;
  72. }
  73. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  74. static NSString *cellId = @"cellid";
  75. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
  76. if (!cell) {
  77. cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
  78. }
  79. cell.textLabel.text = self.datas[indexPath.row];
  80. return cell;
  81. }
  82. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  83. UIViewController *vc = self.vcsArray[indexPath.row];
  84. vc.title = self.datas[indexPath.row];
  85. [self.navigationController pushViewController:vc animated:YES];
  86. }
  87. -(UITableView *)tableView{
  88. if (_tableView == nil) {
  89. _tableView = [[UITableView alloc] init];
  90. _tableView.delegate = self;
  91. _tableView.dataSource = self;
  92. }
  93. return _tableView;
  94. }
  95. @end