iOS AILinkBleSDK - 蓝牙SDK
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

ViewController.m 5.1KB

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