热点连接部分bug修复
This commit is contained in:
@@ -51,6 +51,7 @@ Assign NSInteger retryTimes;
|
||||
make.width.mas_equalTo(kSizeFrom750(700));
|
||||
}];
|
||||
[self.progressView updatePercent:100 animation:YES];
|
||||
[self.progressView endProgressWithString:@"设备连接中..."];
|
||||
//AP模式配网
|
||||
// [[GWP2PDeviceLinker shareInstance] p2pAPLinkDeviceWithWiFiSSID:self.wifiName wifiPassword:self.wifiPassword devicePassword:@"123" deviceReceive:^(NSString *deviceId, BOOL isSupport) {
|
||||
// //
|
||||
@@ -59,12 +60,14 @@ Assign NSInteger retryTimes;
|
||||
// //成功
|
||||
// }];
|
||||
//传入设备要连接的wifi名称和密码
|
||||
// [self sendToDeviceWithSSIDName:self.wifiName andSSIDPWD:self.wifiPassword];
|
||||
[self sendToDeviceWithSSIDName:self.wifiName andSSIDPWD:self.wifiPassword];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
self.timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
|
||||
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
|
||||
self.timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
|
||||
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
|
||||
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (!self.timer) {
|
||||
@@ -165,7 +168,11 @@ Assign NSInteger retryTimes;
|
||||
self.HUD.mode = MBProgressHUDModeIndeterminate;
|
||||
self.HUD.labelText = msg;
|
||||
}
|
||||
|
||||
-(void)endProgress{
|
||||
[self.progressView endProgressWithString:@"连接结束"];
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
}
|
||||
#pragma mark - bind
|
||||
-(void)bindDeviceWithSsid:(NSString*)bssid{
|
||||
NSLog(@"设备bssid_%@",bssid);
|
||||
@@ -178,14 +185,12 @@ Assign NSInteger retryTimes;
|
||||
[self.progressView endEditing:YES];
|
||||
self.isBindingDevice = NO;
|
||||
self.macAddress = nil;
|
||||
[self.progressView endProgressWithString:@"连接结束"];
|
||||
[self.timer invalidate];
|
||||
self.timer = nil;
|
||||
|
||||
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSLog(@"data:%@",resultDic[@"data"]);
|
||||
[self appendTrakContent:[NSString stringWithFormat:@"绑定请求成功。返回数据为:%@", resultDic]];
|
||||
if ([resultDic[@"result"] isEqualToString:@"100"]) {
|
||||
|
||||
[self endProgress];
|
||||
// 保存设备信息
|
||||
NSDictionary*dataDic=resultDic[@"data"];
|
||||
DeviceModel*devicemodel=[[DeviceModel alloc] initWithDict:dataDic];
|
||||
@@ -241,6 +246,7 @@ Assign NSInteger retryTimes;
|
||||
[self bindDeviceWithSsid:self.macAddress];
|
||||
self.retryTimes += 1;
|
||||
} else {
|
||||
[self endProgress];
|
||||
self.isBindingDevice = NO;
|
||||
self.HUD.labelText = @"请求异常";
|
||||
[self.HUD hide:YES afterDelay:2];
|
||||
|
||||
Reference in New Issue
Block a user