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.

ELBfsWifiConnectVC.m 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. //
  2. // BodyFatScaleConnectViewController.m
  3. // AILinkBleSDKSourceCode
  4. //
  5. // Created by iot_user on 2020/4/8.
  6. // Copyright © 2020 IOT. All rights reserved.
  7. //
  8. #import "ELBfsWifiConnectVC.h"
  9. #import "Masonry.h"
  10. #import <AILinkBleSDK/ELBodyFatScaleBleManager.h>
  11. #import <AILinkBleSDK/ELBodyFatScaleBleUserModel.h>
  12. #import <AILinkBleSDK/ELBodyFatScaleBleWeightModel.h>
  13. #import "ELBfsWifiConnectTableViewCell.h"
  14. @interface ELBfsWifiConnectVC ()<ELBluetoothManagerDelegate,ELBodyFatScaleBleDelegate,ElBleWifiDelegate,UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource>
  15. @property (nonatomic, strong) UITableView *tableView;
  16. @property (nonatomic, strong) NSMutableArray<ELBleWifiDetailModel *> *dataSource;
  17. @property (nonatomic, strong) UITextView *textView;
  18. @end
  19. @implementation ELBfsWifiConnectVC
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. self.view.backgroundColor = [UIColor whiteColor];
  23. [ELBodyFatScaleBleManager shareManager].bodyFatScaleDelegate = self;
  24. [ELBodyFatScaleBleManager shareManager].delegate = self;
  25. [[ELBodyFatScaleBleManager shareManager] connectPeripheral:self.p];
  26. [ELBodyFatScaleBleManager shareManager].bleWifiDelegate = self;
  27. self.dataSource = [NSMutableArray array];
  28. [self setupUIView];
  29. }
  30. -(void)viewWillDisappear:(BOOL)animated{
  31. [super viewWillDisappear:animated];
  32. [[ELBodyFatScaleBleManager shareManager] disconnectPeripheral];
  33. }
  34. -(void)addLog:(NSString *)log{
  35. self.textView.text = [NSString stringWithFormat:@"%@\n%@",log,self.textView.text];
  36. }
  37. -(void)buttonAction:(UIButton *)sender{
  38. if ([ELBodyFatScaleBleManager shareManager].state != ELBluetoothStateDidValidationPass) {
  39. [self addLog:@"Disconnected"];
  40. return;
  41. }
  42. [self addLog:sender.titleLabel.text];
  43. }
  44. -(void)setupUIView{
  45. // UIButton *button1 = [UIButton buttonWithType:(UIButtonTypeCustom)];
  46. // [button1 setTitle:@"Get BM Version" forState:(UIControlStateNormal)];
  47. // button1.tag = 1;
  48. // button1.titleLabel.adjustsFontSizeToFitWidth = YES;
  49. // button1.titleLabel.numberOfLines = 2;
  50. // button1.backgroundColor = [UIColor blackColor];
  51. // [button1 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
  52. // [self.view addSubview:button1];
  53. // [button1 mas_makeConstraints:^(MASConstraintMaker *make) {
  54. // make.left.mas_equalTo(10);
  55. // make.top.mas_equalTo(80);
  56. // make.width.mas_equalTo(100);
  57. // make.height.mas_equalTo(40);
  58. // }];
  59. //
  60. // UIButton *button2 = [UIButton buttonWithType:(UIButtonTypeCustom)];
  61. // [button2 setTitle:@"Get C V P ID" forState:(UIControlStateNormal)];
  62. // button2.tag = 2;
  63. // button2.titleLabel.adjustsFontSizeToFitWidth = YES;
  64. // button2.titleLabel.numberOfLines = 2;
  65. // button2.backgroundColor = [UIColor blackColor];
  66. // [button2 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
  67. // [self.view addSubview:button2];
  68. // [button2 mas_makeConstraints:^(MASConstraintMaker *make) {
  69. // make.left.equalTo(button1.mas_right).mas_offset(10);
  70. // make.top.mas_equalTo(80);
  71. // make.width.mas_equalTo(100);
  72. // make.height.mas_equalTo(40);
  73. // }];
  74. //
  75. // UIButton *button3 = [UIButton buttonWithType:(UIButtonTypeCustom)];
  76. // [button3 setTitle:@"Get Name" forState:(UIControlStateNormal)];
  77. // button3.tag = 3;
  78. // button3.titleLabel.adjustsFontSizeToFitWidth = YES;
  79. // button3.titleLabel.numberOfLines = 2;
  80. // button3.backgroundColor = [UIColor blackColor];
  81. // [button3 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
  82. // [self.view addSubview:button3];
  83. // [button3 mas_makeConstraints:^(MASConstraintMaker *make) {
  84. // make.left.equalTo(button2.mas_right).mas_offset(10);
  85. // make.top.mas_equalTo(80);
  86. // make.width.mas_equalTo(100);
  87. // make.height.mas_equalTo(40);
  88. // }];
  89. // //
  90. // UIButton *button4 = [UIButton buttonWithType:(UIButtonTypeCustom)];
  91. // [button4 setTitle:@"Set Name" forState:(UIControlStateNormal)];
  92. // button4.tag = 4;
  93. // button4.titleLabel.adjustsFontSizeToFitWidth = YES;
  94. // button4.titleLabel.numberOfLines = 2;
  95. // button4.backgroundColor = [UIColor blackColor];
  96. // [button4 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
  97. // [self.view addSubview:button4];
  98. // [button4 mas_makeConstraints:^(MASConstraintMaker *make) {
  99. // make.left.mas_equalTo(10);
  100. // make.top.equalTo(button1.mas_bottom).mas_offset(10);
  101. // make.width.mas_equalTo(100);
  102. // make.height.mas_equalTo(40);
  103. // }];
  104. //
  105. // UIButton *button5 = [UIButton buttonWithType:(UIButtonTypeCustom)];
  106. // [button5 setTitle:@"Change unit" forState:(UIControlStateNormal)];
  107. // button5.tag = 5;
  108. // button5.titleLabel.adjustsFontSizeToFitWidth = YES;
  109. // button5.titleLabel.numberOfLines = 2;
  110. // button5.backgroundColor = [UIColor blackColor];
  111. // [button5 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
  112. // [self.view addSubview:button5];
  113. // [button5 mas_makeConstraints:^(MASConstraintMaker *make) {
  114. // make.left.equalTo(button4.mas_right).mas_offset(10);
  115. // make.top.equalTo(button1.mas_bottom).mas_offset(10);
  116. // make.width.mas_equalTo(100);
  117. // make.height.mas_equalTo(40);
  118. // }];
  119. //
  120. self.textView = [[UITextView alloc] init];
  121. self.textView.backgroundColor = [UIColor blackColor];
  122. self.textView.text = @"Log";
  123. self.textView.textColor = [UIColor redColor];
  124. [self.view addSubview:self.textView];
  125. [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
  126. make.left.mas_equalTo(10);
  127. make.right.bottom.mas_equalTo(-10);
  128. make.height.mas_equalTo(300);
  129. }];
  130. self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
  131. self.tableView.delegate = self;
  132. self.tableView.dataSource = self;
  133. [self.view addSubview:self.tableView];
  134. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  135. make.left.right.offset(0);
  136. make.top.offset(100);
  137. make.bottom.equalTo(self.textView.mas_top).offset(-20);
  138. }];
  139. }
  140. -(void)bodyFatScaleManagerUpdateState:(ELBluetoothState)state{
  141. switch (state) {
  142. case ELBluetoothStateUnavailable:
  143. {
  144. self.title = @"Please open the bluetooth";
  145. }
  146. break;
  147. case ELBluetoothStateAvailable:
  148. {
  149. self.title = @"Bluetooth is open";
  150. }
  151. break;
  152. case ELBluetoothStateScaning:
  153. {
  154. self.title = @"Scaning";
  155. }
  156. break;
  157. case ELBluetoothStateConnectFail:
  158. {
  159. self.title = @"Connect fail";
  160. }
  161. break;
  162. case ELBluetoothStateDidDisconnect:
  163. {
  164. self.title = @"Disconnected";
  165. }
  166. break;
  167. case ELBluetoothStateDidValidationPass:
  168. {
  169. self.title = @"Connected";
  170. if (self.p.deviceType == ELSupportDeviceTypeBLE_WIFIScale) {
  171. //获取蓝牙连接状态
  172. [[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetConnectState)];
  173. }
  174. }
  175. break;
  176. case ELBluetoothStateFailedValidation:
  177. {
  178. self.title = @"Illegal equipment";
  179. }
  180. break;
  181. case ELBluetoothStateWillConnect:
  182. self.title = @"Connecting";
  183. break;
  184. default:
  185. break;
  186. }
  187. }
  188. -(void)bluetoothManagerReceiveMCUConnectedState:(struct ELMCUStateStruct)stateStrct{
  189. BleWiFiConnectState wifiState = stateStrct.wifiState;
  190. if (self.p.deviceType == ELSupportDeviceTypeBLE_WIFIScale) { //蓝牙WiFi体脂秤
  191. //请求会话码
  192. [[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetSNNumber];
  193. //MARK:1.WiFi配置提示用户配网
  194. //TODO:注意:wifi配置过程必须保持蓝牙与设备的连接
  195. if (wifiState == BleWiFiConnectStateNoWiFi) {
  196. //1.如果没有配网,则提示用户去配网
  197. //MARK:2.WiFi配置先获取wifi列表
  198. [self.dataSource removeAllObjects];
  199. [self.tableView reloadData];
  200. [[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetNearbyWifi];
  201. } else {
  202. //MARK:2.没网也可以获取Wi-Fi列表,如果需要更新Wi-Fi的话
  203. [self.dataSource removeAllObjects];
  204. [self.tableView reloadData];
  205. [[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetNearbyWifi];
  206. }
  207. }
  208. ///MARK:9.wifi配置结果
  209. //wifi相关的其他指令和数据接收,请查看ELBluetoothManager.h文件
  210. if (stateStrct.wifiState == BleWiFiConnectStateSuccess) {
  211. //成功
  212. //MARK:10.获取wifi设备的SN号,即设备id
  213. [[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeBleWifiGetSNNumber)];
  214. }else{
  215. //失败
  216. }
  217. }
  218. //MARK:回调Wifi列表
  219. -(void)bleWifiReceiveWifiDetailModel:(ELBleWifiDetailModel *)model{
  220. //用一个tableview显示喽
  221. [self addLog:[NSString stringWithFormat:@"wifi类型---%lu 名称---%@ 连接状态--%zd",(unsigned long)model.wifiState,model.wifiName,model.wifiState]];
  222. // MARK:3.WiFi配置得到Wifi列表
  223. if (model.wifiName.length > 0) {
  224. [self.dataSource addObject:model];
  225. }
  226. [self.tableView reloadData];
  227. }
  228. -(void)bleWifiReceiveScanedWifiCount:(int)count {
  229. //MARK:扫描Wifi结束
  230. //MARK:4.WiFi配置得到一个附近wifi的列表,点击选择一个wifi,进行配置
  231. [self.tableView reloadData];
  232. }
  233. -(void)bleWifiReceiceResponseType:(ELInetSetCmdType)type result:(ELSetBluetoothResponseType)result{
  234. [self addLog:[NSString stringWithFormat:@"bleWifiReceiceResponseType==%lu----%lu",type,result]];
  235. if (result == ELSetBluetoothResponseTypeSuccess) {
  236. //设置WiFi结果
  237. if (type == ELInetSetCmdTypeBleWifiSetWifiMac) {
  238. }else if (type == ELInetSetCmdTypeBleWifiSetWifiPwd){
  239. //MARK:8.然后发起连接Wifi
  240. [[ELBodyFatScaleBleManager shareManager] bleWifiSetupWifiConnect:YES];
  241. }else if (type == ELInetSetCmdTypeBleWifiSetConnectWifi){
  242. //获取连接状态,更新Wi-Fi列表
  243. [self.dataSource removeAllObjects];
  244. [self.tableView reloadData];
  245. [[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetNearbyWifi];
  246. }
  247. }
  248. else{
  249. //TODO:Wifi配置过程中失败的情况自行处理
  250. }
  251. }
  252. -(void)bleWifiReceiveWifiSNCode:(int)code{
  253. //MARK:11.根据wifi设备的设备id从服务器获取离线数据(找自己后台要接口)
  254. }
  255. #pragma mark - textField Delegate
  256. - (void)textFieldDidEndEditing:(UITextField *)textField {
  257. NSLog(@"%@",textField.text);
  258. //MARK:7.再发送配置wifi的密码的指令
  259. [[ELBodyFatScaleBleManager shareManager] bleWifiSetWifiPwd:textField.text];
  260. }
  261. #pragma mark - tableView Delegate And DataSource
  262. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  263. return 1;
  264. }
  265. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  266. return self.dataSource.count;
  267. }
  268. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  269. static NSString *cellId = @"ELBfsWifiConnectTableViewCell";
  270. ELBfsWifiConnectTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
  271. if (!cell) {
  272. cell = [[ELBfsWifiConnectTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
  273. }
  274. ELBleWifiDetailModel *model = self.dataSource[indexPath.row];
  275. cell.wifiName = model.wifiName;
  276. if (model.wifiState == ELBleWifiUseStateConnected) {
  277. cell.isLink = YES;
  278. } else {
  279. cell.isLink = NO;
  280. }
  281. return cell;
  282. }
  283. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  284. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  285. ELBleWifiDetailModel *model = self.dataSource[indexPath.row];
  286. //MARK:5.先发送配置wifi的mac地址的指令
  287. [[ELBodyFatScaleBleManager shareManager] bleWifiSetConnectWifiMac:model.macData];
  288. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"请输入wifi密码" message:model.wifiName preferredStyle:UIAlertControllerStyleAlert];
  289. UIAlertAction *conform = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  290. NSLog(@"点击了确认按钮");
  291. }];
  292. UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  293. NSLog(@"点击了取消按钮");
  294. }];
  295. //MARK:6.输入wifi密码
  296. [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
  297. textField.placeholder = @"密码";
  298. textField.delegate = self;
  299. }];
  300. [alert addAction:conform];
  301. [alert addAction:cancel];
  302. [self presentViewController:alert animated:YES completion:nil];
  303. }
  304. #pragma mark -
  305. - (void)dealloc
  306. {
  307. [[ELBodyFatScaleBleManager shareManager] disconnectPeripheral];
  308. }
  309. #pragma mark ============ 如下是蓝牙交互部分,wifi不用管 ==============
  310. //
  311. ///**
  312. // MCU requests user information( MCU 请求用户信息)
  313. //
  314. // @param status 请求状态
  315. // */
  316. //- (void)bodyFatScaleManagerMCURequestAppUserInfoType:(BodyFatScaleMCURequestUserInfoStatus)status{
  317. // if (status == BodyFatScaleMCURequestUserInfoStatus_Get) {
  318. // //下发当前用户给秤
  319. // [[ELBodyFatScaleBleManager shareManager] sendCurrentUserToBle:[self getOneUser]];
  320. // }else if (status == BodyFatScaleMCURequestUserInfoStatus_Success){
  321. // [self addLog:@"MCU requests user information success"];
  322. // }else if (BodyFatScaleMCURequestUserInfoStatus_Fail){
  323. // [self addLog:@"MCU requests user information failure"];
  324. // }
  325. //
  326. //}
  327. //
  328. //
  329. ///**
  330. // Return weight and body fat model(返回重量及体脂model)
  331. // */
  332. //-(void)bodyFatScaleManagerCallBackWeight:(ELBodyFatScaleBleWeightModel *)weightModel state:(BodyFatScaleMeasureStatus)status{
  333. // switch (status) {
  334. // case BodyFatScaleMeasureStatus_Unstable:
  335. // {
  336. // [self addLog:[NSString stringWithFormat:@"Unstable data weight = %ld unit = %@ point = %ld adc = %ld",weightModel.weight,AiLinkBleWeightUnitDic[@(weightModel.weightUnit)],weightModel.weightPoint,weightModel.adc]];
  337. // }
  338. // break;
  339. // case BodyFatScaleMeasureStatus_Stable:
  340. // {
  341. // [self addLog:[NSString stringWithFormat:@"Stable data weight = %ld unit = %@ point = %ld adc = %ld",weightModel.weight,AiLinkBleWeightUnitDic[@(weightModel.weightUnit)],weightModel.weightPoint,weightModel.adc]];
  342. // }
  343. // break;
  344. // case BodyFatScaleMeasureStatus_Failed:
  345. // {
  346. // [self addLog:@"Test failure"];
  347. // }
  348. // break;
  349. // case BodyFatScaleMeasureStatus_Complete:
  350. // {
  351. // [self addLog:[NSString stringWithFormat:@"Tested weight = %ld unit = %@ point = %ld adc = %ld",weightModel.weight,AiLinkBleWeightUnitDic[@(weightModel.weightUnit)],weightModel.weightPoint,weightModel.adc]];
  352. //
  353. // //更新用户信息给秤
  354. // [[ELBodyFatScaleBleManager shareManager] sendCurrentUserToBle:[self getOneUser]];
  355. // //下发用户列表
  356. // [[ELBodyFatScaleBleManager shareManager] sendOfflineUserListToBle:[self get8Users]];
  357. // }
  358. // break;
  359. // default:
  360. // break;
  361. // }
  362. //}
  363. //
  364. //
  365. ///**
  366. // Return temperature (unit: ° C)(返回温度(单位:°C))
  367. //
  368. // @param temp 温度(单位:°C)
  369. // */
  370. //-(void)bodyFatScaleManagerCallBackTemp:(NSString *)temp{
  371. // [self addLog:[NSString stringWithFormat:@"temperature is %@",temp]];
  372. //}
  373. //
  374. ///**
  375. // Back to impedance measurement(返回阻抗测量)
  376. //
  377. // @param status 阻抗测量状态
  378. // @param adc 阻抗
  379. // */
  380. //-(void)bodyFatScaleManagerCallBackAdcMeasureStatus:(BodyFatScaleAdcMeasureStatus)status adcValue:(NSInteger)adc{
  381. // switch (status) {
  382. // case BodyFatScaleAdcMeasureStatus_Testing:
  383. // {
  384. // [self addLog:@"adc testing"];
  385. // }
  386. // break;
  387. // case BodyFatScaleAdcMeasureStatus_Success:
  388. // {
  389. // [self addLog:[NSString stringWithFormat:@"adc is %ld",adc]];
  390. // }
  391. // break;
  392. // case BodyFatScaleAdcMeasureStatus_Fail:
  393. // {
  394. // [self addLog:@"adc test failure"];
  395. // }
  396. // break;
  397. // case BodyFatScaleAdcMeasureStatus_SuccessCustom:
  398. // {
  399. // [self addLog:[NSString stringWithFormat:@"adc is %ld and user app algum",adc]];
  400. // }
  401. // break;
  402. // default:
  403. // break;
  404. // }
  405. //}
  406. //
  407. ///**
  408. // Callback heart rate measurement(回调心率测量)
  409. //
  410. // @param status 心率测量状态
  411. // @param heartRate 心率
  412. // */
  413. //-(void)bodyFatScaleManagerCallBackHeartRateMeasureStatus:(BodyFatScaleHeartRateMeasureStatus)status heartRateValue:(NSInteger)heartRate{
  414. // switch (status) {
  415. // case BodyFatScaleHeartRateMeasureStatus_Testing:
  416. // {
  417. // [self addLog:@"Heart Rate Testing"];
  418. // }
  419. // break;
  420. // case BodyFatScaleHeartRateMeasureStatus_Success:
  421. // {
  422. // [self addLog:[NSString stringWithFormat:@"Heart Rate is %ld",heartRate]];
  423. // }
  424. // break;
  425. // case BodyFatScaleHeartRateMeasureStatus_Fail:
  426. // {
  427. // [self addLog:@"Heart Rate Test failure"];
  428. // }
  429. // break;
  430. // default:
  431. // break;
  432. // }
  433. //}
  434. //
  435. ///**
  436. // Return error code(返回错误码)
  437. //
  438. // @param code 错误码
  439. // 1:超重
  440. // */
  441. //-(void)bodyFatScaleManagerCallBackErrorCode:(NSInteger)code{
  442. // [self addLog:[NSString stringWithFormat:@"error code = %ld",code]];
  443. //}
  444. ////MARK:回调A6指令数据
  445. //
  446. ///**
  447. // Send success or failure callback for offline user list(发送离线用户列表的成功或失败回调)
  448. //
  449. // @param status 状态
  450. // */
  451. //-(void)bodyFatScaleManagerCallBackUpdateRecordStatus:(BodyFatScaleUpdateRecordStatus)status{
  452. // switch (status) {
  453. // case BodyFatScaleUpdateRecordStatus_AllSuccess:
  454. // {
  455. // [self addLog:@"Update All Users Success"];
  456. // }
  457. // break;
  458. // case BodyFatScaleUpdateRecordStatus_OneSuccess:
  459. // {
  460. // [self addLog:@"Update A User Success"];
  461. // }
  462. // break;
  463. // case BodyFatScaleUpdateRecordStatus_OneFail:
  464. // {
  465. // [self addLog:@"Update A User Failure"];
  466. // }
  467. // break;
  468. // case BodyFatScaleUpdateRecordStatus_AllFail:
  469. // {
  470. // [self addLog:@"Update All Users Failure"];
  471. // }
  472. // break;
  473. // default:
  474. // break;
  475. // }
  476. //}
  477. //
  478. ///**
  479. // Request callback for offline history(请求离线历史记录的回调)
  480. //
  481. // @param status 状态
  482. // */
  483. //-(void)bodyFatScaleManagerCallBackSendHistoryDataStatus:(BodyFatScaleSendHistoryDataStatus)status{
  484. // if (status == BodyFatScaleSendHistoryDataStatus_No) {
  485. // [self addLog:@"No offline datas"];
  486. // }else if (status == BodyFatScaleSendHistoryDataStatus_Begin){
  487. // [self addLog:@"Begin receive offline datas"];
  488. // }else if (status == BodyFatScaleSendHistoryDataStatus_End){
  489. // [self addLog:@"End receive offline datas"];
  490. // }
  491. //
  492. //}
  493. //
  494. ///**
  495. // APP algorithm-offline history data(APP 算法-离线历史记录数据)
  496. //
  497. // @param user 用户信息
  498. // */
  499. //-(void)bodyFatScaleManagerCallBackBleUserHistoryDataCustomADCModel:(ELBodyFatScaleBleUserModel *)user bodyDataModel:(ELBodyFatScaleBleWeightModel *)bodyModel{
  500. // //这里的身体指标等数据由app自定义算法计算得到,请区分bodyModel.algNum来调用算法
  501. // [self addLog:[NSString stringWithFormat:@"App algorithm-offline history data:userId = %ld weight = %ld unit =%@ point = %ld",user.usrID,bodyModel.weight,AiLinkBleWeightUnitDic[@(bodyModel.weightUnit)],bodyModel.weightPoint]];
  502. //}
  503. //
  504. ///**
  505. // MCU algorithm-offline history data(MCU 算法-离线历史记录数据)
  506. //
  507. // @param user 用户信息
  508. // @param bodyModel 体脂数据
  509. // */
  510. //-(void)bodyFatScaleManagerCallBackBleUserHistoryDataModel:(ELBodyFatScaleBleUserModel *)user bodyDataModel:(ELBodyFatScaleBleWeightModel *)bodyModel{
  511. // //这里的身体指标数据由秤计算得到
  512. // [self addLog:[NSString stringWithFormat:@"MCU algorithm-offline history data:userId = %ld weight = %ld unit =%@ point = %ld",user.usrID,bodyModel.weight,AiLinkBleWeightUnitDic[@(bodyModel.weightUnit)],bodyModel.weightPoint]];
  513. //}
  514. //
  515. //
  516. //-(NSArray<ELBodyFatScaleBleUserModel *> *)get8Users{
  517. // NSMutableArray *users = [[NSMutableArray alloc] init];
  518. // for (int i=0; i<8; i++) {
  519. // ELBodyFatScaleBleUserModel *user = [[ELBodyFatScaleBleUserModel alloc] init];
  520. // user.createTime = [[NSDate date] timeIntervalSince1970];
  521. // user.usrID = i;
  522. // user.role = i%4;
  523. // user.sex = i%2;
  524. // user.age = 26+i;
  525. // user.height = 170+i;
  526. // user.weight = 600+i;
  527. // user.adc = 560+i;
  528. // [users addObject:user];
  529. // }
  530. //
  531. // return users.copy;
  532. //}
  533. //
  534. //-(ELBodyFatScaleBleUserModel *)getOneUser{
  535. // ELBodyFatScaleBleUserModel *user = [[ELBodyFatScaleBleUserModel alloc] init];
  536. // user.createTime = [[NSDate date] timeIntervalSince1970];
  537. // user.usrID = 0;
  538. // user.role = BodyFatScaleRole_Ordinary;
  539. // user.sex = ELBluetoothUserSex_Woman;
  540. // user.age = 26;
  541. // user.height = 170;
  542. // user.weight = 600;
  543. // user.adc = 560;
  544. // return user;
  545. //}
  546. //-(void)dealloc{
  547. //
  548. //
  549. //}
  550. @end