端口释放的优化

This commit is contained in:
祝发冬
2023-08-26 00:05:39 +08:00
parent 801450b271
commit 78c0096abb
2 changed files with 69 additions and 29 deletions
@@ -201,6 +201,11 @@ extern BOOL isfromCameraView;
-(void)goBackAction{
if(self.connectingView.hidden==NO)
{
if(_airKissConnection)
{
[_airKissConnection closeConnection];
_airKissConnection = nil;
}
[self connectNormalView];
}
else
@@ -620,11 +625,16 @@ extern BOOL isfromCameraView;
- (void)configWifiForDevice{
NSLog(@"ViewController do confirm action...");
if(_airKissConnection)
{
[_airKissConnection closeConnection];
_airKissConnection = nil;
}
WEAK_SELF;
void(^success)(NSString*deviceBssid)=^(NSString*deviceBssid)
{
_deviceBssid=deviceBssid;
weakSelf.airKissConnection=nil;
weakSelf.deviceBssid=deviceBssid;
NSArray*arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
DeviceModel*model=[[DeviceModel alloc]init];
@@ -639,21 +649,21 @@ extern BOOL isfromCameraView;
BOOL exst=[macdressArr containsObject:_deviceBssid];
if (exst) {
self.lodviewMissStyle=lodingViewdissMissAlreadyBinded;
[self mmPogressHUDdismiss];
[self connectNormalView];
self.bakbutton.userInteractionEnabled=YES;
weakSelf.lodviewMissStyle=lodingViewdissMissAlreadyBinded;
[weakSelf mmPogressHUDdismiss];
[weakSelf connectNormalView];
weakSelf.bakbutton.userInteractionEnabled=YES;
//[self.navigationController popViewControllerAnimated:YES];
[self.view makeToast:@"该设备已存在"];
[weakSelf.view makeToast:@"该设备已存在"];
}else{
if (self.deviceType==DEVICEPETS) {
[self showStoreNameView];
if (weakSelf.deviceType==DEVICEPETS) {
[weakSelf showStoreNameView];
}
else
{
[self bindDeviceWithSsid:_deviceBssid];
[weakSelf bindDeviceWithSsid:_deviceBssid];
}
@@ -666,17 +676,18 @@ extern BOOL isfromCameraView;
void(^failure)(NSError*error,NSString*msg)=^(NSError*error,NSString*msg)
{
self.lodviewMissStyle=lodingViewdissMissfail;
[self mmPogressHUDdismiss];
[self connectNormalView];
self.bakbutton.userInteractionEnabled=YES;
weakSelf.airKissConnection=nil;
weakSelf.lodviewMissStyle=lodingViewdissMissfail;
[weakSelf mmPogressHUDdismiss];
[weakSelf connectNormalView];
weakSelf.bakbutton.userInteractionEnabled=YES;
if(msg.length)
{
[self.view makeToast:msg];
[weakSelf.view makeToast:msg];
}
[self showFailResultViewWithMsg:msg];
[weakSelf showFailResultViewWithMsg:msg];
};
ConnectType type = self.connectType;
ConnectType type = weakSelf.connectType;
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if(type == ConnectTypeAirKiss)
{