From b11f6aacedf8ae26b28dffebea8a80459193ef0d Mon Sep 17 00:00:00 2001 From: kai60 Date: Wed, 6 May 2020 11:50:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=91=84=E5=83=8F=E5=A4=B4=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E9=85=8D=E7=BD=91=E5=BC=BA=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ifish/Info.plist | 2 +- .../YooseeNextConnectViewController.mm | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Ifish/Info.plist b/Ifish/Info.plist index 2f87fd1..bfaf236 100644 --- a/Ifish/Info.plist +++ b/Ifish/Info.plist @@ -70,7 +70,7 @@ CFBundleVersion - $(CURRENT_PROJECT_VERSION) + 4 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm index cddae8f..f27493b 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm @@ -43,6 +43,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { } @property (strong,nonatomic) NSMutableDictionary *addresses; +@property (strong,nonatomic) NSMutableDictionary *linkDict; @property (nonatomic,strong) UIButton *sBtn; @property(nonatomic)BOOL autodismiss; @property(nonatomic,assign)lodingViewdissMissStyle lodviewMissStyle; @@ -66,8 +67,10 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { //智能联机 self.isDeviceLinkIn = NO; [GWP2PDeviceLinker shareInstance].delegate=self; + self.deviceID=nil; //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillEnterForeground:) name:Noti_WillEnterForeground object:nil]; self.addresses = [[NSMutableDictionary alloc] initWithCapacity:1]; + self.linkDict = [[NSMutableDictionary alloc] initWithCapacity:1]; self.view.backgroundColor = [UIColor whiteColor]; [self addTitleViewWithTitle:@"连接摄像头"]; [self initComponent]; @@ -456,15 +459,16 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 -(void)deviceLinkin:(NSDictionary*)deviceDict linkType:(NSInteger)type { NSLog(@"声波配网成功,返回数据:%@",deviceDict); - if (self.isDeviceLinkIn) { - return; - } NSString *deviceID = [deviceDict[@"deviceID"] stringValue]; NSString *deviceIP = deviceDict[@"deviceIP"]; + if ([self.linkDict[deviceID] boolValue]) { + return; + } + //AP配网时有值 smart没有值 if ([self.deviceID isEqualToString:deviceID]||self.deviceID==nil) { - self.isDeviceLinkIn = YES; + if (type==conectType_Intelligent) { [self.view makeToast:@"声波配网成功"]; @@ -480,6 +484,7 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 // NSString *devicePassword = deviceDict[@"devicePassword"]; self.deviceID = deviceID; + self.linkDict[deviceID]=@(YES); [self resetPassWord];//初始化密码 if (![deviceDict[@"isInitPassword"] boolValue]){ //设备没有初始化密码,设置密码 [[GWP2PClient sharedClient] setDeviceInitialPassword:self.lastSetPassword withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { @@ -504,7 +509,7 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 -(void)deviceLinkinTimeout:(NSInteger)type { // - if (!self.isDeviceLinkIn) {//90秒之后还未连接上,连接超时 + if (self.deviceID.length&&![self.linkDict[self.deviceID] boolValue]) {//90秒之后还未连接上,连接超时 [[GWP2PDeviceLinker shareInstance] p2pStopAPLink]; [self connectNormalView]; @@ -518,6 +523,10 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 } } + else if(!self.deviceID.length) + { + [self.view makeToast:@"获取设备ID失败"]; + } } -(void)apLinkConnect {