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.6KB

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