ifish/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m

92 lines
2.6 KiB
Objective-C

//
// ConnectingAquarVC.m
// Ifish
//
// Created by wbzhan on 2019/9/20.
// Copyright © 2019 lianlian. All rights reserved.
//
#import "ConnectingAquarVC.h"
#import "HKPieChartView.h"
#import "dataContorl.h"
#import<SystemConfiguration/CaptiveNetwork.h>
#import "IFishHotpotUDPHelper.h"
#import "ESPTouchResult.h"
#import "ESPTouchTask.h"
#import "IfishDataUnity.h"
#import <GWP2P/GWP2P.h>
@interface ConnectingAquarVC ()
Strong HKPieChartView *progressView;
Strong UILabel *titleL;
Strong ESPTouchTask* epTask;
Strong NSMutableString *trackString;
/**
设备返回的mac地址
*/
Copy NSString *macAddress;
/**
是否正在绑定设备
*/
Assign BOOL isBindingDevice;
Strong NSTimer *bindTimer;
Assign NSInteger retryTimes;
@end
@implementation ConnectingAquarVC
- (void)viewDidLoad {
[super viewDidLoad];
[self addTitleViewWithTitle:@"尝试与设备建立连接"];
[self.view addSubview:self.progressView];
[self.view addSubview:self.titleL];
[self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.progressView.mas_bottom).offset(kSizeFrom750(80));
make.centerX.mas_equalTo(self.view);
make.width.mas_equalTo(kSizeFrom750(700));
}];
[self.progressView updatePercent:99 animation:YES];
//AP模式配网
[[GWP2PDeviceLinker shareInstance] p2pAPLinkDeviceWithWiFiSSID:self.wifiName wifiPassword:self.wifiPassword devicePassword:@"123" deviceReceive:^(NSString *deviceId, BOOL isSupport) {
//
NSLog(@"设备%@收到WiFi,isSupport:%d",deviceId,isSupport);
} deviceLinkIn:^(NSDictionary *deviceDict) {
//成功
}];
// Do any additional setup after loading the view.
}
- (HKPieChartView *)progressView
{
if (!_progressView) {
_progressView = [[HKPieChartView alloc]initWithFrame:RECT((screen_width - 100)/2, 120, 100, 100)];
}
return _progressView;
}
- (UILabel *)titleL
{
if (!_titleL) {
_titleL = InitObject(UILabel);
_titleL.text = @"设备连接中\n尽量使您的路由器、手机和设备互相靠近";
_titleL.textAlignment = NSTextAlignmentCenter;
_titleL.font = FontSize(16);
_titleL.numberOfLines = 2;
_titleL.textColor = RGB_92;
}
return _titleL;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end