From aade5019831b84ab65cc13fe0dcc80f3850b2ff5 Mon Sep 17 00:00:00 2001 From: wbzhan_macbook Date: Fri, 19 Jul 2019 08:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=93=BE=E6=8E=A5=E6=91=84?= =?UTF-8?q?=E5=83=8F=E5=A4=B4=E7=9A=84=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= =?UTF-8?q?V1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 10244 -> 10244 bytes Ifish.xcodeproj/project.pbxproj | 2 - .../IfishBindDeviceSelectViewController.m | 6 +- .../IfishP2PMonitorController.m | 29 ++-- .../YooseeNextConnectViewController.mm | 128 ++++++++---------- .../controllers/erweima/ScanViewController.m | 1 - 6 files changed, 70 insertions(+), 96 deletions(-) diff --git a/.DS_Store b/.DS_Store index fb3b6c3a2d9be7bf5d6e0e102f0dee4591e49e09..a6f91990bc6e3c1aa5a565422c627aeb1010cb19 100644 GIT binary patch delta 27 jcmZn(XbIR*Bf_k>Y2)OLB1)4rg?O2iCT!jy5+V!$jbI5^ delta 27 jcmZn(XbIR*Bf_i}cx&=T5v9qRLcC1s4x2ZKga`uwhv^8} diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index f410049..5d79ae2 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -15395,7 +15395,6 @@ "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YSlider", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YTargetAndAction", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/FounderButton", - "$(PROJECT_DIR)/Ifish/BaiLingSoundSdk/LSemTMFSet", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl", @@ -15509,7 +15508,6 @@ "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YSlider", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YTargetAndAction", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/FounderButton", - "$(PROJECT_DIR)/Ifish/BaiLingSoundSdk/LSemTMFSet", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl", diff --git a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m index 3a76662..1c2e91c 100644 --- a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m +++ b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m @@ -64,13 +64,13 @@ extern BOOL isfromCameraView; return; } - dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT); dispatch_async(queue, ^{ // // 追加任务1 -// self.islogInGewell = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil]; - + if ([GWP2PClient sharedClient].linkStatus!=P2PLinkStatusOK) { + [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil]; + } dispatch_async(dispatch_get_main_queue(), ^{ [SVProgressHUD dismiss]; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m index 99c432e..920c224 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m @@ -152,9 +152,9 @@ Strong UIImage *screenShotImage;//截图 return; } if ([self.contact.isActive isEqualToString:@"1"]) { - - [self cameraConnectSeting]; - + + [self monitorP2PCall]; + [self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES]; }else if ([self.contact.isActive isEqualToString:@"0"]){ UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"" message:@"请扫描产品外包装上的激活码来激活摄像头" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往扫描", nil]; @@ -163,16 +163,6 @@ Strong UIImage *screenShotImage;//截图 } } -//加tab 栏后新增 --(void)cameraConnectSeting{ - //rtsp监控界面弹出修改 - [self monitorP2PCall]; - //设置代理 - if (_isPushNextView) { - return; - } - [self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES]; -} //环境校验 -(void)checkNetStatus{ @@ -274,7 +264,9 @@ Strong UIImage *screenShotImage;//截图 } #pragma mark - 初始化设备 p2pConnect -(void)connectDevice{ - + if ([GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) { + _connectDevice = YES; + } UserModel *model=[dataContorl getUserInfo]; NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff]; //初始化设备 @@ -303,11 +295,11 @@ Strong UIImage *screenShotImage;//截图 return; } //p2p未连接 - if (!_connectDevice) { + if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) { [self connectDevice]; if(_connectDevice){ - // 连接摄像头 - [self monitorP2PCall]; + // 连接摄像头 + [self monitorP2PCall]; } } WEAK_SELF; @@ -330,6 +322,7 @@ Strong UIImage *screenShotImage;//截图 }); } ready:^{ + [self.view makeToast:@"连接成功"]; //呼叫成功操作 NSLog(@"连接摄像头成功 当前所在线程为%@",[NSThread currentThread]); //隐藏呼叫中的UI @@ -730,7 +723,6 @@ Strong UIImage *screenShotImage;//截图 if (self.contact.cameraId == model.cameraId ) { - [guanxiiArr removeObject:model]; //保存新关系数组 [[DataCenter defaultDtacenter] setValue:guanxiiArr forKey:@"devicamerArr"]; @@ -753,7 +745,6 @@ Strong UIImage *screenShotImage;//截图 UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"]; NSString *cameraId=self.contact.cameraId; - ; NSNumber *userId=model.userId; [para setValue:cameraId forKey:@"cameraId"]; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm index a45fdd6..b94b296 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm @@ -47,7 +47,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { @property (strong,nonatomic) NSMutableDictionary *addresses; //技威服务器 socket返回contactID 即cameraId -@property (nonatomic,copy) NSString *contactID; +//@property (nonatomic,copy) NSString *contactID; @property (nonatomic,assign) NSInteger flag; @property (nonatomic,assign) NSInteger type; @property (nonatomic,copy) NSString *address; @@ -393,68 +393,76 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { [self.view makeToast:@"声波配网成功"]; //如果智能联机,设备配网成功,就断开发送智能联机 [[GWP2PDeviceLinker shareInstance] p2pStopSmartLink]; - NSString *deviceID = [deviceDict[@"deviceID"] stringValue]; NSString *deviceIP = deviceDict[@"deviceIP"]; NSString *devicePassword = deviceDict[@"devicePassword"]; - weakSelf.contactID = [NSString stringWithFormat:@"%d",deviceID]; - if (![deviceDict[@"isInitPassword"] boolValue]) { //设备没有初始化密码,设置密码 + weakSelf.deviceID = deviceID; + [self resetPassWord];//初始化密码 + //如果重置之后,则重新设置密码 + if (IsEmptyStr(devicePassword)) { //设备没有初始化密码,设置密码 [[GWP2PClient sharedClient] setDeviceInitialPassword:@"123" withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { NSLog(@"success:%i %@",success,dataDictionary); - [weakSelf.view makeToast:[NSString stringWithFormat:@"未初始化过设备密码,初始化设备密码失败 result = %i",dataDictionary]]; [weakSelf resetPassWord];//初始化密码 - if (success) { - [weakSelf initPwdResault:dataDictionary]; - }else{ - dispatch_async(dispatch_get_main_queue(), ^{ - //只为做 dissPogress处理并非成功 - weakSelf.lodviewMissStyle =lodingViewdissMissSuccsess; - [weakSelf connectNormalView]; - _canDissMissController = YES; + [weakSelf bindCameraDevice]; +// if (success) { +// [weakSelf initPwdResault:dataDictionary]; +// }else{ +// dispatch_async(dispatch_get_main_queue(), ^{ +// //只为做 dissPogress处理并非成功 +// weakSelf.lodviewMissStyle =lodingViewdissMissSuccsess; +// [weakSelf connectNormalView]; +// _canDissMissController = YES; // [weakSelf.view makeToast:NSLocalizedString(@"operator_failure", nil)]; - }); - } +// }); +// } }]; - } else { - //设备已经初始化过密码,则直接获取设备信息 + }else{ [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:devicePassword completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { NSLog(@"success:%i %@",success,dataDictionary); - [weakSelf.view makeToast:[NSString stringWithFormat:@"获取设备信息失败 result = %i",dataDictionary]]; [weakSelf resetPassWord];//更新密码 - if (success) { - dispatch_async(dispatch_get_main_queue(), ^{ - //[self.view makeToast:NSLocalizedString(@"operator_success", nil)]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - usleep(800000); - dispatch_async(dispatch_get_main_queue(), ^{ - - [weakSelf ifishUserBindcameraIdBy:self.contactID]; - - }); - }); - }); - }else{ - dispatch_async(dispatch_get_main_queue(), ^{ - - self.lodviewMissStyle =lodingViewdissMissSuccsess; - [self connectNormalView]; - _canDissMissController = YES; -// [self.view makeToast:NSLocalizedString(@"operator_failure", nil)]; - - }); - } + [weakSelf bindCameraDevice]; + }]; } +// else { +// //设备已经初始化过密码,则直接获取设备信息 +// [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:devicePassword completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { +// NSLog(@"success:%i %@",success,dataDictionary); +// [weakSelf resetPassWord];//更新密码 +// if (success) { +// dispatch_async(dispatch_get_main_queue(), ^{ +// //[self.view makeToast:NSLocalizedString(@"operator_success", nil)]; +// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ +// usleep(800000); +// dispatch_async(dispatch_get_main_queue(), ^{ +// +// [weakSelf ifishUserBindcameraIdBy:self.contactID]; +// +// }); +// }); +// }); +// }else{ +// dispatch_async(dispatch_get_main_queue(), ^{ +// +// self.lodviewMissStyle =lodingViewdissMissSuccsess; +// [self connectNormalView]; +// _canDissMissController = YES; +// [self.view makeToast:NSLocalizedString(@"operator_failure", nil)]; +// +// }); +// } +// }]; +// } }]; } //初始化设备密码回调 --(void)initPwdResault:(NSDictionary *)parameter{ +-(void)bindCameraDevice{ - NSString * contactName = [NSString stringWithFormat:@"Cam%@", self.contactID]; + NSString * contactName = [NSString stringWithFormat:@"Cam%@", self.deviceID]; ContactDAO *contactDAO = [[ContactDAO alloc] init]; - Contact *contact = [contactDAO isContact:self.contactID]; + Contact *contact = [contactDAO isContact:self.deviceID]; if(contact!=nil){ @@ -464,39 +472,18 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { [[FListManager sharedFList] updatee:contact]; - dispatch_async(dispatch_get_main_queue(), ^{ - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - usleep(800000); - dispatch_async(dispatch_get_main_queue(), ^{ - //设置密码成功后爱鱼奇用户绑定摄像头 - [self ifishUserBindcameraIdBy:self.contactID]; - - }); - }); - }); + [self ifishUserBindcameraIdBy:self.deviceID]; + }else{ Contact *contact = [[Contact alloc] init]; - contact.contactId = self.contactID; + contact.contactId = self.deviceID; contact.contactName = contactName; contact.contactPassword = self.lastSetPassword; contact.contactType = CONTACT_TYPE_UNKNOWN; [[FListManager sharedFList] insert:contact]; - - dispatch_async(dispatch_get_main_queue(), ^{ - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - usleep(800000); - dispatch_async(dispatch_get_main_queue(), ^{ - - //设置密码成功后爱鱼奇用户绑定摄像头 - [self ifishUserBindcameraIdBy:self.contactID]; - - - }); - }); - }); + //设置密码成功后爱鱼奇用户绑定摄像头 + [self ifishUserBindcameraIdBy:self.deviceID]; } } @@ -638,12 +625,11 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) { -(void)ifishUserBindcameraIdBy:(NSString *)cameraId { - + NSLog(@"cameraId = %@",cameraId); NSMutableArray *oldCameraArr= [[DataCenter defaultDtacenter]valueForKey:@"cameraArr"]; if (!oldCameraArr) { //无设备 oldCameraArr = [[NSMutableArray alloc] init]; - } IfishCameraModel *camer=[[IfishCameraModel alloc] init]; diff --git a/Ifish/controllers/erweima/ScanViewController.m b/Ifish/controllers/erweima/ScanViewController.m index 7585e7a..903043f 100644 --- a/Ifish/controllers/erweima/ScanViewController.m +++ b/Ifish/controllers/erweima/ScanViewController.m @@ -388,7 +388,6 @@ if ([camera.cameraId isEqualToString:cameraId]) { camera.isActive = @"1"; - }